mountfs: support /etc/mtab as a symlink to /proc/mounts for smooth systemd transition

This commit is contained in:
Silvan Calarco 2013-03-22 17:56:55 +01:00
parent cf8854f0c5
commit ea1c149ed1

View File

@ -18,15 +18,12 @@ case "$1" in
# Dump dmesg to log file # Dump dmesg to log file
dmesg > /var/log/dmesg.log dmesg > /var/log/dmesg.log
# Clean and recreate /etc/mtab # Check that mtab is a symlink to /proc/mounts
rm -f /etc/mtab # delete in case of symlink [ -L /etc/mtab ] || {
cat /proc/mounts | \ rm -f /etc/mtab # delete if not a symlink
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~~ rm -f /etc/mtab~ /etc/mtab~~
ln -s /proc/mounts /etc/mtab
}
$PLYMOUTH --sysinit $PLYMOUTH --sysinit
@ -45,9 +42,6 @@ case "$1" in
;; ;;
stop) stop)
echo -n "Unmounting all other currently mounted file systems: " 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 # [ -f /proc/bus/usb/devices ] && umount /proc/bus/usb >/dev/null 2>&1
# umount -l /proc # umount -l /proc
# umount -l /sys # umount -l /sys