]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
bootstrap: add an install flag that installs missing required packages 549/head
authorAndrew Schoen <aschoen@redhat.com>
Mon, 29 Jun 2015 22:28:12 +0000 (17:28 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 29 Jun 2015 22:36:55 +0000 (17:36 -0500)
If you run ./bootstrap install the script will install any missing
packages needed to complete the bootstrap.  This feature requires that
the user running ./bootstrap have sudo privileges.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
bootstrap

index ee5edfa13a91dfa812d7188fb9c1e7496113c8a2..23a4a47e37b892ffbc4575f324e79c54df7a4118 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,17 @@
 #!/bin/sh
 set -e
 
+if [ $# -eq 0 ]; then
+  install=false
+else
+  if [ "$1" = "install" ]; then
+      install=true
+  else
+      echo "Invalid command, supported commands are: 'install'"
+      exit 1
+  fi
+fi
+
 case "$(uname -s)" in
 Linux)
     case "$(lsb_release --id --short)" in
@@ -23,9 +34,16 @@ Linux)
             fi
         done
         if [ -n "$missing" ]; then
-            echo "$0: missing required packages, installing them:" 1>&2
+            echo "$0: missing required packages:" 1>&2
             echo "$missing"
-            sudo apt-get -y install $missing
+            if [ "$install" = true ]; then
+                echo "Installing missing packages..."
+                sudo apt-get -y install $missing
+            else
+                echo "Please install missing packages or run './bootstrap install' if you have sudo"
+                echo "sudo apt-get -y install $missing"
+                exit 1
+            fi
         fi
         ;;
     Fedora)
@@ -35,9 +53,16 @@ Linux)
            fi
        done
        if [ -n "$missing" ]; then
-            echo "$0: missing required packages, installing them:" 1>&2
+            echo "$0: missing required packages:" 1>&2
             echo "$missing"
-            sudo yum -y install $missing
+            if [ "$install" = true ]; then
+                echo "Installing missing packages..."
+                sudo yum -y install $missing
+            else
+                echo "Please install missing packages or run './bootstrap install' if you have sudo"
+                echo "sudo yum -y install $missing"
+                exit 1
+            fi
        fi
        ;;
     "openSUSE project"|"SUSE LINUX")