1 |
commit: 6fa0d6318bcd5c98548cff2ff840bca116892ca5 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Oct 7 16:35:31 2015 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 7 16:35:31 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6fa0d631 |
7 |
|
8 |
mtab: fix update logic |
9 |
|
10 |
This advises users to remove mtab from their runlevels if /etc/mtab is a |
11 |
symlink, and it creates the symlink if /etc/mtab does not exist on a |
12 |
system. |
13 |
|
14 |
X-Gentoo-Bug: 560060 |
15 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=560060 |
16 |
|
17 |
init.d/mtab.in | 15 ++++++--------- |
18 |
1 file changed, 6 insertions(+), 9 deletions(-) |
19 |
|
20 |
diff --git a/init.d/mtab.in b/init.d/mtab.in |
21 |
index 51575b4..1442ffd 100644 |
22 |
--- a/init.d/mtab.in |
23 |
+++ b/init.d/mtab.in |
24 |
@@ -12,21 +12,18 @@ depend() |
25 |
|
26 |
start() |
27 |
{ |
28 |
- [ -L /etc/mtab ] && return 0 |
29 |
local rc=0 |
30 |
ebegin "Updating /etc/mtab" |
31 |
- if ! checkpath -W /etc; then |
32 |
+ if [ -L /etc/mtab ] ; then |
33 |
+ ewarn "/etc/mtab is a symlink, not updating." |
34 |
+ ewarn "FYI - You can safely remove mtab from your runlevels." |
35 |
+ elif ! checkpath -W /etc; then |
36 |
rc=1 |
37 |
elif [ ! -e /etc/mtab ]; then |
38 |
+ einfo "Creating mtab symlink" |
39 |
ln -snf /proc/self/mounts /etc/mtab |
40 |
else |
41 |
- ewarn "The support for updating /etc/mtab as a file is" |
42 |
- ewarn "deprecated and will be removed in the future." |
43 |
- ewarn "Please run the following command as root on your system." |
44 |
- ewarn |
45 |
- ewarn "ln -snf /proc/self/mounts /etc/mtab" |
46 |
- ewarn |
47 |
- |
48 |
+ einfo "Updating mtab file" |
49 |
# With / as tmpfs we cannot umount -at tmpfs in localmount as that |
50 |
# makes / readonly and dismounts all tmpfs even if in use which is |
51 |
# not good. Luckily, umount uses /etc/mtab instead of /proc/mounts |