Store files in a single variable

This commit is contained in:
Manuel Thalmann 2024-07-23 10:05:46 +02:00
parent 1e55435098
commit 8a445f0f71

View file

@ -20,55 +20,85 @@ begin
set -l editionField "Edition ID" set -l editionField "Edition ID"
set -l wimFile "$dataPath/sources/install.wim" set -l wimFile "$dataPath/sources/install.wim"
set -l intelNetworkArchive "$cacheDir/intelNetwork.zip" set -l files
set -l marvellNetworkArchive "$cacheDir/marvellNetwork.zip"
set -l gitArchive (realpath -m "$cacheDir/git.msi") set -l fileDefinitions \
set -l pwshArchive "$cacheDir/pwsh.zip" drivers/network/intel \
"https://dlcdnets.asus.com/pub/ASUS/mb/04LAN/DRV_LAN_Intel_I211_UWD_TP_W10_64_VER12151841_20190306R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA" \
zip \
. \
\
drivers/network/marvell \
"https://dlcdnets.asus.com/pub/ASUS/mb/04LAN/DRV_LAN_Marvell_TP_TSD_W11_64_V3130_20211118R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA" \
zip \
./x64 \
\
software/git \
"https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/PortableGit-2.41.0-64-bit.7z.exe" \
exe \
. \
\
software/pwsh \
"https://github.com/PowerShell/PowerShell/releases/download/v7.3.7/PowerShell-7.3.7-win-x64.zip" \
zip \
.
for i in (seq 1 4 (count $fileDefinitions))
set -l entry $fileDefinitions[$i.."$(math "$i" + 3)"]
set -l name "$entry[1]"
set -l url "$entry[2]"
set -l type "$entry[3]"
set -l dir "$entry[4]"
set -l downloadPath "$cacheDir/$name.$type"
set -a files \
"$downloadPath" \
"$dir"
mkdir -p (dirname "$downloadPath")
if [ ! -f "$downloadPath" ]
curl -L "$url" -o "$downloadPath"
end
end
set -l intel $files[1..2]
set -l marvell $files[3..4]
set -l git $files[5..6]
set -l pwsh $files[7..8]
mkdir -p "$buildDir"
cp -r "$dir/winfs"/* "$winpeOverlay" cp -r "$dir/winfs"/* "$winpeOverlay"
if [ ! -f "$intelNetworkArchive" ]
curl -L "https://dlcdnets.asus.com/pub/ASUS/mb/04LAN/DRV_LAN_Intel_I211_UWD_TP_W10_64_VER12151841_20190306R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA" -o "$intelNetworkArchive"
end
if [ ! -f "$marvellNetworkArchive" ]
curl -L "https://dlcdnets.asus.com/pub/ASUS/mb/04LAN/DRV_LAN_Marvell_TP_TSD_W11_64_V3130_20211118R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA" -o "$marvellNetworkArchive"
end
if [ ! -f "$gitArchive" ]
curl -L "https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/PortableGit-2.41.0-64-bit.7z.exe" -o "$gitArchive"
end
if [ ! -f "$pwshArchive" ]
curl -L "https://github.com/PowerShell/PowerShell/releases/download/v7.3.7/PowerShell-7.3.7-win-x64.zip" -o "$pwshArchive"
end
mkdir -p "$winpeOverlay/drivers" mkdir -p "$winpeOverlay/drivers"
begin begin
set -l tempDir (mktemp -d) set -l tempDir (mktemp -d)
unzip "$intelNetworkArchive" -d "$tempDir" unzip "$intel[1]" -d "$tempDir"
cp -r "$tempDir" "$winpeOverlay/drivers/IntelNetwork" cp -r "$tempDir/$intel[2]" "$winpeOverlay/drivers/IntelNetwork"
rm -rf "$tempDir" rm -rf "$tempDir"
end end
begin begin
set -l tempDir (mktemp -d) set -l tempDir (mktemp -d)
unzip "$marvellNetworkArchive" -d "$tempDir" unzip "$marvell[1]" -d "$tempDir"
cp -r "$tempDir/x64" "$winpeOverlay/drivers/MarvellNetwork" cp -r "$tempDir/$marvell[2]" "$winpeOverlay/drivers/MarvellNetwork"
rm -rf "$tempDir" rm -rf "$tempDir"
end end
begin begin
set -l dir "$winpeOverlay/git" set -l tempDir (mktemp -d)
mkdir -p "$dir" pushd "$tempDir" > /dev/null
pushd "$dir" > /dev/null 7z x "$git[1]"
7z x "$gitArchive"
popd > /dev/null popd > /dev/null
cp -r "$tempDir/$git[2]" "$winpeOverlay/git"
rm -rf "$tempDir"
end end
unzip "$pwshArchive" -d "$winpeOverlay/PowerShell" begin
set -l tempDir (mktemp -d)
unzip "$pwsh[1]" -d "$tempDir"
cp -r "$tempDir/$pwsh[2]" "$winpeOverlay/PowerShell"
rm -rf "$tempDir"
end
mkdir -p "$(dirname "$isoFile")" mkdir -p "$(dirname "$isoFile")"
sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath" sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath"