diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2020-01-04 17:14:24 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2020-01-04 17:21:42 +0100 |
commit | 239ecb16b43a14761e151222bf8f9cd99825d15f (patch) | |
tree | bb4209049ad12aa1fd7a702680494052253aa231 /main/nftables/nftables.post-upgrade | |
parent | 12bb17de3742c8c60d2802aaf4a7469fd1d74aea (diff) | |
download | aports-239ecb16b43a14761e151222bf8f9cd99825d15f.tar.bz2 aports-239ecb16b43a14761e151222bf8f9cd99825d15f.tar.xz |
main/nftables: change default rules_file location and save_on_stop
Diffstat (limited to 'main/nftables/nftables.post-upgrade')
-rw-r--r-- | main/nftables/nftables.post-upgrade | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/main/nftables/nftables.post-upgrade b/main/nftables/nftables.post-upgrade index c360ec44f3..8ab77c096d 100644 --- a/main/nftables/nftables.post-upgrade +++ b/main/nftables/nftables.post-upgrade @@ -14,6 +14,22 @@ if [ "$(apk version -t "$ver_old" "0.8.3-r1")" = "<" ]; then 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 - echo '* Note that /etc/nftables/ was moved to /usr/share/nftables/.' >&2 + 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 |