summaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2011-02-24 15:31:25 +0100
committerTom Gundersen <teg@jklm.no>2011-04-04 03:07:32 +0800
commit71a1b74eb778540d412705b09a24f1d2ba123a2b (patch)
tree4e69632b52f6599bf37083b65b97d78533f11b4a /rc.sysinit
parentcb6da84bfc2aaf23233cdaf2fcefe886c5961390 (diff)
mtab: don't write to mtab if it is a symlink
In the future /etc/mtab should be a symlink to /proc/self/mounts, add support for this in rc.sysinit to be prepared. While strictly not needed, this makes it clear that the functionality can be removed once we move over to using symlinks. This functionality is expected with the next release of util-linux (2.20), but is already available in the current version if the experimental libmount support is enabled. v2: simplified after suggestion from Seblu. Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit7
1 files changed, 6 insertions, 1 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 6ed8e1a..9973c25 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -279,11 +279,16 @@ fi
stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
-if [ -x /bin/findmnt -a -e /proc/self/mountinfo ]; then
+
+# don't touch /etc/mtab if it is a symlink to /proc/self/mounts
+if [[ -L /etc/mtab ]]; then
+ ;
+elif [[ -x /bin/findmnt -a -e /proc/self/mountinfo ]]; then
/bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab
else
cat /proc/mounts >| /etc/mtab
fi
+
run_hook sysinit_premount
# now mount all the local filesystems
/bin/mount -a -t $NETFS -O no_netdev