2 # Filename: grml-exec-wrapper
3 # Purpose: simple but smart program execution wrapper
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
12 printf "Usage: %s <program> [<arguments>]
16 -h | --help display this usage information
17 -p <program> check specified argument instead of default args, like:
18 %s -p aumix xterm -T aumix -e aumix\n" "${PN}" "${PN}"
23 [ -z "$prog" ] && return 1
26 /*) # deal with absolute-path programs
27 [ -x "${prog}" ] && return 0
35 [ -z "$dir" ] && continue
36 [ -x "$dir/$prog" ] && ret=0 && break
44 # use Xdisplay only if present and running under X:
46 if is_installed xterm && test -n "$DISPLAY" ; then
47 xterm -T 'Sorry :(' -e "dialog --msgbox \"$1\" 0 0"
53 if [ -z "$1" ] || [ "$1" = '-h' ] || [ "$1" = '--help' ] ; then
58 if [ "$1" = '-p' ] ; then
68 # make sure to support 'grml-exec-wrapper sudo wireshark' as well:
74 if is_installed "$PROG" ; then
78 display_info "Sorry: ${PROG} not available.
80 Looks like the grml flavour you are using does not ship ${PROG}. :(
82 You can search for ${PROG} executing:
84 apt-get update && apt-cache search $(basename "${PROG}")
89 ## END OF FILE #################################################################