]> git.donarmstrong.com Git - neurodebian.git/commitdiff
Allow nd-autoinstall to test just file existance not only command.
authorMichael Hanke <michael.hanke@gmail.com>
Wed, 3 Nov 2010 13:55:27 +0000 (09:55 -0400)
committerMichael Hanke <michael.hanke@gmail.com>
Wed, 3 Nov 2010 13:55:27 +0000 (09:55 -0400)
tools/nd-autoinstall

index f98edda8ae28dfdb7c86972ddff1c00c749f8953..cf90125b41b5e3073bad4018efcb314d9193599d 100755 (executable)
@@ -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