#!/bin/sh

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

# Copy rules file to the new default location, to be sure that we will
# not break existing installations.
if [ "$(apk version -t "$ver_old" "0.8.3-r1")" = "<" ]; then
	old_file='/var/lib/nftables/rules-save'
	new_file='/etc/nftables.nft'

	if [ -f "$old_file" ] && [ ! -f "$new_file" ]; then
		cp -a "$old_file" "$new_file"
	fi
fi
