Lines 66-77
stop() {
Link Here
|
66 |
|
66 |
|
67 |
rcfilesystems=${rcfilesystems// /,} # convert to comma-separated |
67 |
rcfilesystems=${rcfilesystems// /,} # convert to comma-separated |
68 |
|
68 |
|
69 |
local ret |
69 |
if [ "${RC_SIMPLE_NET_UMOUNT}" != "no" ]; then |
70 |
ebegin "Unmounting network filesystems" |
70 |
local ret |
71 |
[[ -z $(umount -art ${rcfilesystems} 2>&1) ]] |
71 |
ebegin "Unmounting network filesystems" |
72 |
ret=$? |
72 |
[[ -z $(umount -art ${rcfilesystems} 2>&1) ]] |
73 |
eend ${ret} "Failed to simply unmount filesystems" |
73 |
ret=$? |
74 |
[[ ${ret} == 0 ]] && return 0 |
74 |
eend ${ret} "Failed to simply unmount filesystems" |
|
|
75 |
[[ ${ret} == 0 ]] && return 0 |
76 |
else |
77 |
einfo "Skipped simple network filesystems unmount" |
78 |
fi |
75 |
|
79 |
|
76 |
# `umount -a` will fail if the filesystems are in use. |
80 |
# `umount -a` will fail if the filesystems are in use. |
77 |
# Here we use fuser to kill off processes that are using |
81 |
# Here we use fuser to kill off processes that are using |
Lines 83-92
stop() {
Link Here
|
83 |
local remaining="go" |
87 |
local remaining="go" |
84 |
|
88 |
|
85 |
while [[ -n ${remaining} && ${retry} -lt 3 ]] ; do |
89 |
while [[ -n ${remaining} && ${retry} -lt 3 ]] ; do |
|
|
90 |
# Don't unmount /newroot or network mounted unions that overlay "/", or "/" |
91 |
RC_NO_NET_UMOUNTS=${RC_NO_NET_UMOUNTS:-/newroot|/\.unions/.*|/} |
92 |
# this one is the same as in halt.sh -- globalize me? |
93 |
RC_NO_UMOUNT_FS="^(proc|devpts|sysfs|devfs|tmpfs|usb(dev)?fs|unionfs|rootfs)$" |
86 |
# Populate $remaining with a newline-delimited list of network |
94 |
# Populate $remaining with a newline-delimited list of network |
87 |
# filesystems. Mount points have spaces swapped for '\040' (see |
95 |
# filesystems. Mount points have spaces swapped for '\040' (see |
88 |
# fstab(5)) so we have to translate them back to spaces. |
96 |
# fstab(5)) so we have to translate them back to spaces. |
89 |
remaining="$(awk '$3 ~ /'${NET_FS_LIST// /|}'/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" |
97 |
remaining="$(awk -v NO_UMOUNTS='^('${RC_NO_NET_UMOUNTS}')$' \ |
|
|
98 |
-v RC_NO_UMOUNT_FS=$RC_NO_UMOUNT_FS \ |
99 |
'$3 ~ /'${NET_FS_LIST// /|}'/ \ |
100 |
{ \ |
101 |
if (($3 !~ RC_NO_UMOUNT_FS) && \ |
102 |
($2 !~ NO_UMOUNTS)) \ |
103 |
print $2 \ |
104 |
}' /proc/mounts | sort -r)" |
90 |
# Since we have to worry about the spaces being quoted properly, |
105 |
# Since we have to worry about the spaces being quoted properly, |
91 |
# we'll use `set --` and then "$@" to get the correct result. |
106 |
# we'll use `set --` and then "$@" to get the correct result. |
92 |
IFS=$'\n' |
107 |
IFS=$'\n' |