Skip to content

Commit

Permalink
Unmount MNTPNT before escaping quotes/backslashes
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jandubois authored and AkihiroSuda committed Mar 12, 2024
1 parent 2e9b83a commit c02b0f7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ for DIR in ${DATADIRS}; do
[ "${MNTTYPE}" = "ext4" ] && continue
[ "${MNTTYPE}" = "tmpfs" ] && continue
MNTOPTS="$(echo "${LINE}" | awk '{print $4}')"
MNTPNT=${MNTPNT//\\/\\\\}
MNTPNT=${MNTPNT//\"/\\\"}
echo "mount -t \"${MNTTYPE}\" -o \"${MNTOPTS}\" \"${MNTDEV}\" \"${MNTPNT}\"" >>/mnt.sh
# Before mv, unmount filesystems (virtiofs, 9p, etc.) below "${DIR}", otherwise host mounts will be wiped out
# https://github.com/rancher-sandbox/rancher-desktop/issues/6582
umount "${MNTPNT}" || exit 1
MNTPNT=${MNTPNT//\\/\\\\}
MNTPNT=${MNTPNT//\"/\\\"}
echo "mount -t \"${MNTTYPE}\" -o \"${MNTOPTS}\" \"${MNTDEV}\" \"${MNTPNT}\"" >>/mnt.sh
done </proc/mounts
done
chmod +x /mnt.sh
Expand Down

0 comments on commit c02b0f7

Please sign in to comment.