From d28cdc30925aabdec199f1ee6815f354de71057d Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Wed, 3 Nov 2010 09:55:27 -0400 Subject: [PATCH] Allow nd-autoinstall to test just file existance not only command. --- tools/nd-autoinstall | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tools/nd-autoinstall b/tools/nd-autoinstall index f98edda..cf90125 100755 --- a/tools/nd-autoinstall +++ b/tools/nd-autoinstall @@ -122,7 +122,17 @@ if [ ! -z "$ai_envfile" ]; then source "$ai_envfile" || ai_envfile_failed=1 fi -if [ ! -z "$ai_envfile_failed" ] || ! which $ai_command >/dev/null; then +do_install=0 +if [ ! -z "$ai_envfile_failed" ]; then + do_install=1 +fi +if which $ai_command > /dev/null || [ -e $ai_command ]; then + do_install=0 +else + do_install=1 +fi + +if [ $do_install -eq 1 ]; then if ! zenity --question \ --text="To run '$ai_command', $ai_package package needs to be installed. Do you want to proceed?"; then exit 2 @@ -136,7 +146,7 @@ if [ ! -z "$ai_envfile_failed" ] || ! which $ai_command >/dev/null; then DEBIAN_FRONTEND=gnome /usr/bin/apt-get install -y $ai_package 2>&1 \ && rm -f $logfile; } \ | tee $logfile \ - | zenity --title="nd-autoinstall" \ + | zenity --title="Package installation" \ --text="Installing $ai_package" \ --progress --pulsate --auto-close --auto-kill if [ -e $logfile ] ; then @@ -153,5 +163,8 @@ if [ ! -z "$ai_envfile_failed" ] || ! which $ai_command >/dev/null; then } fi -print_verbose "Running $ai_command" -$ai_command "$@" +if [ -x $ai_command ]; then + # only run if executable + print_verbose "Running $ai_command" + $ai_command "$@" +fi -- 2.39.5