From: Rhonda D'Vine Date: Tue, 12 Apr 2016 12:08:00 +0000 (+0200) Subject: Use pathfind() function instead of hardcoded path to dpkg-statoverride X-Git-Tag: debian/1.3-4~3 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=a7ba3628a25ce13e6c1fe738b88a2a5f46673604;p=pkg%2Fbeep.git Use pathfind() function instead of hardcoded path to dpkg-statoverride --- diff --git a/debian/changelog b/debian/changelog index fe7ae69..cc1be54 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ beep (1.3-4) unstable; urgency=low * Switch to source format 3.0 (quilt). * New patch fix-makefile to make make clean not fail. * Add #DEBHELPER# to post{inst,rm} files. + * Use pathfind() function instead of hardcoded path to dpkg-statoverride. -- diff --git a/debian/postinst b/debian/postinst index dc97dc0..29eb0c1 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,10 +1,23 @@ #!/bin/sh # postinst for beep -# copyright 2002-2011 by Rhonda D'Vine +# copyright 2002-2016 by Rhonda D'Vine # Licenced under WTFPLv2 set -e +pathfind() { + OLDIFS="$IFS" + IFS=: + for p in $PATH; do + if [ -x "$p/$*" ]; then + IFS="$OLDIFS" + return 0 + fi + done + IFS="$OLDIFS" + return 1 +} + # Source debconf library. if [ -e /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule @@ -35,7 +48,7 @@ if [ "$suid" = "not suid at all" ] ; then fi -if [ -x /usr/sbin/dpkg-statoverride ] ; then +if pathfind dpkg-statoverride ; then if ! dpkg-statoverride --list /usr/bin/beep >/dev/null ; then if [ "$suid" = "usable for all" ] ; then chmod 4755 /usr/bin/beep