From ea1c149ed1fc655af154fdca812ff6b832135375 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 22 Mar 2013 17:56:55 +0100 Subject: [PATCH] mountfs: support /etc/mtab as a symlink to /proc/mounts for smooth systemd transition --- etc/rc.d/init.d/mountfs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/etc/rc.d/init.d/mountfs b/etc/rc.d/init.d/mountfs index 391f699..ebd507f 100755 --- a/etc/rc.d/init.d/mountfs +++ b/etc/rc.d/init.d/mountfs @@ -18,15 +18,12 @@ case "$1" in # Dump dmesg to log file dmesg > /var/log/dmesg.log - # Clean and recreate /etc/mtab - rm -f /etc/mtab # delete in case of symlink - cat /proc/mounts | \ - grep -v "^rootfs" | \ - grep -v "^/dev/cloop" | \ - grep -v "^devfs" | \ - grep -v "^sysfs" | \ - grep -v "^/dev/root.old" >/etc/mtab - rm -f /etc/mtab~ /etc/mtab~~ + # Check that mtab is a symlink to /proc/mounts + [ -L /etc/mtab ] || { + rm -f /etc/mtab # delete if not a symlink + rm -f /etc/mtab~ /etc/mtab~~ + ln -s /proc/mounts /etc/mtab + } $PLYMOUTH --sysinit @@ -45,9 +42,6 @@ case "$1" in ;; stop) echo -n "Unmounting all other currently mounted file systems: " - # remove data= in /etc/mtab to prevent problems when system reboots with different mode - # (as with kernel 2.6.30 upgrade) - sed -i "s|[,]*data=[a-z]*||" /etc/mtab # [ -f /proc/bus/usb/devices ] && umount /proc/bus/usb >/dev/null 2>&1 # umount -l /proc # umount -l /sys