summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-07-09 16:08:38 +0000
committerRoy Marples <roy@marples.name>2008-07-09 16:08:38 +0000
commitb83108cd2e44bd20840295d595160c6354ed4256 (patch)
tree88ec97455ead28fc668da95098849b01d1b299a4 /init.d
parent1ca63447c9a65e595534cafb7a4d497edf7fa92b (diff)
downloadopenrc-b83108cd2e44bd20840295d595160c6354ed4256.tar.gz
openrc-b83108cd2e44bd20840295d595160c6354ed4256.tar.bz2
openrc-b83108cd2e44bd20840295d595160c6354ed4256.tar.xz
Add a knob to avoid the unmounting of some points.
Diffstat (limited to 'init.d')
-rw-r--r--init.d/halt.sh.in16
-rw-r--r--init.d/localmount.in10
2 files changed, 20 insertions, 6 deletions
diff --git a/init.d/halt.sh.in b/init.d/halt.sh.in
index 7b6f55c..8431b1c 100644
--- a/init.d/halt.sh.in
+++ b/init.d/halt.sh.in
@@ -4,6 +4,7 @@
. @SYSCONFDIR@/init.d/functions.sh
. "${RC_LIBDIR}"/sh/rc-functions.sh
+[ -r @SYSCONFDIR@/conf.d/localmount ] && . @SYSCONFDIR@/conf.d/localmount
[ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
# Support LiveCD foo
@@ -79,6 +80,20 @@ if [ "${RC_UNAME}" = "Linux" ]; then
# We need the do_unmount function
. "${RC_LIBDIR}"/sh/rc-mount.sh
eindent
+ no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
+ # RC_NO_UMOUNTS is an env var that can be set by plugins
+ OIFS=${IFS} SIFS=${IFS-y}
+ IFS=$IFS:
+ for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
+ no_umounts_r="${no_umounts_r}|${x}"
+ done
+ if [ "${SIFS}" = "y" ]; then
+ IFS=$OIFS
+ else
+ unset IFS
+ fi
+ no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
+ no_umounts_r="^(${no_umounts})$"
fs=
for x in ${net_fs_list}; do
fs="${fs}${fs:+|}${x}"
@@ -86,7 +101,6 @@ if [ "${RC_UNAME}" = "Linux" ]; then
[ -n "${fs}" ] && fs="^(${fs})$"
do_unmount "mount -n -o remount,ro" \
--skip-point-regex "^(/dev|/dev/.*|/proc|/proc/.*|/sys|/sys/.*)$" \
- --skip-options-regex "^ro" \
${fs:+--skip-fstype-regex} ${fs} --nonetdev
eoutdent
eend $?
diff --git a/init.d/localmount.in b/init.d/localmount.in
index 48c76b7..bcd39e7 100644
--- a/init.d/localmount.in
+++ b/init.d/localmount.in
@@ -30,13 +30,13 @@ start()
stop()
{
# We never unmount / or /dev or $RC_SVCDIR
- local x= no_umounts="/|/dev|/dev/.*|${RC_SVCDIR}"
+ local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
# RC_NO_UMOUNTS is an env var that can be set by plugins
OIFS=${IFS} SIFS=${IFS-y}
IFS=$IFS:
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
- no_umounts="${no_umounts}|${x}"
+ no_umounts_r="${no_umounts_r}|${x}"
done
if [ "${SIFS}" = "y" ]; then
IFS=$OIFS
@@ -45,9 +45,9 @@ stop()
fi
if [ "${RC_UNAME}" = "Linux" ]; then
- no_umounts="${no_umounts}|/proc|/proc/.*|/sys|/sys/.*"
+ no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
fi
- no_umounts="^(${no_umounts})$"
+ no_umounts_r="^(${no_umounts})$"
# Flush all pending disk writes now
sync; sync
@@ -63,7 +63,7 @@ stop()
# Umount loopback devices
einfo "Unmounting loopback devices"
eindent
- do_unmount "umount -d" --skip-point-regex "${no_umounts}" \
+ do_unmount "umount -d" --skip-point-regex "${no_umounts_r}" \
--node-regex "^/dev/loop"
eoutdent