mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 05:35:52 +00:00
Comment download scripts more
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
- Replace old download implementations
|
||||
- Enable packing programs for CLI
|
||||
- Fix minor packing issues
|
||||
- Comment download scripts more
|
||||
|
||||
### 3.3.0 (2025-01-03)
|
||||
|
||||
|
||||
@@ -111,18 +111,22 @@ function download_programs() {
|
||||
echo "===== Downloading Required Programs ====="
|
||||
for PREFIX in "${DL_PREFIXES[@]}"; do
|
||||
for RUNTIME in "${CHECK_RUNTIMES[@]}"; do
|
||||
# Check for a valid URL
|
||||
DL_KEY=$PREFIX"_"$RUNTIME
|
||||
URL=${DL_MAP[$DL_KEY]}
|
||||
if [ -z "$URL" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Download the file to a predictable local file
|
||||
EXT=${URL##*.}
|
||||
OUTNAME=$PREFIX"_"$RUNTIME.$EXT
|
||||
wget $URL -O $OUTNAME
|
||||
|
||||
TEMPDIR=$PREFIX"_"$RUNTIME-temp
|
||||
OUTDIR=$PREFIX"_"$RUNTIME-dir
|
||||
|
||||
# Handle gzipped files separately
|
||||
if [[ $URL =~ \.tar\.gz$ ]]; then
|
||||
mkdir $TEMPDIR
|
||||
tar -xvf $OUTNAME -C $TEMPDIR
|
||||
@@ -130,6 +134,7 @@ function download_programs() {
|
||||
unzip -u $OUTNAME -d $TEMPDIR
|
||||
fi
|
||||
|
||||
# Create the proper structure
|
||||
mkdir $OUTDIR
|
||||
mv $TEMPDIR/*/** $OUTDIR/
|
||||
mv $TEMPDIR/** $OUTDIR/
|
||||
@@ -137,8 +142,10 @@ function download_programs() {
|
||||
|
||||
if [ -d "$OUTDIR/bin" ]; then
|
||||
mv $OUTDIR/bin/* $OUTDIR/
|
||||
rm -rf $OUTDIR/bin
|
||||
fi
|
||||
|
||||
# Remove empty subdirectories
|
||||
rm -rd $OUTDIR
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
@@ -101,12 +101,14 @@ function Download-Programs {
|
||||
Write-Host "===== Downloading Required Programs ====="
|
||||
foreach ($PREFIX in $DL_PREFIXES) {
|
||||
foreach ($RUNTIME in $CHECK_RUNTIMES) {
|
||||
# Check for a valid URL
|
||||
$DL_KEY = $PREFIX + "_" + $RUNTIME
|
||||
$URL = $DL_MAP[$DL_KEY]
|
||||
if ( [string]::IsNullOrEmpty($URL) ) {
|
||||
continue
|
||||
}
|
||||
|
||||
# Download the file to a predictable local file
|
||||
$EXT = [System.IO.Path]::GetExtension($URL)
|
||||
$OUTNAME = $PREFIX + "_" + $RUNTIME + $EXT
|
||||
Invoke-WebRequest -Uri $URL -OutFile $OUTNAME
|
||||
@@ -114,6 +116,7 @@ function Download-Programs {
|
||||
$TEMPDIR = $PREFIX + "_" + $RUNTIME + "-temp"
|
||||
$OUTDIR = $PREFIX + "_" + $RUNTIME + "-dir"
|
||||
|
||||
# Handle gzipped files separately
|
||||
if ($EXT -eq ".gz") {
|
||||
mkdir $TEMPDIR
|
||||
tar -xvf $OUTNAME -C $TEMPDIR
|
||||
@@ -122,13 +125,17 @@ function Download-Programs {
|
||||
Expand-Archive -LiteralPath $OUTNAME -DestinationPath "$TEMPDIR"
|
||||
}
|
||||
|
||||
# Create the proper structure
|
||||
Move-Item -Path "$BUILD_FOLDER/$TEMPDIR/*" -Destination "$BUILD_FOLDER/$OUTDIR"
|
||||
Remove-Item -Path "$TEMPDIR" -Recurse -Force
|
||||
|
||||
if ([System.IO.Directory]::Exists("$OUTDIR/bin")) {
|
||||
Move-Item -Path "$BUILD_FOLDER/$OUTDIR/bin/*" -Destination "$BUILD_FOLDER/$OUTDIR"
|
||||
Remove-Item -Path "$OUTDIR/bin" -Recurse -Force
|
||||
}
|
||||
|
||||
# Remove empty subdirectories
|
||||
$EMPTY = Get-ChildItem $OUTDIR -directory -recurse | Where-Object { (Get-ChildItem $_.fullName).count -eq 0 } | Select-Object -expandproperty FullName
|
||||
$EMPTY | Foreach-Object { Remove-Item $_ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user