|
|
|
@ -675,16 +675,31 @@ fi
|
|
|
|
|
#<shell-payload> |
|
|
|
|
|
|
|
|
|
url_kitbase="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master" |
|
|
|
|
|
|
|
|
|
wdir="$(pwd)"; [ "$(pwd)" = "/" ] && wdir="" |
|
|
|
|
case "$0" in |
|
|
|
|
/*) scriptpath="${0}";; |
|
|
|
|
*) scriptpath="$wdir/${0#./}";; |
|
|
|
|
esac |
|
|
|
|
scriptdir="${scriptpath%/*}" |
|
|
|
|
scriptdir=$(realpath $scriptdir) |
|
|
|
|
scriptpath=$(realpath $scriptpath) |
|
|
|
|
basename=$(basename "$scriptpath") #e.g fetchruntime.bash |
|
|
|
|
scriptroot="${basename%.*}" #e.g "fetchruntime" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
runtime_available=0 |
|
|
|
|
if [[ "$OSTYPE" == "linux"* ]]; then |
|
|
|
|
arch=$(uname -i) |
|
|
|
|
if [[ "$arch" == "x86_64"* ]]; then |
|
|
|
|
url="${url_kitbase}/linux-x86_64/tclkit-902-Linux64-intel-dyn" |
|
|
|
|
output="../src/runtime/tclkit-902-Linux64-intel-dyn" |
|
|
|
|
outdir="${scriptdir}/runtime/linux-x86_64"; mkdir -p $outdir |
|
|
|
|
output="${outdir}/tclkit-902-Linux64-intel-dyn" |
|
|
|
|
runtime_available=1 |
|
|
|
|
elif [[ "$arch" == "arm"* ]]; then |
|
|
|
|
url="${url_kitbase}/linux-x86_64/tclkit-902-Linux64-arm-dyn" |
|
|
|
|
output="../src/runtime/tclkit-902-Linux64-arm-dyn" |
|
|
|
|
url="${url_kitbase}/linux-arm/tclkit-902-Linux64-arm-dyn" |
|
|
|
|
outdir="${scriptdir}/runtime/linux-arm"; mkdir -p $outdir |
|
|
|
|
output="${outdir}/tclkit-902-Linux64-arm-dyn" |
|
|
|
|
runtime_available=1 |
|
|
|
|
fi |
|
|
|
|
if [[ "$runtime_available" -eq 1 ]]; then |
|
|
|
@ -696,7 +711,8 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
|
os="macosx" |
|
|
|
|
#assumed to be Mach-O 'universal binaries' for both x86-64 and arm? - REVIEW |
|
|
|
|
url="${url_kitbase}/macosx/tclkit-902-Darwin64-dyn" |
|
|
|
|
output="../src/runtime/tclkit-902-Darwin64-dyn" |
|
|
|
|
outdir="${scriptdir}/runtime/macosx/"; mkdir -p $outdir |
|
|
|
|
output="${outdir}/tclkit-902-Darwin64-dyn" |
|
|
|
|
runtime_available=1 |
|
|
|
|
elif [[ "$OSTYPE" == "freebsd"* ]]; then |
|
|
|
|
os="freebsd" |
|
|
|
@ -707,9 +723,9 @@ elif [[ "$OSTYPE" == "netbsd"* ]]; then
|
|
|
|
|
elif [[ "$OSTYPE" == "win32" ]]; then |
|
|
|
|
os="win32" |
|
|
|
|
url="${url_kitbase}/win32-x86_64/tclsh902z.exe" |
|
|
|
|
outdir="${scriptdir}/runtime/win32-x86_64/"; mkdir -p $outdir |
|
|
|
|
output="${outdir}/tcsh902z.exe" |
|
|
|
|
runtime_available=1 |
|
|
|
|
#scriptdir? |
|
|
|
|
output="../src/runtime/tclsh902z.exe" |
|
|
|
|
elif [[ "$OSTYPE" == "msys" ]]; then |
|
|
|
|
echo MSYS |
|
|
|
|
os="win32" |
|
|
|
@ -721,8 +737,8 @@ elif [[ "$OSTYPE" == "msys" ]]; then
|
|
|
|
|
#This breaks calls to various unix utils such as sed etc (wsl related?) |
|
|
|
|
export PATH="$shellfolder${PATH:+:${PATH}}" |
|
|
|
|
url="${url_kitbase}/win32-x86_64/tclsh902z.exe" |
|
|
|
|
#scriptdir? |
|
|
|
|
output="../src/runtime/tclsh902z.exe" |
|
|
|
|
outdir="${scriptdir}/runtime/win32-x86_64/tclsh902z.exe"; mkdir -p $outdir |
|
|
|
|
output="${outdir}/tclsh902z.exe" |
|
|
|
|
runtime_available=1 |
|
|
|
|
else |
|
|
|
|
#os="$OSTYPE" |
|
|
|
@ -736,6 +752,7 @@ if [[ "$runtime_available" -eq 1 ]]; then
|
|
|
|
|
curl -SL --output "$output" "$url" |
|
|
|
|
if [[ $? -eq 0 ]]; then |
|
|
|
|
echo "File downloaded to $output" |
|
|
|
|
chmod +x $output |
|
|
|
|
else |
|
|
|
|
echo "Error: Failed to download to $output" |
|
|
|
|
fi |
|
|
|
@ -950,7 +967,16 @@ if ($matches.count) {
|
|
|
|
|
#<powershell-payload> |
|
|
|
|
|
|
|
|
|
$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tclsh902z.exe" |
|
|
|
|
$output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh902z.exe")" |
|
|
|
|
|
|
|
|
|
$outbase = $PSScriptRoot |
|
|
|
|
$outbase = Resolve-Path -Path $outbase |
|
|
|
|
#expected script location is the bin folder of a punk project |
|
|
|
|
$rtfolder = Join-Path -Path $outbase -ChildPath "runtime" |
|
|
|
|
#$output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh902z.exe")" |
|
|
|
|
$output = "$(join-path $rtfolder "win32-x86_64\tclsh902z.exe")" |
|
|
|
|
|
|
|
|
|
$container = split-path -Path $output -Parent |
|
|
|
|
new-item -Path $container -ItemType Directory -force #create with intermediary folders if not already present |
|
|
|
|
|
|
|
|
|
if (-not(Test-Path -Path $output -PathType Leaf)) { |
|
|
|
|
Write-Host "Downloading from $url ..." |
|
|
|
|