mtab: fix update logic
This advises users to remove mtab from their runlevels if /etc/mtab is a symlink, and it creates the symlink if /etc/mtab does not exist on a system. X-Gentoo-Bug: 560060 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=560060
This commit is contained in:
parent
80d3928b0d
commit
6fa0d6318b
@ -12,21 +12,18 @@ depend()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
[ -L /etc/mtab ] && return 0
|
|
||||||
local rc=0
|
local rc=0
|
||||||
ebegin "Updating /etc/mtab"
|
ebegin "Updating /etc/mtab"
|
||||||
if ! checkpath -W /etc; then
|
if [ -L /etc/mtab ] ; then
|
||||||
|
ewarn "/etc/mtab is a symlink, not updating."
|
||||||
|
ewarn "FYI - You can safely remove mtab from your runlevels."
|
||||||
|
elif ! checkpath -W /etc; then
|
||||||
rc=1
|
rc=1
|
||||||
elif [ ! -e /etc/mtab ]; then
|
elif [ ! -e /etc/mtab ]; then
|
||||||
|
einfo "Creating mtab symlink"
|
||||||
ln -snf /proc/self/mounts /etc/mtab
|
ln -snf /proc/self/mounts /etc/mtab
|
||||||
else
|
else
|
||||||
ewarn "The support for updating /etc/mtab as a file is"
|
einfo "Updating mtab file"
|
||||||
ewarn "deprecated and will be removed in the future."
|
|
||||||
ewarn "Please run the following command as root on your system."
|
|
||||||
ewarn
|
|
||||||
ewarn "ln -snf /proc/self/mounts /etc/mtab"
|
|
||||||
ewarn
|
|
||||||
|
|
||||||
# With / as tmpfs we cannot umount -at tmpfs in localmount as that
|
# With / as tmpfs we cannot umount -at tmpfs in localmount as that
|
||||||
# makes / readonly and dismounts all tmpfs even if in use which is
|
# makes / readonly and dismounts all tmpfs even if in use which is
|
||||||
# not good. Luckily, umount uses /etc/mtab instead of /proc/mounts
|
# not good. Luckily, umount uses /etc/mtab instead of /proc/mounts
|
||||||
|
Loading…
Reference in New Issue
Block a user