]> xenbits.xensource.com Git - people/sstabellini/raisin.git/commitdiff
Add warning on install and configure and --yes option
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 7 Apr 2015 11:10:39 +0000 (11:10 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 7 Apr 2015 11:33:54 +0000 (11:33 +0000)
Add a warning when the user requests to install and configure the system
as it is potentially harmful.
Also add a -y option to skip the warning and silently continue anyway.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
raise.sh

index 1e923a27d09b1cfeec5483f5e275a98e34c5f181..518a2337b57bb538a18e7770acf69f897db2e4df 100755 (executable)
--- a/raise.sh
+++ b/raise.sh
@@ -10,6 +10,7 @@ help() {
     echo "where options are:"
     echo "    -n | --no-deps       Do no install build-time dependencies"
     echo "    -v | --verbose       Verbose"
+    echo "    -y | --yes           Do not ask questions and continue"
     echo "    -i | --install       Install under / and configure the system"
 }
 
@@ -21,6 +22,7 @@ common_init
 INST=0
 export NO_DEPS=0
 export VERBOSE=0
+export YES="n"
 while [[ $# -ge 1 ]]
 do
   if [[ "$1" = "-n" || "$1" = "--no-deps" ]]
@@ -35,6 +37,10 @@ do
   then
     INST=1
     shift 1
+  elif [[ "$1" = "-y" || "$1" = "--yes" ]]
+  then
+    YES="y"
+    shift 1
   else
     help
     exit 1
@@ -57,6 +63,21 @@ build_package xen-system
 if [[ -z "$INST" || "$INST" -eq 0 ]]
 then
     exit 0
+elif [[ -z "$YES" || "$YES" != "y" ]]
+    echo "Proceeding we'll make changes to the running system,"
+    echo "Installing the components we built and configuring the system"
+    echo "(requires sudo)."
+    echo "Are you sure that you want to continue? (y/n)"
+    while read answer
+    do
+        if [[ "$answer" = "n" ]]
+        then
+            exit 0
+        elif [[ "$answer" = "y" ]]
+        then
+            break
+        fi
+    done
 fi
 
 install_package xen-system