summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-09 15:33:05 +0000
committerRoy Marples <roy@marples.name>2007-10-09 15:33:05 +0000
commitdc0ba7ebf3109b2bbdd73c5f0a411ba6129c2daf (patch)
tree2786be756e7ab35af0802eeea2f79820b2f4e7ff /init.d
parente89805e0c06792c58c19e47f99ab6379d69a2149 (diff)
downloadopenrc-dc0ba7ebf3109b2bbdd73c5f0a411ba6129c2daf.tar.gz
openrc-dc0ba7ebf3109b2bbdd73c5f0a411ba6129c2daf.tar.bz2
openrc-dc0ba7ebf3109b2bbdd73c5f0a411ba6129c2daf.tar.xz
netmount, localmount, halt.sh and net scripts now check OS specific flags to see if a mount is network mounted (linux = fstab, *bsd = "local" in mount options) or not, #192772.
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/halt.sh4
-rwxr-xr-xinit.d/localmount6
-rwxr-xr-xinit.d/netmount40
3 files changed, 27 insertions, 23 deletions
diff --git a/init.d/halt.sh b/init.d/halt.sh
index f02c133..f94f4d2 100755
--- a/init.d/halt.sh
+++ b/init.d/halt.sh
@@ -72,7 +72,9 @@ if [ "${RC_UNAME}" = "Linux" ] ; then
fs="${fs}${fs:+|}${x}"
done
[ -n "${fs}" ] && fs="^(${fs})$"
- do_unmount "mount -n -o remount,ro" "^(/dev|/dev/.*|/proc|/proc/.*|/sys|/sys/.*)$" "" "" "${fs}"
+ do_unmount "mount -n -o remount,ro" \
+ --skip-point-regex "^(/dev|/dev/.*|/proc|/proc/.*|/sys|/sys/.*)$" \
+ ${fs:+--skip-fstype-regex} ${fs} --nonetdev
eoutdent
eend $?
unmounted=$?
diff --git a/init.d/localmount b/init.d/localmount
index 4b82026..001338c 100755
--- a/init.d/localmount
+++ b/init.d/localmount
@@ -203,7 +203,8 @@ stop() {
# Umount loopback devices
einfo "Unmounting loopback devices"
eindent
- do_unmount "umount -d" "${no_umounts}" "^/dev/loop"
+ do_unmount "umount -d" --skip-point-regex "${no_umounts}" \
+ --node-regex "^/dev/loop"
eoutdent
# Now everything else, except network filesystems as the
@@ -215,7 +216,8 @@ stop() {
fs="${fs}${fs:+|}${x}"
done
[ -n "${fs}" ] && fs="^(${fs})$"
- do_unmount "umount" "${no_umounts}" "" "" "${fs}"
+ do_unmount "umount" --skip-point-regex "${no_umounts}" \
+ ${fs:+--skip-fstype-regex} ${fs} --nonetdev
eoutdent
return 0
diff --git a/init.d/netmount b/init.d/netmount
index 7ead6d9..e4885a7 100755
--- a/init.d/netmount
+++ b/init.d/netmount
@@ -21,7 +21,7 @@ depend() {
# Only have portmap as a dependency if there is a nfs mount in fstab that
# is set to mount at boot
local pmap=""
- if need_portmap ; then
+ if need_portmap; then
[ -x /etc/init.d/rpcbind ] \
&& pmap="rpcbind" \
|| pmap="portmap"
@@ -37,7 +37,7 @@ start() {
[ -x /etc/init.d/rpcbind ] && pmap="rpcbind"
local x= fs=
- for x in ${RC_NET_FS_LIST} ; do
+ for x in ${RC_NET_FS_LIST}; do
case "${x}" in
nfs|nfs4)
# If the nfsmount script took care of the nfs filesystems,
@@ -47,7 +47,7 @@ start() {
# Only try to mount NFS filesystems if portmap was started.
# This is to fix "hang" problems for new users who do not
# add portmap to the default runlevel.
- if need_portmap && ! service_started "${pmap}" ; then
+ if need_portmap && ! service_started "${pmap}"; then
continue
fi
;;
@@ -63,28 +63,28 @@ start() {
stop() {
local x= fs=
- for x in ${RC_NET_FS_LIST} ; do
- fs="${fs}${fs:+,}${x}"
- done
ebegin "Unmounting network filesystems"
- umount -at ${fs}
- local retval=$?
- eend ${retval} "Failed to simply unmount filesystems"
+ . "${RC_LIBDIR}/sh/rc-mount.sh"
- if [ ${retval} -ne 0 ] ; then
- . "${RC_LIBDIR}/sh/rc-mount.sh"
- eindent
- fs=
- for x in ${RC_NET_FS_LIST} ; do
- fs="${fs:+|}${x}"
- done
- do_unmount "umount" "" "" "^(${fs})$"
- retval=$?
- eoutdent
+ for x in ${RC_NET_FS_LIST} ; do
+ fs="${fs}${fs:+,}${x}"
+ done
+ if [ -n "${fs}" ]; then
+ umount -at ${fs} || eerror "Failed to simply unmount filesystems"
fi
- return ${retval}
+ eindent
+ fs=
+ for x in ${RC_NET_FS_LIST}; do
+ fs="${fs}${fs:+|}${x}"
+ done
+ [ -n "${fs}" ] && fs="^(${fs})$"
+ do_unmount "umount" ${fs:+--fstype-regex} ${fs} --netdev
+ retval=$?
+
+ eoutdent
+ eend ${retval} "Failed to unmount network filesystems"
}
# vim: set ts=4 :