17535: Modify provision script to run on Centos
authorJavier Bértoli <jbertoli@curii.com>
Fri, 23 Jul 2021 18:02:45 +0000 (15:02 -0300)
committerJavier Bértoli <jbertoli@curii.com>
Fri, 23 Jul 2021 18:02:45 +0000 (15:02 -0300)
Arvados-DCO-1.1-Signed-off-by: Javier Bértoli <jbertoli@curii.com>

tools/salt-install/provision.sh

index 7ac120e5fd89179f75fcf13608679edfaa2b45e5..e95fa2c1f91cd02add08efa8a406dbedad0fb23c 100755 (executable)
@@ -11,6 +11,7 @@
 # vagrant up
 
 set -o pipefail
+set -x
 
 # capture the directory that the script is running from
 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@@ -232,8 +233,24 @@ fi
 if [ "${DUMP_CONFIG}" = "yes" ]; then
   echo "The provision installer will just dump a config under ${DUMP_SALT_CONFIG_DIR} and exit"
 else
-  apt-get update
-  apt-get install -y curl git jq
+  # Install a few dependency packages
+  # First, let's figure out the OS we're working on
+  OS_ID=$(grep ^ID= /etc/os-release |cut -f 2 -d \")
+  echo "Detected distro: ${OS_ID}"
+
+  case ${OS_ID} in
+    centos)
+      PREINSTALL_CMD="/bin/true"
+      INSTALL_CMD="yum install -y"
+      ;;
+    debian|ubuntu)
+      PREINSTALL_CMD="DEBIAN_FRONTEND=noninteractive apt update"
+      INSTALL_CMD="DEBIAN_FRONTEND=noninteractive apt install -y"
+      ;;
+  esac
+
+  ${PREINSTALL_CMD}
+  ${INSTALL_CMD} curl git jq
 
   if which salt-call; then
     echo "Salt already installed"