Files
dokku/plugins/nginx-vhosts/dependencies
Jose Diaz-Gonzalez 70fc35c317 chore: drop unsupported operating systems
We will no longer support CentOS, Fedora, and Opensuse as installation targets. These are not actively maintained by anyone with commit rights and occasionally cause issues for users as they are not tested during the release process.

Rather than have subpar support for an untested operating system, we're removing support for them completely. Users of these operating systems should take a look migration to the docker-based installation method, which will always be tested and supported by the project.

Additionally, drop support for Debian 9 as it is now EOL.
2022-08-07 18:36:30 -04:00

72 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
nginx_needs_upgrade() {
declare desc="checks as to whether nginx needs to be installed or upgraded"
local MAJOR_VERSION MINOR_VERSION
local NEEDS_UPGRADE=true
if ! command -v nginx &>/dev/null; then
echo $NEEDS_UPGRADE
return
fi
MAJOR_VERSION=$(nginx -v 2>&1 | cut -d'/' -f 2 | awk '{split($0,a,"."); print a[1]}')
MINOR_VERSION=$(nginx -v 2>&1 | cut -d'/' -f 2 | awk '{split($0,a,"."); print a[2]}')
if [[ "$MAJOR_VERSION" -ge "2" ]]; then
NEEDS_UPGRADE=false
elif [[ "$MAJOR_VERSION" -ge "1" ]] && [[ "$MINOR_VERSION" -ge "8" ]]; then
NEEDS_UPGRADE=false
fi
echo $NEEDS_UPGRADE
}
nginx_install() {
declare desc="install nginx and dnsutils"
export DEBIAN_FRONTEND=noninteractive
apt-get -qq -y --no-install-recommends install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" nginx dnsutils
}
trigger-nginx-vhosts-dependencies() {
declare desc="installs dependencies for the nginx-vhosts plugin"
declare trigger="dependencies"
case "$DOKKU_DISTRO" in
debian | raspbian)
nginx_install
;;
ubuntu)
export DEBIAN_FRONTEND=noninteractive
local NEEDS_UPGRADE=$(nginx_needs_upgrade)
if [[ "$NEEDS_UPGRADE" == "false" ]]; then
return
fi
if ! command -v nginx &>/dev/null; then
nginx_install
return
fi
ubuntu_year=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[1]}')
ubuntu_month=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[2]}')
[[ "$ubuntu_year" -ge "16" ]] && exit 0
[[ "$ubuntu_year" -eq "15" ]] && [[ "$ubuntu_month" -eq "10" ]] && exit 0
apt-get -qq -y --no-install-recommends install software-properties-common python-software-properties
add-apt-repository -y ppa:nginx/stable
apt-get update -qq >/dev/null
nginx_install
;;
arch)
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
;;
esac
}
trigger-nginx-vhosts-dependencies "$@"