#3782 -- Make Ansible update/install scripts use the same apt calls.
This commit is contained in:
parent
4eeb725436
commit
3018c01eab
37
install.sh
37
install.sh
|
@ -1,38 +1,33 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do
|
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--dev)
|
--dev)
|
||||||
APP_ENV="development"
|
APP_ENV="development"
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
if [[ "$1" == '--' ]]; then shift; fi
|
if [[ "$1" == '--' ]]; then shift; fi
|
||||||
|
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
|
|
||||||
if [[ $DISTRIB_ID != "Ubuntu" ]]; then
|
if [[ $DISTRIB_ID != "Ubuntu" ]]; then
|
||||||
echo "Ansible installation is only supported on Ubuntu distributions."
|
echo "Ansible installation is only supported on Ubuntu distributions."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' ansible | grep "install ok installed")
|
sudo apt-get update
|
||||||
echo "Checking for Ansible: $PKG_OK"
|
sudo apt-get install -q -y software-properties-common
|
||||||
|
|
||||||
if [[ "" == "$PKG_OK" ]]; then
|
if [[ $DISTRIB_CODENAME == "focal" ]]; then
|
||||||
sudo apt-get update
|
sudo apt-get install -q -y ansible python3-pip python3-mysqldb
|
||||||
sudo apt-get install -q -y software-properties-common
|
else
|
||||||
|
sudo add-apt-repository -y ppa:ansible/ansible
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
if [[ $DISTRIB_CODENAME == "focal" ]]; then
|
sudo apt-get install -q -y python2.7 python-pip python-mysqldb ansible
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
APP_ENV="${APP_ENV:-production}"
|
APP_ENV="${APP_ENV:-production}"
|
||||||
|
|
33
update.sh
33
update.sh
|
@ -14,23 +14,28 @@ while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do
|
||||||
done
|
done
|
||||||
if [[ "$1" == '--' ]]; then shift; fi
|
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}"
|
APP_ENV="${APP_ENV:-production}"
|
||||||
UPDATE_REVISION="${UPDATE_REVISION:-60}"
|
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)"
|
echo "Updating AzuraCast (Environment: $APP_ENV, Update revision: $UPDATE_REVISION)"
|
||||||
|
|
||||||
if [[ ${APP_ENV} == "production" ]]; then
|
if [[ ${APP_ENV} == "production" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue