diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-03-03 19:19:03 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-03-03 19:19:03 +0100 |
commit | f9f3f3426126f059165a1f37da0ad3ea205fbdd0 (patch) | |
tree | 3b1a690c7cb57888105b066025f4f3f0a392674b /debian/sane-utils.postrm | |
parent | 6a1bffbbcf836fbee19693cee54598e737ab709c (diff) |
Replace fixed path with a POSIX-compliant shell function to check the existence of a command
Diffstat (limited to 'debian/sane-utils.postrm')
-rw-r--r-- | debian/sane-utils.postrm | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/debian/sane-utils.postrm b/debian/sane-utils.postrm index a11d248..4960234 100644 --- a/debian/sane-utils.postrm +++ b/debian/sane-utils.postrm @@ -2,8 +2,29 @@ set -e +# +# POSIX-compliant shell function +# to check for the existence of a command +# Return 0 if found +# +pathfind() { + OLDIFS="$IFS" + IFS=: + for p in $PATH; do + if [ -x "$p/$*" ]; then + IFS="$OLDIFS" + return 0 + fi + done + IFS="$OLDIFS" + return 1 +} + + + if [ "$1" = purge ]; then - if [ -x /usr/sbin/update-inetd ]; then + pathfind update-inetd + if [ $? = 0 ]; then update-inetd --remove sane-port update-inetd --remove "#<off># sane-port" fi |