[Blends-commit] [SCM] blends-dev branch, master, updated. 6311eeb1648c0df641343144669b15587abb3787

Andreas Tille tille at debian.org
Thu Jul 2 15:07:20 UTC 2015


The following commit has been merged in the master branch:
commit 61f92389587bf52242b612cac8cb3e702fd8e0cd
Author: Markus Koschany <apo at gambaru.de>
Date:   Wed Feb 25 01:12:24 2015 +0100

    Fix command-with-path-in-maintainer-script
    
    Programs called from maintainer scripts normally should not have a path
    prepended. This commit uses the most portable function to test a program for
    existence, in this case blend-update-usermenus, instead of using a hardcoded
    path.

diff --git a/templates/prerm b/templates/prerm
index 5d245ee..4acf6a0 100755
--- a/templates/prerm
+++ b/templates/prerm
@@ -13,11 +13,29 @@ set -e
 # If the user menus are not needed/wished for a Blend (like for instance
 # Debian Edu there is no need to install blends-common package.  Thus we
 # have to make sure that postinst does not try to include the menu stuff
+
+# The most portable way to test a program for existence
+# This fixes https://lintian.debian.org/tags/command-with-path-in-maintainer-script.html
+
+pathfind() {
+    OLDIFS="$IFS"
+    IFS=:
+    for p in $PATH; do
+        if [ -x "$p/$*" ]; then
+            IFS="$OLDIFS"
+            return 0
+        fi
+    done
+    IFS="$OLDIFS"
+    return 1
+}
+
+
 if [ -d /etc/blends -a -f /etc/blends/blends.conf ] ; then
     # Also verify that this Blend provides special configuration
     # If not there is no need to execute the user menu code
     if [ -d /etc/blends/#BLEND# -a -s /etc/blends/#BLEND#/#BLEND#.conf -a -s /etc/blends/blends.conf ] ; then
-	if [ -x /usr/sbin/blend-update-usermenus ] ; then
+	if pathfind blend-update-usermenus ; then
 	    . /etc/blends/blends.conf
 	    . /etc/blends/#BLEND#/#BLEND#.conf
 	    blend-update-menus --blend #BLEND# 

-- 
Git repository for blends code



More information about the Blends-commit mailing list