mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 13:27:09 +02:00
It may take a longer time to move the files, so user should be informed what is going on.
28 lines
636 B
Bash
28 lines
636 B
Bash
#!/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
|