Create image using an overlayfs
This commit is contained in:
parent
15742f29e1
commit
7e5915cab0
47
deploy.fish
47
deploy.fish
|
@ -14,11 +14,14 @@ begin
|
|||
set -l cacheDir ~/.cache/winiso-valhalla
|
||||
set -l isoFile "$buildDir/win.iso"
|
||||
set -l winPath "/media/win"
|
||||
set -l winpePath "/media/winpe"
|
||||
set -l valhallaPath "/media/winiso-valhalla"
|
||||
set -l bootPath "/media/boot"
|
||||
set -l dataPath "/media/data"
|
||||
set -l winpeOverlay (mktemp -d)
|
||||
set -l winOverlay (mktemp -d)
|
||||
set -l editionField "Edition ID"
|
||||
set -l wimFile "$dataPath/sources/install.wim"
|
||||
set -l wimFile "sources/install.wim"
|
||||
|
||||
set -l files
|
||||
|
||||
|
@ -91,8 +94,26 @@ begin
|
|||
mkdir -p "$(dirname "$isoFile")"
|
||||
sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath"
|
||||
mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$isoFile"
|
||||
sudo umount "$winPath"
|
||||
rm -rf "$winpeOverlay"
|
||||
sudo mount --mkdir "$isoFile" "$winpePath"
|
||||
|
||||
begin
|
||||
echo "$wimFile"
|
||||
end | rsync --files-from=/dev/stdin "$winPath" "$winOverlay"
|
||||
|
||||
begin
|
||||
set -l wimFile "$winOverlay/$wimFile"
|
||||
|
||||
while [ ! (wiminfo "$wimFile" 1 | grep "^$editionField" | cut -d ":" -f2 | string trim) = "Professional" ]
|
||||
sudo wimdelete --soft "$wimFile" 1
|
||||
end
|
||||
|
||||
while wiminfo "$wimFile" 2 &> /dev/null
|
||||
sudo wimdelete --soft "$wimFile" 2
|
||||
end
|
||||
end
|
||||
|
||||
sudo mount --mkdir -t overlay overlay -o lowerdir="$winOverlay":"$winPath" "$valhallaPath"
|
||||
|
||||
if [ ! -b "$WIN_DISK" ]
|
||||
chooseDisk WIN_DISK
|
||||
|
@ -145,18 +166,16 @@ begin
|
|||
sudo cp -r "$winPath"/* "$bootPath"
|
||||
sudo umount "$winPath"
|
||||
|
||||
sudo mount "$WIN11_IMAGE_PATH" "$winPath"
|
||||
sudo cp -r "$winPath"/* "$dataPath"
|
||||
sudo cp -r "$winPath/efi" "$bootPath"
|
||||
sudo cp -r "$valhallaPath"/* "$dataPath"
|
||||
sudo cp -r "$valhallaPath/efi" "$bootPath"
|
||||
|
||||
while [ ! (wiminfo "$wimFile" 1 | grep "^$editionField" | cut -d ":" -f2 | string trim) = "Professional" ]
|
||||
sudo wimdelete --soft "$wimFile" 1
|
||||
end
|
||||
|
||||
while wiminfo "$wimFile" 2 &> /dev/null
|
||||
sudo wimdelete --soft "$wimFile" 2
|
||||
end
|
||||
|
||||
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");"
|
||||
for path in "$valhallaPath" \
|
||||
"$winPath" \
|
||||
"$winpePath" \
|
||||
"$bootPath" \
|
||||
"$dataPath"
|
||||
sudo umount -vf "$path"
|
||||
sudo rm -rf "$path"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue