Skip to content

Commit

Permalink
Merge pull request #624 from xcp-ng/remaster-error-handling
Browse files Browse the repository at this point in the history
iso-remaster: on error, only attempt unmount mounted stuff
  • Loading branch information
stormi authored Sep 27, 2023
2 parents 342cee5 + dc45d00 commit e553289
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/iso-remaster/iso-remaster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ umountrm() {
rmdir "$1"
}

USERMOUNTS=()
exitcleanup() {
set +e
case $OPMODE in
copy)
rm -rf "$RWISO"
;;
fuse)
umountrm "$MNT"
umountrm "$RWISO"
for MOUNT in "${USERMOUNTS[@]}"; do
umountrm "$MOUNT"
done
rm -rf "$OVLRW" "$OVLWD"
;;
*)
Expand Down Expand Up @@ -155,6 +157,7 @@ fuse)
OVLRW=$(mktemp -d ovlfs-upper.XXXXXX)
OVLWD=$(mktemp -d ovlfs-work.XXXXXX)
fuseiso "$INISO" "$MNT"
MOUNTS+=("$MNT")

# genisoimage apparently needs write access to those
mkdir -p "$OVLRW/boot/isolinux"
Expand Down Expand Up @@ -190,6 +193,7 @@ copy)
fuse)
# produce a merged iso tree
fuse-overlayfs -o lowerdir="$MNT" -o upperdir="$OVLRW" -o workdir="$OVLWD" "$RWISO"
MOUNTS+=("$RWISO")
;;
*)
die "unknown mode '$OPMODE'"
Expand Down

0 comments on commit e553289

Please sign in to comment.