fix: Check if file is writeable

This commit is contained in:
Kroese 2024-04-22 12:46:46 +02:00 committed by GitHub
parent 566ea4cb61
commit 2f8c4e38a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -257,10 +257,12 @@ finishInstall() {
local iso="$1" local iso="$1"
local aborted="$2" local aborted="$2"
if [ -w "$iso" ]; then
# Mark ISO as prepared via magic byte # Mark ISO as prepared via magic byte
if ! printf '\x16' | dd of="$iso" bs=1 seek=0 count=1 conv=notrunc status=none; then if ! printf '\x16' | dd of="$iso" bs=1 seek=0 count=1 conv=notrunc status=none; then
error "Failed to set magic byte!" error "Failed to set magic byte!"
fi fi
fi
rm -f "$STORAGE/windows.boot" rm -f "$STORAGE/windows.boot"
cp /run/version "$STORAGE/windows.ver" cp /run/version "$STORAGE/windows.ver"
@ -1170,7 +1172,9 @@ if ! updateImage "$ISO" "$DIR" "$XML"; then
return 0 return 0
fi fi
if ! rm -f "$ISO" 2> /dev/null; then if [ -w "$ISO" ]; then
rm -f "$ISO"
else
BASE="windows.iso" BASE="windows.iso"
ISO="$STORAGE/$BASE" ISO="$STORAGE/$BASE"
rm -f "$ISO" rm -f "$ISO"