Don't rely on fuser being present
This commit is contained in:
		| @@ -7,9 +7,7 @@ | |||||||
| # This isn't a real issue for the BSD's, but it is for Linux. | # This isn't a real issue for the BSD's, but it is for Linux. | ||||||
| do_unmount() | do_unmount() | ||||||
| { | { | ||||||
| 	type fuser >/dev/null 2>&1 || return 0 | 	local cmd="$1" retval=0 retry= pids=- | ||||||
|  |  | ||||||
| 	local cmd="$1" retval=0 retry= |  | ||||||
| 	local f_opts="-m -c" f_kill="-s " mnt= | 	local f_opts="-m -c" f_kill="-s " mnt= | ||||||
| 	if [ "${RC_UNAME}" = "Linux" ]; then | 	if [ "${RC_UNAME}" = "Linux" ]; then | ||||||
| 		f_opts="-m" | 		f_opts="-m" | ||||||
| @@ -33,13 +31,17 @@ do_unmount() | |||||||
|  |  | ||||||
| 		retry=3 | 		retry=3 | ||||||
| 		while ! LC_ALL=C ${cmd} "${mnt}" 2>/dev/null; do | 		while ! LC_ALL=C ${cmd} "${mnt}" 2>/dev/null; do | ||||||
| 			# Don't kill if it's us (/ and possibly /usr) | 			if type fuser >/dev/null 2>&1; then | ||||||
| 			local pids="$(fuser ${f_opts} "${mnt}" 2>/dev/null)" | 				pids="$(fuser ${f_opts} "${mnt}" 2>/dev/null)" | ||||||
|  | 			fi | ||||||
| 			case " ${pids} " in | 			case " ${pids} " in | ||||||
| 				*" $$ "*) | 				*" $$ "*) | ||||||
| 					eend 1 "failed because we are using" \ | 					eend 1 "failed because we are using" \ | ||||||
| 					"${mnt}" | 					"${mnt}" | ||||||
| 					retry=0;; | 					retry=0;; | ||||||
|  | 				" - ") | ||||||
|  | 					eend 1 | ||||||
|  | 					retry=0;; | ||||||
| 				"  ") | 				"  ") | ||||||
| 					eend 1 "in use but fuser finds nothing" | 					eend 1 "in use but fuser finds nothing" | ||||||
| 					retry=0;; | 					retry=0;; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user