Skip to content

Commit c02b0f7

Browse files
janduboisAkihiroSuda
authored andcommitted
Unmount MNTPNT before escaping quotes/backslashes
The escaping is needed to print the string with quotes, but would break the umount command. Signed-off-by: Jan Dubois <[email protected]> (cherry picked from commit a782327) Signed-off-by: Akihiro Suda <[email protected]>
1 parent 2e9b83a commit c02b0f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cidata/cidata.TEMPLATE.d/boot/04-persistent-data-volume.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ for DIR in ${DATADIRS}; do
2929
[ "${MNTTYPE}" = "ext4" ] && continue
3030
[ "${MNTTYPE}" = "tmpfs" ] && continue
3131
MNTOPTS="$(echo "${LINE}" | awk '{print $4}')"
32-
MNTPNT=${MNTPNT//\\/\\\\}
33-
MNTPNT=${MNTPNT//\"/\\\"}
34-
echo "mount -t \"${MNTTYPE}\" -o \"${MNTOPTS}\" \"${MNTDEV}\" \"${MNTPNT}\"" >>/mnt.sh
3532
# Before mv, unmount filesystems (virtiofs, 9p, etc.) below "${DIR}", otherwise host mounts will be wiped out
3633
# https://github.com/rancher-sandbox/rancher-desktop/issues/6582
3734
umount "${MNTPNT}" || exit 1
35+
MNTPNT=${MNTPNT//\\/\\\\}
36+
MNTPNT=${MNTPNT//\"/\\\"}
37+
echo "mount -t \"${MNTTYPE}\" -o \"${MNTOPTS}\" \"${MNTDEV}\" \"${MNTPNT}\"" >>/mnt.sh
3838
done </proc/mounts
3939
done
4040
chmod +x /mnt.sh

0 commit comments

Comments
 (0)