Skip to content

Commit e553289

Browse files
authored
Merge pull request #624 from xcp-ng/remaster-error-handling
iso-remaster: on error, only attempt unmount mounted stuff
2 parents 342cee5 + dc45d00 commit e553289

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/iso-remaster/iso-remaster.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,17 @@ umountrm() {
105105
rmdir "$1"
106106
}
107107

108+
USERMOUNTS=()
108109
exitcleanup() {
109110
set +e
110111
case $OPMODE in
111112
copy)
112113
rm -rf "$RWISO"
113114
;;
114115
fuse)
115-
umountrm "$MNT"
116-
umountrm "$RWISO"
116+
for MOUNT in "${USERMOUNTS[@]}"; do
117+
umountrm "$MOUNT"
118+
done
117119
rm -rf "$OVLRW" "$OVLWD"
118120
;;
119121
*)
@@ -155,6 +157,7 @@ fuse)
155157
OVLRW=$(mktemp -d ovlfs-upper.XXXXXX)
156158
OVLWD=$(mktemp -d ovlfs-work.XXXXXX)
157159
fuseiso "$INISO" "$MNT"
160+
MOUNTS+=("$MNT")
158161

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

0 commit comments

Comments
 (0)