aboutsummaryrefslogtreecommitdiffstats
path: root/main/nginx/nginx.pre-upgrade
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-10-25 16:59:53 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-10-25 17:02:13 +0200
commit25207194564766b239aeb5eae428d8868555ab67 (patch)
tree352d63abf9938f652e52feac7a17d9f7509f5fb7 /main/nginx/nginx.pre-upgrade
parent826a728c27d52a7d4e2f11c4a11fe93a78dcd4c5 (diff)
downloadaports-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/nginx.pre-upgrade')
-rw-r--r--main/nginx/nginx.pre-upgrade25
1 files changed, 25 insertions, 0 deletions
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