#!/bin/sh

ver_new="$1"
ver_old="$2"

if [ "$(apk version -t "$ver_old" "1.10.1-r3")" = "<" ]; then
	cat 1>&2 <<-EOF
	*
	* The nginx package has been modified to use dynamic modules. Now there's
	* just single package providing nginx executable and bunch of nginx-mod-*
	* subpackages.
	*
	* Lua support is now provided by package nginx-mod-http-lua, RTMP support
	* is provided by nginx-mod-rtmp.
	*
	* Modules mail and stream are dynamic modules too and so not included
	* by default anymore. If you use them, install nginx-mod-mail and
	* nginx-mod-stream.
	* 
	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
