diff --git a/install.sh b/install.sh index f5c1b38f7..270730df9 100644 --- a/install.sh +++ b/install.sh @@ -1,38 +1,33 @@ #!/usr/bin/env bash while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do - case $1 in - --dev) - APP_ENV="development" - shift - ;; - esac + case $1 in + --dev) + APP_ENV="development" shift + ;; + esac + shift done if [[ "$1" == '--' ]]; then shift; fi . /etc/lsb-release if [[ $DISTRIB_ID != "Ubuntu" ]]; then - echo "Ansible installation is only supported on Ubuntu distributions." - exit 0 + echo "Ansible installation is only supported on Ubuntu distributions." + exit 0 fi -PKG_OK=$(dpkg-query -W --showformat='${Status}\n' ansible | grep "install ok installed") -echo "Checking for Ansible: $PKG_OK" +sudo apt-get update +sudo apt-get install -q -y software-properties-common -if [[ "" == "$PKG_OK" ]]; then - sudo apt-get update - sudo apt-get install -q -y software-properties-common +if [[ $DISTRIB_CODENAME == "focal" ]]; then + sudo apt-get install -q -y ansible python3-pip python3-mysqldb +else + sudo add-apt-repository -y ppa:ansible/ansible + sudo apt-get update - if [[ $DISTRIB_CODENAME == "focal" ]]; then - sudo apt-get install -q -y ansible python3-pip python3-mysqldb - else - sudo add-apt-repository -y ppa:ansible/ansible - sudo apt-get update - - sudo apt-get install -q -y python2.7 python-pip python-mysqldb ansible - fi + sudo apt-get install -q -y python2.7 python-pip python-mysqldb ansible fi APP_ENV="${APP_ENV:-production}" diff --git a/update.sh b/update.sh index 9acfe6937..9b11c12df 100755 --- a/update.sh +++ b/update.sh @@ -14,23 +14,28 @@ while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do done if [[ "$1" == '--' ]]; then shift; fi +. /etc/lsb-release + +if [[ $DISTRIB_ID != "Ubuntu" ]]; then + echo "Ansible installation is only supported on Ubuntu distributions." + exit 0 +fi + +sudo apt-get update +sudo apt-get install -q -y software-properties-common + +if [[ $DISTRIB_CODENAME == "focal" ]]; then + sudo apt-get install -q -y ansible python3-pip python3-mysqldb +else + sudo add-apt-repository -y ppa:ansible/ansible + sudo apt-get update + + sudo apt-get install -q -y python2.7 python-pip python-mysqldb ansible +fi + APP_ENV="${APP_ENV:-production}" UPDATE_REVISION="${UPDATE_REVISION:-60}" -PKG_OK=$(dpkg-query -W --showformat='${Status}\n' ansible | grep "install ok installed") -echo "Checking for Ansible: $PKG_OK" - -if [[ "" == "$PKG_OK" ]]; then - sudo apt-get update - sudo apt-get install -q -y software-properties-common - sudo apt-add-repository ppa:ansible/ansible - sudo apt-get update - sudo apt-get install -q -y ansible python-mysqldb -else - sudo apt-get update - sudo apt-get install -q -y ansible python-mysqldb -fi - echo "Updating AzuraCast (Environment: $APP_ENV, Update revision: $UPDATE_REVISION)" if [[ ${APP_ENV} == "production" ]]; then