diff --git a/winiso/deploy.fish b/winiso/deploy.fish index e6a628c9..d583655e 100644 --- a/winiso/deploy.fish +++ b/winiso/deploy.fish @@ -26,6 +26,17 @@ begin set -l editionField "Edition ID" set -l wimFile "sources/install.wim" + set -l tempPaths \ + "$winpeOverlay" \ + "$winOverlay" \ + "$upperDir" \ + "$workDir" + + set -l mountPaths \ + "$valhallaPath" \ + "$winPath" \ + "$winpePath" + set -l files set -l fileDefinitions \ @@ -129,7 +140,6 @@ begin mkdir -p "$(dirname "$winpe")" sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath" mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$winpe" - rm -rf "$winpeOverlay" sudo mount --mkdir "$winpe" "$winpePath" begin @@ -164,6 +174,11 @@ begin -output "$isoFile" \ "$valhallaPath" else + set -a mountPaths \ + "$bootPath" \ + "$dataPath" + + if [ ! -b "$WIN_DISK" ] chooseDisk WIN_DISK end @@ -215,15 +230,14 @@ begin sudo cp -r "$valhallaPath"/* "$dataPath" sudo cp -r "$valhallaPath/efi" "$bootPath" - - for path in "$valhallaPath" \ - "$winPath" \ - "$winpePath" \ - "$bootPath" \ - "$dataPath" - sudo umount -vf "$path" - sudo rm -rf "$path" - end end end + + for path in $mountPaths + sudo umount -vf "$path" + end + + for path in $mountPaths $tempPaths + sudo rm -rf "$path" + end end