#!/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 # I made a mistake before, the new default location was /etc/firewall.nft, not # /etc/nftables.nft. Now I changed it to /etc/nftables.nft (same as Arch Linux), # so if /etc/firewall.nft exists and /etc/nftables.nft didn't exist, copy # /etc/firewall.nft to /etc/nftables.nft to not break existing setup. if [ "$(apk version -t "$ver_old" "0.9.3-r2")" = "<" ]; then old_file='/etc/firewall.nft' new_file='/etc/nftables.nft' cat >&2 <<-EOF * The default rules_file was changed to $new_file and * save_on_stop disabled! * Also note that /etc/nftables/ was moved to /usr/share/nftables/. EOF if [ -f "$old_file" ] && [ ! -f "$new_file.apk-new" ]; then echo "* Copying $old_file to $new_file" >&2 cp -a "$old_file" "$new_file" fi fi