aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/netfs
diff options
context:
space:
mode:
authorMiloslav Trmac <mitr@volny.cz>2006-05-08 23:54:06 +0000
committerMiloslav Trmac <mitr@volny.cz>2006-05-08 23:54:06 +0000
commit3bd074fd404b4863d811d0a50e9ef484523c6b57 (patch)
tree9c4ca48303377ab77a8a00d10561ba1e8afbab28 /rc.d/init.d/netfs
parent0414be84b33e98510feb1d0e281b089ba16b349d (diff)
downloadinitscripts-3bd074fd404b4863d811d0a50e9ef484523c6b57.tar
initscripts-3bd074fd404b4863d811d0a50e9ef484523c6b57.tar.gz
initscripts-3bd074fd404b4863d811d0a50e9ef484523c6b57.tar.bz2
initscripts-3bd074fd404b4863d811d0a50e9ef484523c6b57.tar.xz
initscripts-3bd074fd404b4863d811d0a50e9ef484523c6b57.zip
Fix handling of mount points with white space (#186713):
- src/fstab-decode.c, src/fstab-decode.8: New files. - src/Makefile: Build and install fstab-decode. - initscripts.spec: Add fstab-decode to %files - rc.d/init.d/functions (fstab_decode_str): New function. (__umount_loop, __umount_loopback_loop): Factor out from copy&pasted copies. (action): Fix command quoting. - rc.d/rc.sysinit: Correctly quote and decode mount points. - rc.d/init.d/halt: Use __umount_* and fstab-decode. (action): Rename from runcmd. Fix command quoting. - rc.d/init.d/netfs: Use __umount_*.
Diffstat (limited to 'rc.d/init.d/netfs')
-rwxr-xr-xrc.d/init.d/netfs79
1 files changed, 14 insertions, 65 deletions
diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs
index faab107e..59693d11 100755
--- a/rc.d/init.d/netfs
+++ b/rc.d/init.d/netfs
@@ -89,71 +89,20 @@ case "$1" in
;;
stop)
# Unmount loopback stuff first
- remaining=`LC_ALL=C awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
- devremaining=`LC_ALL=C awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts`
- [ -n "$remaining" ] && {
- sig=
- retry=3
- while [ -n "$remaining" -a "$retry" -gt 0 ]
- do
- if [ "$retry" -lt 3 ]; then
- action $"Unmounting loopback filesystems (retry):" umount $remaining
- else
- action $"Unmounting loopback filesystems: " umount $remaining
- fi
- for dev in $devremaining ; do
- losetup $dev >/dev/null 2>&1 && \
- action $"Detaching loopback device $dev: " losetup -d $dev
- done
- remaining=`LC_ALL=C awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
- devremaining=`LC_ALL=C awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts`
- [ -z "$remaining" ] && break
- /sbin/fuser -k -m $sig $remaining >/dev/null
- sleep 5
- retry=$(($retry -1))
- sig=-9
- done
- }
- [ -n "$NETDEVMTAB" ] && {
- sig=
- retry=3
- remaining=`LC_ALL=C awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" {print $2}' /etc/mtab`
- while [ -n "$remaining" -a "$retry" -gt 0 ]
- do
- if [ "$retry" -lt 3 ]; then
- action $"Unmounting network block filesystems (retry): " umount -a -O _netdev
- else
- action $"Unmounting network block filesystems: " umount -a -O _netdev
- fi
- sleep 2
- remaining=`LC_ALL=C awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" {print $2}' /etc/mtab`
- [ -z "$remaining" ] && break
- /sbin/fuser -k -m $sig $remaining >/dev/null
- sleep 5
- retry=$(($retry - 1))
- sig=-9
- done
- }
- [ -n "$NFSMTAB" ] && {
- sig=
- retry=3
- remaining=`LC_ALL=C awk '$3 ~ /^nfs/ && $2 != "/" {print $2}' /proc/mounts`
- while [ -n "$remaining" -a "$retry" -gt 0 ]
- do
- if [ "$retry" -lt 3 ]; then
- action $"Unmounting NFS filesystems (retry): " umount -f -l $remaining
- else
- action $"Unmounting NFS filesystems: " umount -f -l $remaining
- fi
- sleep 2
- remaining=`LC_ALL=C awk '$3 ~ /^nfs/ && $2 != "/" {print $2}' /proc/mounts`
- [ -z "$remaining" ] && break
- /sbin/fuser -k -m $sig $remaining >/dev/null
- sleep 5
- retry=$(($retry - 1))
- sig=-9
- done
- }
+ __umount_loopback_loop
+ if [ -n "$NETDEVMTAB" ]; then
+ __umount_loop '$4 ~ /_netdev/ && $2 != "/" {print $2}' \
+ /etc/mtab \
+ $"Unmounting network block filesystems: " \
+ $"Unmounting network block filesystems (retry): "
+ fi
+ if [ -n "$NFSMTAB" ]; then
+ __umount_loop '$3 ~ /^nfs/ && $2 != "/" {print $2}' \
+ /proc/mounts \
+ $"Unmounting NFS filesystems: " \
+ $"Unmounting NFS filesystems (retry): " \
+ "-f -l"
+ fi
[ -n "$SMBMTAB" ] && action $"Unmounting SMB filesystems: " umount -a -t smbfs
[ -n "$CIFSMTAB" ] && action $"Unmounting CIFS filesystems: " umount -a -t cifs
[ -n "$NCPMTAB" ] && action $"Unmounting NCP filesystems: " umount -a -t ncpfs