From ff162b39ace915ed9803ff7d091157855cf6d48c Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 4 Mar 2008 22:03:41 +0000 Subject: [PATCH] Don't rely on fuser being present --- sh/rc-mount.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sh/rc-mount.sh b/sh/rc-mount.sh index 81d677ad..c7a6ecf8 100644 --- a/sh/rc-mount.sh +++ b/sh/rc-mount.sh @@ -7,9 +7,7 @@ # This isn't a real issue for the BSD's, but it is for Linux. do_unmount() { - type fuser >/dev/null 2>&1 || return 0 - - local cmd="$1" retval=0 retry= + local cmd="$1" retval=0 retry= pids=- local f_opts="-m -c" f_kill="-s " mnt= if [ "${RC_UNAME}" = "Linux" ]; then f_opts="-m" @@ -33,13 +31,17 @@ do_unmount() retry=3 while ! LC_ALL=C ${cmd} "${mnt}" 2>/dev/null; do - # Don't kill if it's us (/ and possibly /usr) - local pids="$(fuser ${f_opts} "${mnt}" 2>/dev/null)" + if type fuser >/dev/null 2>&1; then + pids="$(fuser ${f_opts} "${mnt}" 2>/dev/null)" + fi case " ${pids} " in *" $$ "*) eend 1 "failed because we are using" \ "${mnt}" retry=0;; + " - ") + eend 1 + retry=0;; " ") eend 1 "in use but fuser finds nothing" retry=0;;