1 |
commit: 5d130cc45cd334fd38b0c6874bcc81ac74636217 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Apr 25 17:04:34 2016 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 25 17:04:34 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=5d130cc4 |
7 |
|
8 |
localmount/netmount: allow mount points to be marked critical |
9 |
|
10 |
In previous releases, we either treated no mount points as critical or |
11 |
all of them. |
12 |
|
13 |
Now both localmount and netmount support a critical_mounts setting. If |
14 |
mount points listed in this setting fail to mount, localmount and |
15 |
netmount will fail. |
16 |
|
17 |
conf.d/localmount | 11 ++++++----- |
18 |
conf.d/netmount | 7 +++++++ |
19 |
init.d/localmount.in | 14 +++++++------- |
20 |
init.d/netmount.in | 7 ++++++- |
21 |
4 files changed, 26 insertions(+), 13 deletions(-) |
22 |
|
23 |
diff --git a/conf.d/localmount b/conf.d/localmount |
24 |
index 397e8cd..e727719 100644 |
25 |
--- a/conf.d/localmount |
26 |
+++ b/conf.d/localmount |
27 |
@@ -2,8 +2,9 @@ |
28 |
# This could be useful for some NFS related work. |
29 |
#no_umounts="/dir1:/var/dir2" |
30 |
# |
31 |
-# Ignore errors when mounting local file systems. |
32 |
-# This should be left alone unless you know what you are doing. If it is |
33 |
-# set to yes, not only will we allow mount failures, but we will ignore |
34 |
-# syntax errors in fstab. |
35 |
-#ignore_mount_errors="NO" |
36 |
+# Mark certain mount points as critical. |
37 |
+# This contains aspace separated list of mount points which should be |
38 |
+# considered critical. If one of these mount points cannot be mounted, |
39 |
+# localmount will fail. |
40 |
+# By default, this is empty. |
41 |
+#critical_mounts="/home /var" |
42 |
|
43 |
diff --git a/conf.d/netmount b/conf.d/netmount |
44 |
index 53717fc..e759adf 100644 |
45 |
--- a/conf.d/netmount |
46 |
+++ b/conf.d/netmount |
47 |
@@ -38,3 +38,10 @@ |
48 |
# other words, please change it to be more suited to your system. |
49 |
# |
50 |
rc_need="net" |
51 |
+# |
52 |
+# Mark certain mount points as critical. |
53 |
+# This contains aspace separated list of mount points which should be |
54 |
+# considered critical. If one of these mount points cannot be mounted, |
55 |
+# netmount will fail. |
56 |
+# By default, this is empty. |
57 |
+#critical_mounts="/home /var" |
58 |
|
59 |
diff --git a/init.d/localmount.in b/init.d/localmount.in |
60 |
index cfc841a..96ccc44 100644 |
61 |
--- a/init.d/localmount.in |
62 |
+++ b/init.d/localmount.in |
63 |
@@ -22,7 +22,7 @@ depend() |
64 |
start() |
65 |
{ |
66 |
# Mount local filesystems in /etc/fstab. |
67 |
- local types="noproc" x= no_netdev= rc= |
68 |
+ local critical= types="noproc" x= no_netdev= rc= |
69 |
for x in $net_fs_list $extra_net_fs_list; do |
70 |
types="${types},no${x}" |
71 |
done |
72 |
@@ -37,13 +37,13 @@ start() |
73 |
mount -at "$types" $no_netdev |
74 |
eend $? "Some local filesystem failed to mount" |
75 |
rc=$? |
76 |
- if [ "$RC_UNAME" != Linux ]; then |
77 |
- rc=0 |
78 |
- elif yesno "${ignore_mount_errors:-NO}"; then |
79 |
- if [ $rc -ne 0 ]; then |
80 |
- ewarn "localmount: errors detected, but ignored" |
81 |
- fi |
82 |
+ if [ -z "$critical_mounts" ]; then |
83 |
rc=0 |
84 |
+ else |
85 |
+ for x in ${critical_mounts}; do |
86 |
+ mountinfo -q $x || critical=x |
87 |
+ done |
88 |
+ [-z "$critical" ] && rc=0 |
89 |
fi |
90 |
return $rc |
91 |
} |
92 |
|
93 |
diff --git a/init.d/netmount.in b/init.d/netmount.in |
94 |
index f7237f1..0febde2 100644 |
95 |
--- a/init.d/netmount.in |
96 |
+++ b/init.d/netmount.in |
97 |
@@ -42,8 +42,13 @@ start() |
98 |
rc=$? |
99 |
fi |
100 |
ewend $rc "Could not mount all network filesystems" |
101 |
- if [ "$RC_UNAME" != Linux ]; then |
102 |
+ if [ -z "$critical_mounts" ]; then |
103 |
rc=0 |
104 |
+ else |
105 |
+ for x in ${critical_mounts}; do |
106 |
+ mountinfo -q $x || critical=x |
107 |
+ done |
108 |
+ [-z "$critical" ] && rc=0 |
109 |
fi |
110 |
return $rc |
111 |
} |