diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-10-25 16:59:53 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-10-25 17:02:13 +0200 |
commit | 25207194564766b239aeb5eae428d8868555ab67 (patch) | |
tree | 352d63abf9938f652e52feac7a17d9f7509f5fb7 /main/nginx | |
parent | 826a728c27d52a7d4e2f11c4a11fe93a78dcd4c5 (diff) | |
download | aports-25207194564766b239aeb5eae428d8868555ab67.tar.bz2 aports-25207194564766b239aeb5eae428d8868555ab67.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/APKBUILD | 4 | ||||
-rw-r--r-- | main/nginx/nginx.pre-upgrade | 25 |
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 |