aboutsummaryrefslogtreecommitdiffstats
path: root/main/nginx
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-10-25 16:59:53 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-11-24 15:10:00 +0100
commit1b7a02dada936a48f24416fc7e1f4e1d9e059aea (patch)
tree15be8045d42bae37ad56aae695aa9716cc853d16 /main/nginx
parent7117bcd53280d81028c868c3a6790b770df1d00a (diff)
downloadaports-1b7a02dada936a48f24416fc7e1f4e1d9e059aea.tar.bz2
aports-1b7a02dada936a48f24416fc7e1f4e1d9e059aea.tar.xz
main/nginx: fix upgrade from version < 1.12.0-r1
Fixes http://bugs.alpinelinux.org/issues/8057
Diffstat (limited to 'main/nginx')
-rw-r--r--main/nginx/APKBUILD4
-rw-r--r--main/nginx/nginx.pre-upgrade27
2 files changed, 29 insertions, 2 deletions
diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD
index cda88d6830..1b1e56ade5 100644
--- a/main/nginx/APKBUILD
+++ b/main/nginx/APKBUILD
@@ -9,7 +9,7 @@
#
pkgname=nginx
pkgver=1.12.2
-pkgrel=0
+pkgrel=1
# Revision of nginx-tests to use for check().
_tests_hgrev=cdd44ff602db
pkgdesc="HTTP and reverse proxy server (stable version)"
@@ -25,7 +25,7 @@ pkgusers="nginx"
_grp_ngx="nginx"
_grp_www="www-data"
pkggroups="$_grp_ngx $_grp_www"
-install="$pkgname.pre-install $pkgname.post-upgrade"
+install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-vim::noarch"
replaces="$pkgname-common $pkgname-initscripts $pkgname-lua $pkgname-rtmp"
source="http://nginx.org/download/$pkgname-$pkgver.tar.gz
diff --git a/main/nginx/nginx.pre-upgrade b/main/nginx/nginx.pre-upgrade
new file mode 100644
index 0000000000..67f05dda1c
--- /dev/null
+++ b/main/nginx/nginx.pre-upgrade
@@ -0,0 +1,27 @@
+#!/bin/ash
+
+ver_new="$1"
+ver_old="$2"
+
+if [ "$(apk version -t "$ver_old" '1.12.0-r1')" = '<' ]; then
+ tmp_new=/var/tmp/nginx
+ tmp_old=/var/lib/nginx/tmp
+
+ # Create a new temp directory, move data from the old one to the new
+ # one and delete the old one.
+ if [ -d "$tmp_old" ]; then
+ echo "* Moving data from $tmp_old to $tmp_new..." >&2
+
+ [ -d "$tmp_new" ] \
+ || install -d -m 700 -o nginx -g nginx "$tmp_new"
+ rmdir "$tmp_old" 2>/dev/null \
+ && exit 0 \
+ || mv "$tmp_old"/* "$tmp_new"/
+ rmdir "$tmp_old" 2>/dev/null \
+ && exit 0 \
+ || mv "$tmp_old"/.[!.]* "$tmp_new"/ # move dot files
+ rmdir "$tmp_old"
+ fi
+fi
+
+exit 0