[Ovirt-devel] [PATCH node] Add support for aborting config scripts.

Darryl L. Pierce dpierce at redhat.com
Mon Apr 27 21:29:44 UTC 2009


If a script is aborted, then the script exits with a return code of 99.
The o-c-setup script then interprets that as an abort and not a failure.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-boot-wrapper |    2 +-
 scripts/ovirt-config-setup        |   15 +++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/scripts/ovirt-config-boot-wrapper b/scripts/ovirt-config-boot-wrapper
index 664d485..ff6f6e5 100755
--- a/scripts/ovirt-config-boot-wrapper
+++ b/scripts/ovirt-config-boot-wrapper
@@ -33,7 +33,7 @@ continuing."
         break
     elif [ "$r" == "N" ]; then
         printf "\nExiting back to the menu\n"
-        rc=1
+        rc=99
         break
     fi
 done
diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup
index 218d73b..9e8331b 100755
--- a/scripts/ovirt-config-setup
+++ b/scripts/ovirt-config-setup
@@ -55,12 +55,15 @@ while true; do
                 *)
                     {
                         printf "\n\n"
-                        if $CONFIG_DIR/*"$OPTION" ; then
-                            printf "\n"
-                        else
-                            printf "\nERROR: $OPTION FAILED. "
-                            printf "See $OVIRT_LOGFILE\n\n"
-                        fi
+			$CONFIG_DIR/*"$OPTION"
+			rc=$?
+			case $rc in
+			    0) printf "\n";;
+			    99) printf "\n$OPTION ABORTED.\n\n";;
+			    *) printf "\nERROR: $OPTION FAILED. "
+				printf "See $OVIRT_LOGFILE\n\n"
+				;;
+			esac
                     } 2>&1 | tee -a $OVIRT_TMP_LOGFILE;
                     if [ -f $OVIRT_TMP_LOGFILE ]; then
                         cat $OVIRT_TMP_LOGFILE >> $OVIRT_LOGFILE
-- 
1.6.0.6




More information about the ovirt-devel mailing list