Commit 859f09c4 authored by Natanael Copa's avatar Natanael Copa
Browse files

main/nginx: fix transition /var/tmp/nginx -> /var/lib/nginx/tmp

fixes #11204
parent 8709cf83
......@@ -23,7 +23,7 @@ pkgname=nginx
# NOTE: Upgrade only to even-numbered versions (e.g. 1.14.z, 1.16.z)!
# Odd-numbered versions are mainline (development) versions.
pkgver=1.16.1
pkgrel=7
pkgrel=8
# Revision of nginx-tests to use for check().
_tests_hgrev=40e5f2a0a238
_njs_ver=0.3.5
......
......@@ -20,4 +20,15 @@ if [ "$(apk version -t "$ver_old" "1.10.1-r3")" = "<" ]; then
EOF
fi
# Handle trasition from /var/tmp/nginx to /var/lib/nginx/tmp
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/11204
if [ -d /var/lib/nginx/tmp ]; then
for i in /var/tmp/nginx/*; do
if [ -e "$i" ]; then
mv $i /var/lib/nginx/tmp/
fi
done
rmdir /var/tmp/nginx 2>/dev/null
fi
exit 0
#!/bin/ash
#!/bin/sh
ver_new="$1"
ver_old="$2"
# symlink to directory confuses apk. remove it before the upgrade
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/11204
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
if [ "$(readlink /var/lib/nginx/tmp)" = "/var/tmp/nginx" ]; then
rm /var/lib/nginx/tmp
fi
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment