Ensure to always remove all leftovers
This commit is contained in:
parent
a7a7de7b1a
commit
5904f56d11
1 changed files with 24 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue