From: Andrew Schoen Date: Mon, 29 Jun 2015 22:28:12 +0000 (-0500) Subject: bootstrap: add an install flag that installs missing required packages X-Git-Tag: 1.1.0~897^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F549%2Fhead;p=teuthology.git bootstrap: add an install flag that installs missing required packages 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 --- diff --git a/bootstrap b/bootstrap index ee5edfa13..23a4a47e3 100755 --- 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")