3
0
Fork 0
forked from mirrors/nixpkgs

* Prevent repeated mounting.

svn path=/nixos/trunk/; revision=7882
This commit is contained in:
Eelco Dolstra 2007-02-08 15:24:13 +00:00
parent 2f6810d4af
commit 56576e7c28

View file

@ -53,6 +53,16 @@ script
continue
fi
# !!! quick hack: if mount point already exists, try a
# remount to change the options but nothing else.
if cat /proc/mounts | grep -F -q \" $mountPoint \"; then
echo \"remounting $device on $mountPoint\"
${utillinux}/bin/mount -t \"$fsType\" \\
-o remount,\"$options\" \\
\"$device\" \"$mountPoint\" || true
continue
fi
# If $device is already mounted somewhere else, unmount it first.
# !!! Note: we use /etc/mtab, not /proc/mounts, because mtab
# contains more accurate info when using loop devices.
@ -69,11 +79,11 @@ script
)
if test \"$prevMountPoint\" = \"$mountPoint\"; then
echo \"remounting $device on $mountPoint\"
${utillinux}/bin/mount -t \"$fsType\" \\
-o remount,\"$options\" \\
\"$device\" \"$mountPoint\" || true
continue
echo \"remounting $device on $mountPoint\"
${utillinux}/bin/mount -t \"$fsType\" \\
-o remount,\"$options\" \\
\"$device\" \"$mountPoint\" || true
continue
fi
if test -n \"$prevMountPoint\"; then