aboutsummaryrefslogtreecommitdiffstats
path: root/main/nginx
diff options
context:
space:
mode:
Diffstat (limited to 'main/nginx')
-rw-r--r--main/nginx/APKBUILD4
-rw-r--r--main/nginx/nginx.pre-upgrade25
2 files changed, 27 insertions, 2 deletions
diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD
index bb24cdf742..ece2d18d28 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..72055c757a
--- /dev/null
+++ b/main/nginx/nginx.pre-upgrade
@@ -0,0 +1,25 @@
+#!/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
+ [ -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