From 9a02a8d1108d54f565cf6b3aa2b2413de7e790d4 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 6 Apr 2009 09:02:58 +0200 Subject: [PATCH] exec-wrapper: deal with absolute path names in is_installed exec-wrapper [rebase from path by ft, thx] --- debian/changelog | 3 ++- usr_bin/grml-exec-wrapper | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index cd395ba..b5becdd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,8 @@ grml-scripts (1.1.18) UNRELEASED; urgency=low * blacklist: use /etc/modprobe.d/grml.conf instead of /etc/modprobe.d/grml. New module-init-tools will use only files using the .conf suffix. - * Add new script grml-exec-wrapper. + * Add new script grml-exec-wrapper (simple but smart program + execution wrapper). Thanks to ft for help. * Fix typo in grml-chroot manpage. -- Michael Prokop Tue, 03 Mar 2009 10:35:12 +0100 diff --git a/usr_bin/grml-exec-wrapper b/usr_bin/grml-exec-wrapper index 6973b70..d90a490 100755 --- a/usr_bin/grml-exec-wrapper +++ b/usr_bin/grml-exec-wrapper @@ -13,14 +13,22 @@ Available options: -h | --help display this usage information -p check specified argument instead of default args, like: - $(basename $0) -p aumix xterm -T aumix -e aumix + $(basename $0) -p aumix xterm -T aumix -e aumix " } is_installed() { - prog="$(basename $1)" + prog="$1" [ -z "$prog" ] && return 1 + case "${prog}" in + /*) # deal with absolute-path programs + [ -x "${prog}" ] && return 0 + return 1 ;; + esac + + ret=1 + ret=1 oifs="$IFS" IFS=: @@ -51,10 +59,10 @@ fi if [ "$1" = '-p' ] ; then if [ -z "$2" ] ; then usage - exit 1 + exit 1 else PROG="$2" - shift ; shift + shift ; shift fi else PROG="$1" -- 2.1.4