Skip upgrading nginx when the version of nginx is at least 1.8.0
Refs #2059
This commit is contained in:
1 parent
a43fc39d9a
commit
f99aa2b128
1 file changed
+31
@@ -1,6 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
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 ! which nginx > /dev/null 2>&1; 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_dependencies() {
|
||||||
|
declare desc="installs dependencies for the nginx-vhosts plugin"
|
||||||
case "$DOKKU_DISTRO" in
|
case "$DOKKU_DISTRO" in
|
||||||
debian)
|
debian)
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
@@ -9,6 +32,11 @@ case "$DOKKU_DISTRO" in
|
|||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
local NEEDS_UPGRADE=$(nginx_needs_upgrade)
|
||||||
|
if [[ "$NEEDS_UPGRADE" == "false" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
|
[[ -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
|
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
|
||||||
|
|
||||||
@@ -30,3 +58,6 @@ case "$DOKKU_DISTRO" in
|
|||||||
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
|
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
nginx_dependencies "$@"
|
||||||
Reference in new issue
Block a user