From f9f3f3426126f059165a1f37da0ad3ea205fbdd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 3 Mar 2015 19:19:03 +0100 Subject: Replace fixed path with a POSIX-compliant shell function to check the existence of a command --- debian/changelog | 5 +++++ debian/patches/0005-mk_reproducible_results.patch | 17 +++++++++++++++++ debian/patches/series | 1 + debian/rules | 3 --- debian/sane-utils.postinst | 23 ++++++++++++++++++++++- debian/sane-utils.postrm | 23 ++++++++++++++++++++++- 6 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 debian/patches/0005-mk_reproducible_results.patch (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 8040079..3a50a60 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,8 +18,13 @@ sane-backends (1.0.24-10) UNRELEASED; urgency=medium + libsane-dbg: libsane-extras-dbg (<< 1.0.18.14) * debian/rules: - Enable pnm backend for testing. + - Remove override_dh_builddeb because compression xz is now standard. * debian/saned@.service: - Remove Alias from [Install] Section (Closes: #778268). + * sane-utils.[postinst|postrm]: + + Replace fixed path with a POSIX-compliant shell function to check + the existence of a command. + -- Jörg Frings-Fürst Sun, 18 Jan 2015 11:46:18 +0100 diff --git a/debian/patches/0005-mk_reproducible_results.patch b/debian/patches/0005-mk_reproducible_results.patch new file mode 100644 index 0000000..0906d6d --- /dev/null +++ b/debian/patches/0005-mk_reproducible_results.patch @@ -0,0 +1,17 @@ +Index: trunk/tools/sane-desc.c +=================================================================== +--- trunk.orig/tools/sane-desc.c ++++ trunk/tools/sane-desc.c +@@ -2816,8 +2816,10 @@ html_print_footer (void) + "
\n" + "Contact\n" "
\n" "\n"); +- printf ("This page was last updated on %s by sane-desc %s from %s\n", +- asctime (localtime (¤t_time)), SANE_DESC_VERSION, PACKAGE_STRING); ++/* printf ("This page was last updated on %s by sane-desc %s from %s\n", ++ asctime (localtime (¤t_time)), SANE_DESC_VERSION, PACKAGE_STRING); */ ++ printf ("This page was last updated by sane-desc %s from %s\n", ++ SANE_DESC_VERSION, PACKAGE_STRING); + printf ("\n"); + printf (" \n"); + } diff --git a/debian/patches/series b/debian/patches/series index fbfd015..c3b722b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ +0005-mk_reproducible_results.patch hp3900.patch typo.patch license_typo.patch diff --git a/debian/rules b/debian/rules index cda6224..bd70cb7 100755 --- a/debian/rules +++ b/debian/rules @@ -136,9 +136,6 @@ override_dh_systemd_enable: override_dh_strip: dh_strip --dbg-package=libsane-dbg -override_dh_builddeb: - dh_builddeb -- -Zxz - override_dh_makeshlibs: dpkg-gensymbols -v$(VERSION) -plibsane dh_makeshlibs diff --git a/debian/sane-utils.postinst b/debian/sane-utils.postinst index 83857a6..f3e5f2d 100644 --- a/debian/sane-utils.postinst +++ b/debian/sane-utils.postinst @@ -8,6 +8,26 @@ saned_eh () { echo "saned couldn't start; check your inetd configuration and README.Debian" } +# +# 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" = "configure" ] || [ "$1" = "reconfigure" ]; then db_get sane-utils/saned_run RUN_SANED="$RET" @@ -16,7 +36,8 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then SANED_IN_SCANNER="$RET" # Add saned service, disabled by default - if [ -x /usr/sbin/update-inetd ]; then + pathfind update-inetd + if [ $? = 0 ]; then update-inetd --add "## sane-port\tstream\ttcp\tnowait\tsaned:saned\t/usr/sbin/saned saned" fi 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 "## sane-port" fi -- cgit v1.2.3