From f485dd991e8ef344d23bbfea71ba4ad7e759f3ac Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 22 Sep 2020 19:09:15 +0200 Subject: [PATCH] include package install support for yum based systems --- setup.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/setup.sh b/setup.sh index ae13cbd..4bacc34 100755 --- a/setup.sh +++ b/setup.sh @@ -178,23 +178,28 @@ fi APT_UPDATED="false" - for package in $required_packages - do - if [ $(dpkg-query -W -f='${STATUS}' $package 2>/dev/null | grep -c "ok installed") -eq 0 ]; then + if command -v apt &>/dev/null; then + for package in $required_packages + do + if [ $(dpkg-query -W -f='${STATUS}' $package 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" - [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" - [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" + [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" + [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" + [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" - echo Installing $package >> $LOGFILE 2>&1 - if ! apt install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1; then - # retry - apt install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1 + echo Installing $package >> $LOGFILE 2>&1 + if ! apt install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1; then + # retry + apt install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1 + fi fi - fi - progress=$((progress+2)) - echo $progress - done + progress=$((progress+2)) + echo $progress + done + elif command -v yum &>/dev/null; then + yum install -y git curl socat ntp python3-virtualenv python3-devel \ + gcc make ncurses-devel nc uuid zlib-devel zlib >> $LOGFILE 2>&1 + fi hash -r