Skip to content

Commit

Permalink
Merge pull request #3411 from dokku/nginx-dependencies
Browse files Browse the repository at this point in the history
Properly handle the nginx installation dependency
  • Loading branch information
josegonzalez committed Jan 21, 2019
2 parents b7e5bbe + 6b0cdae commit 35e04d5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions plugins/nginx-vhosts/dependencies
Expand Up @@ -23,12 +23,17 @@ nginx_needs_upgrade() {
echo $NEEDS_UPGRADE
}

nginx_install() {
declare desc="install nginx and dnsutils"
export DEBIAN_FRONTEND=noninteractive
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
}

nginx_dependencies() {
declare desc="installs dependencies for the nginx-vhosts plugin"
case "$DOKKU_DISTRO" in
debian)
export DEBIAN_FRONTEND=noninteractive
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
nginx_install
;;

ubuntu)
Expand All @@ -38,17 +43,22 @@ nginx_dependencies() {
return
fi

[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
if ! which nginx >/dev/null 2>&1; 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

[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties

add-apt-repository -y ppa:nginx/stable
apt-get update -qq >/dev/null
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
nginx_install
;;

opensuse)
Expand Down

0 comments on commit 35e04d5

Please sign in to comment.