mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-27 18:11:20 +00:00
Refactor install script and add websocat support
Refactored helper functions for clarity and consistency, including renaming and parameter changes. Added support for downloading and installing websocat, updated artifact URLs and extraction logic, and improved architecture-specific handling for optional tools. Enhanced output messages and error handling throughout the script.
This commit is contained in:
parent
cc86267471
commit
ef966dfe1d
290
afterInstall.ps1
290
afterInstall.ps1
|
|
@ -3,7 +3,7 @@
|
||||||
# ================================
|
# ================================
|
||||||
$AppName = "welsonjs"
|
$AppName = "welsonjs"
|
||||||
$TargetDir = Join-Path $env:APPDATA $AppName
|
$TargetDir = Join-Path $env:APPDATA $AppName
|
||||||
$TmpDir = Join-Path $env:TEMP "$AppName-downloads"
|
$TmpDir = Join-Path $env:TEMP "$AppName-downloads"
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "[*] Target directory : $TargetDir"
|
Write-Host "[*] Target directory : $TargetDir"
|
||||||
|
|
@ -31,20 +31,19 @@ Write-Host ""
|
||||||
# ================================
|
# ================================
|
||||||
# HELPER FUNCTIONS
|
# HELPER FUNCTIONS
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
function Ensure-EmptyDirectory {
|
function Ensure-EmptyDirectory {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$Path
|
[string]$Path
|
||||||
)
|
)
|
||||||
|
|
||||||
# If a file exists at the path, remove it
|
# If a file exists at this path, delete it
|
||||||
if (Test-Path $Path -PathType Leaf) {
|
if (Test-Path $Path -PathType Leaf) {
|
||||||
Write-Host "[WARN] A file exists at path '$Path'. Deleting it..."
|
Write-Host "[WARN] File exists at '$Path'. Removing..."
|
||||||
Remove-Item -Path $Path -Force
|
Remove-Item -Path $Path -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure directory exists
|
# Ensure a directory exists at this path
|
||||||
if (-not (Test-Path $Path -PathType Container)) {
|
if (-not (Test-Path $Path -PathType Container)) {
|
||||||
Write-Host "[*] Creating directory: $Path"
|
Write-Host "[*] Creating directory: $Path"
|
||||||
New-Item -ItemType Directory -Path $Path -Force | Out-Null
|
New-Item -ItemType Directory -Path $Path -Force | Out-Null
|
||||||
|
|
@ -53,18 +52,18 @@ function Ensure-EmptyDirectory {
|
||||||
|
|
||||||
function Download-File {
|
function Download-File {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$Url,
|
[string]$Url,
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$Destination
|
[string]$DestinationPath
|
||||||
)
|
)
|
||||||
|
|
||||||
Write-Host "[*] Downloading file..."
|
Write-Host "[*] Downloading file..."
|
||||||
Write-Host " URL : $Url"
|
Write-Host " URL : $Url"
|
||||||
Write-Host " OUT : $Destination"
|
Write-Host " OUT : $DestinationPath"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -Uri $Url -OutFile $Destination -UseBasicParsing -ErrorAction Stop
|
Invoke-WebRequest -Uri $Url -OutFile $DestinationPath -UseBasicParsing -ErrorAction Stop
|
||||||
Write-Host "[OK] Download completed."
|
Write-Host "[OK] Download completed."
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
}
|
}
|
||||||
|
|
@ -75,103 +74,102 @@ function Download-File {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Extract-Zip {
|
function Extract-CompressedFile {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$ZipPath,
|
[string]$CompressedPath,
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$DestDir
|
[string]$DestinationDirectory
|
||||||
)
|
)
|
||||||
|
|
||||||
Write-Host "[*] Extracting ZIP:"
|
Write-Host "[*] Extracting compressed file:"
|
||||||
Write-Host " $ZipPath"
|
Write-Host " $CompressedPath"
|
||||||
Write-Host " -> $DestDir"
|
Write-Host " -> $DestinationDirectory"
|
||||||
|
|
||||||
# Make sure destination directory exists and is a directory
|
# Ensure destination directory exists
|
||||||
Ensure-EmptyDirectory -Path $DestDir
|
Ensure-EmptyDirectory -Path $DestinationDirectory
|
||||||
|
|
||||||
# Temporary extraction folder inside destination
|
# Temporary extraction workspace inside destination directory
|
||||||
$TmpExtract = Join-Path $DestDir "__tmp_extract__"
|
$TemporaryExtractDirectory = Join-Path $DestinationDirectory "__tmp_extract__"
|
||||||
Ensure-EmptyDirectory -Path $TmpExtract
|
Ensure-EmptyDirectory -Path $TemporaryExtractDirectory
|
||||||
|
|
||||||
Write-Host "[DEBUG] PowerShell command:"
|
Write-Host "[DEBUG] Expand-Archive command:"
|
||||||
Write-Host " Expand-Archive -LiteralPath `"$ZipPath`" -DestinationPath `"$TmpExtract`" -Force"
|
Write-Host " Expand-Archive -LiteralPath `"$CompressedPath`" -DestinationPath `"$TemporaryExtractDirectory`" -Force"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Expand-Archive -LiteralPath $ZipPath -DestinationPath $TmpExtract -Force -ErrorAction Stop
|
Expand-Archive -LiteralPath $CompressedPath -DestinationPath $TemporaryExtractDirectory -Force -ErrorAction Stop
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host "[ERROR] Failed to extract ZIP with Expand-Archive: $ZipPath"
|
Write-Host "[ERROR] Failed to extract: $CompressedPath"
|
||||||
Write-Host $_.Exception.Message
|
Write-Host $_.Exception.Message
|
||||||
throw
|
throw
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check extracted entries
|
# Move extracted content into final destination
|
||||||
$entries = Get-ChildItem -LiteralPath $TmpExtract
|
$entries = Get-ChildItem -LiteralPath $TemporaryExtractDirectory
|
||||||
|
|
||||||
if (-not $entries -or $entries.Count -eq 0) {
|
if (-not $entries -or $entries.Count -eq 0) {
|
||||||
Write-Host "[ERROR] No entries were extracted from ZIP: $ZipPath"
|
Write-Host "[ERROR] No entries were extracted from archive: $CompressedPath"
|
||||||
throw "ZIP appears to be empty or extraction failed."
|
throw "Archive appears to be empty or extraction failed."
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entries.Count -eq 1 -and $entries[0].PSIsContainer) {
|
if ($entries.Count -eq 1 -and $entries[0].PSIsContainer) {
|
||||||
Write-Host "[*] Detected single root directory inside ZIP. Flattening..."
|
# Single root directory inside archive -> flatten
|
||||||
|
Write-Host "[*] Archive has a single root directory. Flattening..."
|
||||||
# Move children of the single root directory into destination
|
|
||||||
$innerItems = Get-ChildItem -LiteralPath $entries[0].FullName
|
$innerItems = Get-ChildItem -LiteralPath $entries[0].FullName
|
||||||
foreach ($item in $innerItems) {
|
foreach ($item in $innerItems) {
|
||||||
Move-Item -LiteralPath $item.FullName -Destination $DestDir -Force
|
Move-Item -LiteralPath $item.FullName -Destination $DestinationDirectory -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "[*] ZIP has multiple top-level entries. Copying all..."
|
# Multiple top-level entries
|
||||||
|
Write-Host "[*] Archive has multiple top-level entries. Moving all..."
|
||||||
foreach ($item in $entries) {
|
foreach ($item in $entries) {
|
||||||
Move-Item -LiteralPath $item.FullName -Destination $DestDir -Force
|
Move-Item -LiteralPath $item.FullName -Destination $DestinationDirectory -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up temp extraction folder
|
# Clean up temporary extraction directory
|
||||||
Remove-Item -LiteralPath $TmpExtract -Recurse -Force
|
Remove-Item -LiteralPath $TemporaryExtractDirectory -Recurse -Force
|
||||||
|
|
||||||
Write-Host "[OK] ZIP extraction completed."
|
Write-Host "[OK] Extraction completed."
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function Extract-TarGz {
|
function Extract-TarGzArchive {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$TarGzPath,
|
[string]$ArchivePath,
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$DestDir
|
[string]$DestinationDirectory
|
||||||
)
|
)
|
||||||
|
|
||||||
Write-Host "[*] Extracting TAR.GZ:"
|
Write-Host "[*] Extracting TAR.GZ archive:"
|
||||||
Write-Host " $TarGzPath"
|
Write-Host " $ArchivePath"
|
||||||
Write-Host " -> $DestDir"
|
Write-Host " -> $DestinationDirectory"
|
||||||
|
|
||||||
Ensure-EmptyDirectory -Path $DestDir
|
Ensure-EmptyDirectory -Path $DestinationDirectory
|
||||||
|
|
||||||
# Modern Windows ships with tar, but we validate its presence
|
# Validate tar availability
|
||||||
$tarCmd = Get-Command tar -ErrorAction SilentlyContinue
|
$tarCommand = Get-Command tar -ErrorAction SilentlyContinue
|
||||||
if (-not $tarCmd) {
|
if (-not $tarCommand) {
|
||||||
Write-Host "[ERROR] 'tar' command not found. Cannot extract TAR.GZ."
|
Write-Host "[ERROR] 'tar' command not found."
|
||||||
throw "tar command not found."
|
throw "tar not available on this system."
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "[DEBUG] tar command:"
|
Write-Host "[DEBUG] tar command:"
|
||||||
Write-Host " tar -xzf `"$TarGzPath`" -C `"$DestDir`""
|
Write-Host " tar -xzf `"$ArchivePath`" -C `"$DestinationDirectory`""
|
||||||
|
|
||||||
try {
|
try {
|
||||||
& tar -xzf "$TarGzPath" -C "$DestDir"
|
& tar -xzf "$ArchivePath" -C "$DestinationDirectory"
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "tar exit code $LASTEXITCODE"
|
throw "tar exited with code $LASTEXITCODE"
|
||||||
}
|
}
|
||||||
Write-Host "[OK] TAR.GZ extraction completed."
|
Write-Host "[OK] TAR.GZ extraction completed."
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host "[ERROR] Failed to extract TAR.GZ: $TarGzPath"
|
Write-Host "[ERROR] Failed to extract TAR.GZ archive: $ArchivePath"
|
||||||
Write-Host $_.Exception.Message
|
Write-Host $_.Exception.Message
|
||||||
throw
|
throw
|
||||||
}
|
}
|
||||||
|
|
@ -185,115 +183,193 @@ $PythonUrl = $null
|
||||||
$CurlUrl = $null
|
$CurlUrl = $null
|
||||||
$YaraUrl = $null
|
$YaraUrl = $null
|
||||||
$WamrUrl = $null
|
$WamrUrl = $null
|
||||||
|
$WebsocatUrl = $null
|
||||||
# WelsonJS binary artifacts
|
$ArtifactsUrl = $null
|
||||||
$ArtifactsUrl = "https://catswords.blob.core.windows.net/welsonjs/artifacts.zip"
|
|
||||||
|
|
||||||
switch ($arch) {
|
switch ($arch) {
|
||||||
"x64" {
|
"x64" {
|
||||||
# Python embeddable (x64)
|
# Python embeddable (x64)
|
||||||
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-amd64.zip"
|
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-amd64.zip"
|
||||||
|
|
||||||
# curl (x64, mingw)
|
# curl (x64, mingw)
|
||||||
$CurlUrl = "https://curl.se/windows/latest.cgi?p=win64-mingw.zip"
|
$CurlUrl = "https://curl.se/windows/latest.cgi?p=win64-mingw.zip"
|
||||||
|
|
||||||
# YARA (x64, GitHub — as you specified)
|
# YARA (x64)
|
||||||
$YaraUrl = "https://github.com/VirusTotal/yara/releases/download/v4.5.5/yara-4.5.5-2368-win64.zip"
|
$YaraUrl = "https://github.com/VirusTotal/yara/releases/download/v4.5.5/yara-4.5.5-2368-win64.zip"
|
||||||
|
|
||||||
# WAMR (x64 only)
|
# WAMR (x64)
|
||||||
$WamrUrl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-2.4.3/iwasm-2.4.3-x86_64-windows-2022.tar.gz"
|
$WamrUrl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-2.4.3/iwasm-2.4.3-x86_64-windows-2022.tar.gz"
|
||||||
|
|
||||||
|
# websocat (x64)
|
||||||
|
$WebsocatUrl = "https://catswords.blob.core.windows.net/welsonjs/websocat-1.14.0.x86_64-pc-windows-gnu.zip"
|
||||||
|
|
||||||
|
# WelsonJS binary artifacts (x86 compatible)
|
||||||
|
$ArtifactsUrl = "https://catswords.blob.core.windows.net/welsonjs/artifacts.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
"arm64" {
|
"arm64" {
|
||||||
# Python embeddable (ARM64)
|
# Python embeddable (ARM64)
|
||||||
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-arm64.zip"
|
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-arm64.zip"
|
||||||
|
|
||||||
# curl (ARM64)
|
# curl (ARM64)
|
||||||
$CurlUrl = "https://curl.se/windows/latest.cgi?p=win64a-mingw.zip"
|
$CurlUrl = "https://curl.se/windows/latest.cgi?p=win64a-mingw.zip"
|
||||||
|
|
||||||
# DO NOT install YARA/WAMR on ARM64
|
# No YARA / WAMR / websocat / artifacts for ARM64 in this script
|
||||||
$YaraUrl = $null
|
$YaraUrl = $null
|
||||||
$WamrUrl = $null
|
$WamrUrl = $null
|
||||||
|
$WebsocatUrl = $null
|
||||||
|
$ArtifactsUrl = $null
|
||||||
}
|
}
|
||||||
|
|
||||||
default {
|
default {
|
||||||
# Treat anything else as x86
|
|
||||||
# Python embeddable (x86)
|
# Python embeddable (x86)
|
||||||
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-win32.zip"
|
$PythonUrl = "https://www.python.org/ftp/python/3.13.9/python-3.13.9-embeddable-win32.zip"
|
||||||
|
|
||||||
# curl (x86)
|
# curl (x86)
|
||||||
$CurlUrl = "https://downloads.sourceforge.net/project/muldersoft/cURL/curl-8.17.0-win-x86-full.2025-11-09.zip";
|
$CurlUrl = "https://downloads.sourceforge.net/project/muldersoft/cURL/curl-8.17.0-win-x86-full.2025-11-09.zip"
|
||||||
|
|
||||||
# Do NOT install YARA/WAMR on x86 (same policy as before)
|
# YARA (x86)
|
||||||
$YaraUrl = $null
|
$YaraUrl = "https://github.com/VirusTotal/yara/releases/download/v4.5.5/yara-4.5.5-2368-win32.zip"
|
||||||
$WamrUrl = $null
|
|
||||||
|
# No WAMR for x86
|
||||||
|
$WamrUrl = $null
|
||||||
|
|
||||||
|
# websocat (x86)
|
||||||
|
$WebsocatUrl = "https://catswords.blob.core.windows.net/welsonjs/websocat-1.14.0.i686-pc-windows-gnu.zip"
|
||||||
|
|
||||||
|
# WelsonJS binary artifacts (x86 compatible)
|
||||||
|
$ArtifactsUrl = "https://catswords.blob.core.windows.net/welsonjs/artifacts.zip"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "[*] Python URL : $PythonUrl"
|
Write-Host "[*] Python URL : $PythonUrl"
|
||||||
Write-Host "[*] curl URL : $CurlUrl"
|
Write-Host "[*] curl URL : $CurlUrl"
|
||||||
if ($YaraUrl) {
|
if ($YaraUrl) {
|
||||||
Write-Host "[*] YARA URL : $YaraUrl"
|
Write-Host "[*] YARA URL : $YaraUrl"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "[*] YARA : skipped on this architecture"
|
Write-Host "[*] YARA : skipped on this architecture"
|
||||||
}
|
}
|
||||||
if ($WamrUrl) {
|
if ($WamrUrl) {
|
||||||
Write-Host "[*] WAMR URL : $WamrUrl"
|
Write-Host "[*] WAMR URL : $WamrUrl"
|
||||||
} else {
|
} else {
|
||||||
Write-Host "[*] WAMR : skipped on this architecture"
|
Write-Host "[*] WAMR : skipped on this architecture"
|
||||||
|
}
|
||||||
|
if ($WebsocatUrl) {
|
||||||
|
Write-Host "[*] websocat URL : $WebsocatUrl"
|
||||||
|
} else {
|
||||||
|
Write-Host "[*] websocat : skipped on this architecture"
|
||||||
|
}
|
||||||
|
if ($ArtifactsUrl) {
|
||||||
|
Write-Host "[*] artifacts URL : $ArtifactsUrl"
|
||||||
|
} else {
|
||||||
|
Write-Host "[*] artifacts : skipped on this architecture"
|
||||||
}
|
}
|
||||||
Write-Host "[*] artifacts URL: $ArtifactsUrl"
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
|
|
||||||
# ================================
|
# ================================
|
||||||
# DOWNLOAD FILES
|
# DOWNLOAD FILES (websocat before artifacts)
|
||||||
# ================================
|
# ================================
|
||||||
$PythonZip = Join-Path $TmpDir "python.zip"
|
$PythonCompressed = Join-Path $TmpDir "python.zip"
|
||||||
$CurlZip = Join-Path $TmpDir "curl.zip"
|
$CurlCompressed = Join-Path $TmpDir "curl.zip"
|
||||||
$YaraZip = Join-Path $TmpDir "yara.zip"
|
$YaraCompressed = Join-Path $TmpDir "yara.zip"
|
||||||
$WamrTgz = Join-Path $TmpDir "wamr.tar.gz"
|
$WamrArchive = Join-Path $TmpDir "wamr.tar.gz"
|
||||||
$ArtifactsZip = Join-Path $TmpDir "artifacts.zip"
|
$WebsocatCompressed = Join-Path $TmpDir "websocat.zip"
|
||||||
|
$ArtifactsCompressed = Join-Path $TmpDir "artifacts.zip"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Download-File -Url $PythonUrl -Destination $PythonZip
|
# Python
|
||||||
Download-File -Url $CurlUrl -Destination $CurlZip
|
Download-File -Url $PythonUrl -DestinationPath $PythonCompressed
|
||||||
|
|
||||||
|
# curl
|
||||||
|
Download-File -Url $CurlUrl -DestinationPath $CurlCompressed
|
||||||
|
|
||||||
|
# YARA (optional)
|
||||||
if ($YaraUrl) {
|
if ($YaraUrl) {
|
||||||
Download-File -Url $YaraUrl -Destination $YaraZip
|
Download-File -Url $YaraUrl -DestinationPath $YaraCompressed
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "[*] YARA download skipped on this architecture."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# WAMR (optional)
|
||||||
if ($WamrUrl) {
|
if ($WamrUrl) {
|
||||||
Download-File -Url $WamrUrl -Destination $WamrTgz
|
Download-File -Url $WamrUrl -DestinationPath $WamrArchive
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "[*] WAMR download skipped on this architecture."
|
||||||
}
|
}
|
||||||
|
|
||||||
Download-File -Url $ArtifactsUrl -Destination $ArtifactsZip
|
# websocat (optional)
|
||||||
|
if ($WebsocatUrl) {
|
||||||
|
Download-File -Url $WebsocatUrl -DestinationPath $WebsocatCompressed
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "[*] websocat download skipped on this architecture."
|
||||||
|
}
|
||||||
|
|
||||||
|
# artifacts
|
||||||
|
if ($ArtifactsUrl) {
|
||||||
|
Download-File -Url $ArtifactsUrl -DestinationPath $ArtifactsCompressed
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "[*] artifacts download skipped on this architecture."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host "[FATAL] Download phase failed."
|
Write-Host "[FATAL] Download phase faled."
|
||||||
|
Write-Host $_.Exception.Message
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ================================
|
# ================================
|
||||||
# EXTRACT FILES
|
# EXTRACT / INSTALL (websocat before artifacts)
|
||||||
# ================================
|
# ================================
|
||||||
try {
|
try {
|
||||||
Extract-Zip -ZipPath $PythonZip -DestDir (Join-Path $TargetDir "python")
|
# Python
|
||||||
Extract-Zip -ZipPath $CurlZip -DestDir (Join-Path $TargetDir "curl")
|
Extract-CompressedFile -CompressedPath $PythonCompressed -DestinationDirectory (Join-Path $TargetDir "python")
|
||||||
|
|
||||||
|
# curl
|
||||||
|
Extract-CompressedFile -CompressedPath $CurlCompressed -DestinationDirectory (Join-Path $TargetDir "curl")
|
||||||
|
|
||||||
|
# YARA
|
||||||
if ($YaraUrl) {
|
if ($YaraUrl) {
|
||||||
Extract-Zip -ZipPath $YaraZip -DestDir (Join-Path $TargetDir "yara")
|
Extract-CompressedFile -CompressedPath $YaraCompressed -DestinationDirectory (Join-Path $TargetDir "yara")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "[*] YARA installation skipped on this architecture."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# WAMR (TAR.GZ)
|
||||||
if ($WamrUrl) {
|
if ($WamrUrl) {
|
||||||
Extract-TarGz -TarGzPath $WamrTgz -DestDir (Join-Path $TargetDir "wamr")
|
Extract-TarGzArchive -ArchivePath $WamrArchive -DestinationDirectory (Join-Path $TargetDir "wamr")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "[*] WAMR installation skipped on this architecture."
|
||||||
}
|
}
|
||||||
|
|
||||||
Extract-Zip -ZipPath $ArtifactsZip -DestDir (Join-Path $TargetDir "bin")
|
# websocat
|
||||||
|
if ($WebsocatUrl) {
|
||||||
|
Extract-CompressedFile -CompressedPath $WebsocatCompressed -DestinationDirectory (Join-Path $TargetDir "websocat")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "[*] websocat installation skipped on this architecture."
|
||||||
|
}
|
||||||
|
|
||||||
|
# artifacts
|
||||||
|
if ($ArtifactsUrl) {
|
||||||
|
Extract-CompressedFile -CompressedPath $ArtifactsCompressed -DestinationDirectory (Join-Path $TargetDir "bin")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "[*] artifacts installation skipped on this architecture."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host "[FATAL] Extraction phase failed."
|
Write-Host "[FATAL] Extraction/installation phase failed."
|
||||||
|
Write-Host $_.Exception.Message
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,7 +377,7 @@ catch {
|
||||||
# ================================
|
# ================================
|
||||||
# FINISH
|
# FINISH
|
||||||
# ================================
|
# ================================
|
||||||
Write-Host "[*] All tools installed successfully."
|
Write-Host "[*] Installation completed successfully."
|
||||||
Write-Host "[*] Installed into: $TargetDir"
|
Write-Host "[*] Installed into: $TargetDir"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user