Rename confusing variables

This commit is contained in:
Manuel Thalmann 2024-07-22 21:24:16 +02:00
parent d56482fbdd
commit 78128558c9

View file

@ -7,10 +7,10 @@ begin
set -l buildDir "$(status dirname)/build" set -l buildDir "$(status dirname)/build"
set -l cacheDir ~/.cache/winiso-valhalla set -l cacheDir ~/.cache/winiso-valhalla
set -l isoFile "$buildDir/win.iso" set -l isoFile "$buildDir/win.iso"
set -l mountPath "/media/wininstall" set -l winPath "/media/wininstall"
set -l bootPath "/media/boot" set -l bootPath "/media/boot"
set -l dataPath "/media/data" set -l dataPath "/media/data"
set -l overlayDir (mktemp -d) set -l winpeOverlay (mktemp -d)
set -q WIN11_IMAGE_PATH set -q WIN11_IMAGE_PATH
or begin or begin
@ -19,7 +19,7 @@ begin
end end
set -l dir (status dirname) set -l dir (status dirname)
set -l overlayDir (mktemp -d) set -l winpeOverlay (mktemp -d)
set -l editionField "Edition ID" set -l editionField "Edition ID"
set -l wimFile "$dataPath/sources/install.wim" set -l wimFile "$dataPath/sources/install.wim"
@ -29,7 +29,7 @@ begin
set -l pwshArchive "$cacheDir/pwsh.zip" set -l pwshArchive "$cacheDir/pwsh.zip"
mkdir -p "$buildDir" mkdir -p "$buildDir"
cp -r "$dir/winfs"/* "$overlayDir" cp -r "$dir/winfs"/* "$winpeOverlay"
if [ ! -f "$intelNetworkArchive" ] 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" 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"
@ -47,37 +47,37 @@ begin
curl -L "https://github.com/PowerShell/PowerShell/releases/download/v7.3.7/PowerShell-7.3.7-win-x64.zip" -o "$pwshArchive" curl -L "https://github.com/PowerShell/PowerShell/releases/download/v7.3.7/PowerShell-7.3.7-win-x64.zip" -o "$pwshArchive"
end end
mkdir -p "$overlayDir/drivers" mkdir -p "$winpeOverlay/drivers"
begin begin
set -l tempDir (mktemp -d) set -l tempDir (mktemp -d)
unzip "$intelNetworkArchive" -d "$tempDir" unzip "$intelNetworkArchive" -d "$tempDir"
cp -r "$tempDir" "$overlayDir/drivers/IntelNetwork" cp -r "$tempDir" "$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 "$marvellNetworkArchive" -d "$tempDir"
cp -r "$tempDir/x64" "$overlayDir/drivers/MarvellNetwork" cp -r "$tempDir/x64" "$winpeOverlay/drivers/MarvellNetwork"
rm -rf "$tempDir" rm -rf "$tempDir"
end end
begin begin
set -l dir "$overlayDir/git" set -l dir "$winpeOverlay/git"
mkdir -p "$dir" mkdir -p "$dir"
pushd "$dir" > /dev/null pushd "$dir" > /dev/null
7z x "$gitArchive" 7z x "$gitArchive"
popd > /dev/null popd > /dev/null
end end
unzip "$pwshArchive" -d "$overlayDir/PowerShell" unzip "$pwshArchive" -d "$winpeOverlay/PowerShell"
mkdir -p "$(dirname "$isoFile")" mkdir -p "$(dirname "$isoFile")"
sudo mount --mkdir "$WIN11_IMAGE_PATH" "$mountPath" sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath"
mkwinpeimg --iso --arch amd64 --overlay "$overlayDir" --windows-dir "$mountPath" "$isoFile" mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$isoFile"
sudo umount "$mountPath" sudo umount "$winPath"
rm -rf "$overlayDir" rm -rf "$winpeOverlay"
if [ ! -b "$WIN_DISK" ] if [ ! -b "$WIN_DISK" ]
chooseDisk WIN_DISK chooseDisk WIN_DISK
@ -126,13 +126,13 @@ begin
sudo mkfs.ntfs -fFL "$setupLabel" "$dataDisk" sudo mkfs.ntfs -fFL "$setupLabel" "$dataDisk"
sudo mount --mkdir "$bootDisk" "$bootPath" sudo mount --mkdir "$bootDisk" "$bootPath"
sudo mount --mkdir "$dataDisk" "$dataPath" sudo mount --mkdir "$dataDisk" "$dataPath"
sudo mount --mkdir "$isoFile" "$mountPath" sudo mount --mkdir "$isoFile" "$winPath"
sudo cp -r "$mountPath"/* "$bootPath" sudo cp -r "$winPath"/* "$bootPath"
sudo umount "$mountPath" sudo umount "$winPath"
sudo mount "$WIN11_IMAGE_PATH" "$mountPath" sudo mount "$WIN11_IMAGE_PATH" "$winPath"
sudo cp -r "$mountPath"/* "$dataPath" sudo cp -r "$winPath"/* "$dataPath"
sudo cp -r "$mountPath/efi" "$bootPath" sudo cp -r "$winPath/efi" "$bootPath"
while [ ! (wiminfo "$wimFile" 1 | grep "^$editionField" | cut -d ":" -f2 | string trim) = "Professional" ] while [ ! (wiminfo "$wimFile" 1 | grep "^$editionField" | cut -d ":" -f2 | string trim) = "Professional" ]
sudo wimdelete --soft "$wimFile" 1 sudo wimdelete --soft "$wimFile" 1
@ -142,6 +142,6 @@ begin
sudo wimdelete --soft "$wimFile" 2 sudo wimdelete --soft "$wimFile" 2
end end
sudo -- bash -c "umount -vf $(string escape "$mountPath"); umount -vf $(string escape "$bootPath"); umount -vf $(string escape "$dataPath"); rm -rf $(string escape "$mountPath") $(string escape "$dataPath");" sudo -- bash -c "umount -vf $(string escape "$winPath"); umount -vf $(string escape "$bootPath"); umount -vf $(string escape "$dataPath"); rm -rf $(string escape "$winPath") $(string escape "$dataPath");"
end end
end end