On Sun, Apr 3, 2011 at 3:35 PM, Tom Gundersen <teg@jklm.no> wrote:
On Sun, Apr 3, 2011 at 4:01 PM, Seblu <seblu@seblu.net> wrote:
On Wed, Mar 30, 2011 at 8:01 PM, Tom Gundersen <teg@jklm.no> wrote:
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.
Signed-off-by: Tom Gundersen <teg@jklm.no> --- rc.sysinit | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/rc.sysinit b/rc.sysinit index 69fdab3..1601e7a 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 - /bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab -else - cat /proc/mounts >| /etc/mtab + +# don't touch /etc/mtab if it is a symlink to /proc/self/mounts +if [ ! -L /etc/mtab ]; then + if [ -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 fi + run_hook sysinit_premount # now mount all the local filesystems /bin/mount -a -t $NETFS -O no_netdev -- 1.7.4.2
Maybe you should use bash style with [[.
Something like the follwing looks better
if [[ -L /etc/mtab ]]; then : elif [[ -x /bin/findmnt && -e /proc/self/mountinfo ]]; then /bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS >| /etc/mtab else cat /proc/mounts >| /etc/mtab fi
Thanks, I'll change before I push.
-t
Hey tom, you make a mistake copying my suggestion in commit 71a1b74eb778540d412705b09a24f1d2ba123a2b it's if [[ -L /etc/mtab ]]; then : not if [[ -L /etc/mtab ]]; then ; because the second cause a syntax error :/ : is like true is bash. So current upstream is broken :/ :: Mounting Local Filesystems [BUSY] EXT4-fs (sda2): re-mounted. Opts: (null) /etc/rc.sysinit: line 278: syntax error near unexpected token `;' /etc/rc.sysinit: line 278: ` ;' INIT: Entering runlevel: 3 Regards, -- Sébastien Luttringer www.seblu.net