1 |
commit: 497ff7ee41168d863971efb52e2ca6b42f765832 |
2 |
Author: Piotr Karbowski <piotr.karbowski <AT> gmail <DOT> com> |
3 |
AuthorDate: Fri Feb 3 20:17:18 2012 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 9 07:27:56 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=497ff7ee |
7 |
|
8 |
Remount already mounted filesystems. |
9 |
|
10 |
This was modified by William Hubbs to use the checkpath helper and to |
11 |
improve readability. |
12 |
|
13 |
Signed-off-by: William Hubbs <williamh <AT> gentoo.org> |
14 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
15 |
(tested with genkernel /usr mount changes); |
16 |
|
17 |
--- |
18 |
init.d/root.in | 48 ++++++++++++++++++++++++++++++++++-------------- |
19 |
1 files changed, 34 insertions(+), 14 deletions(-) |
20 |
|
21 |
diff --git a/init.d/root.in b/init.d/root.in |
22 |
index 1c93771..4d63919 100644 |
23 |
--- a/init.d/root.in |
24 |
+++ b/init.d/root.in |
25 |
@@ -13,20 +13,40 @@ depend() |
26 |
start() |
27 |
{ |
28 |
case ",$(fstabinfo -o /)," in |
29 |
- *,ro,*) return 0;; |
30 |
+ *,ro,*) |
31 |
+ ;; |
32 |
+ *) |
33 |
+ # Check if the rootfs isn't already writable. |
34 |
+ if checkpath -W /; then |
35 |
+ rm -f /fastboot /forcefsck |
36 |
+ else |
37 |
+ ebegin "Remounting root filesystem read/write" |
38 |
+ case "$RC_UNAME" in |
39 |
+ Linux) |
40 |
+ mount -n -o remount,rw / |
41 |
+ ;; |
42 |
+ *) |
43 |
+ mount -u -o rw / |
44 |
+ ;; |
45 |
+ esac |
46 |
+ eend $? "Root filesystem could not be mounted read/write" |
47 |
+ if [ $? -eq 0 ]; then |
48 |
+ rm -f /fastboot /forcefsck |
49 |
+ fi |
50 |
+ fi |
51 |
+ ;; |
52 |
esac |
53 |
|
54 |
- if echo 2>/dev/null >/.test.$$; then |
55 |
- rm -f /.test.$$ /fastboot /forcefsck |
56 |
- return 0 |
57 |
- fi |
58 |
- |
59 |
- ebegin "Remounting root filesystem read/write" |
60 |
- case "$RC_UNAME" in |
61 |
- Linux) mount -n -o remount,rw /;; |
62 |
- *) mount -u -o rw /;; |
63 |
- esac |
64 |
- if eend $? "Root filesystem could not be mounted read/write"; then |
65 |
- rm -f /fastboot /forcefsck |
66 |
- fi |
67 |
+ ebegin "Remounting filesystems" |
68 |
+ local mountpoint |
69 |
+ for mountpoint in $(fstabinfo); do |
70 |
+ case "${mountpoint}" in |
71 |
+ /) |
72 |
+ ;; |
73 |
+ /*) |
74 |
+ mountinfo -q "${mountpoint}" && fstabinfo --remount "${mountpoint}" |
75 |
+ ;; |
76 |
+ esac |
77 |
+ done |
78 |
+ eend 0 |
79 |
} |