fix: cleanup release process for non-ubuntu systems

This commit is contained in:
Jose Diaz-Gonzalez
2018-04-07 12:59:18 -04:00
parent a9e8890fe1
commit 4078995eeb
4 changed files with 94 additions and 79 deletions

View File

@@ -108,6 +108,16 @@ install-dokku-from-package() {
esac
}
in-array() {
declare desc="return true if value ($1) is in list (all other arguments)"
local e
for e in "${@:2}"; do
[[ "$e" == "$1" ]] && return 0
done
return 1
}
install-dokku-from-deb-package() {
local DOKKU_CHECKOUT="$1"
local NO_INSTALL_RECOMMENDS=${DOKKU_NO_INSTALL_RECOMMENDS:=""}
@@ -135,11 +145,27 @@ install-dokku-from-deb-package() {
add-apt-repository -y ppa:nginx/stable
fi
OS_ID="$(lsb_release -cs 2> /dev/null || echo "trusty")"
OS_ID="$(lsb_release -cs 2> /dev/null || echo "xenial")"
if ! in-array "$DOKKU_DISTRO" "debian" "ubuntu"; then
DOKKU_DISTRO="ubuntu"
OS_ID="xenial"
fi
if [[ "$DOKKU_DISTRO" == "ubuntu" ]]; then
OS_IDS=("trusty" "utopic" "vivid" "wily" "xenial" "yakkety" "zesty" "artful" "bionic")
if ! in-array "$OS_ID" "${OS_IDS[@]}"; then
OS_ID="xenial"
fi
elif [[ "$DOKKU_DISTRO" == "debian" ]]; then
OS_IDS=("wheezy" "jessie" "stretch" "buster" "bullseye")
if ! in-array "$OS_ID" "${OS_IDS[@]}"; then
OS_ID="xenial"
fi
fi
echo "--> Installing dokku"
wget -nv -O - https://packagecloud.io/gpg.key | apt-key add -
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ $OS_ID main" | tee /etc/apt/sources.list.d/dokku.list
echo "deb https://packagecloud.io/dokku/dokku/$DOKKU_DISTRO/ $OS_ID main" | tee /etc/apt/sources.list.d/dokku.list
apt-get update -qq > /dev/null
[[ -n $DOKKU_VHOST_ENABLE ]] && echo "dokku dokku/vhost_enable boolean $DOKKU_VHOST_ENABLE" | sudo debconf-set-selections