| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# Can be dropped in Trixie |
| 6 |
if update-alternatives --query iptables.service 2>/dev/null; then |
| 7 |
update-alternatives --remove-all iptables.service |
| 8 |
fi |
| 9 |
|
| 10 |
# Source debconf library |
| 11 |
. /usr/share/debconf/confmodule |
| 12 |
|
| 13 |
case "$1" in |
| 14 |
configure) |
| 15 |
db_get iptables-persistent/autosave_done || true |
| 16 |
if [ "x$RET" != "xtrue" ]; then |
| 17 |
db_get iptables-persistent/autosave_v4 || true |
| 18 |
if [ "x$RET" = "xtrue" ]; then |
| 19 |
if which iptables >/dev/null; then |
| 20 |
if iptables -t filter -L -n >/dev/null; then |
| 21 |
iptables-save >/etc/iptables/rules.v4 |
| 22 |
else |
| 23 |
echo "IPv4: Unable to save (table filter isn't available or module not loadable)" |
| 24 |
fi |
| 25 |
else |
| 26 |
echo "IPv4: Can't find iptables in $PATH, please check your system" |
| 27 |
fi |
| 28 |
fi |
| 29 |
db_get iptables-persistent/autosave_v6 || true |
| 30 |
if [ "x$RET" = "xtrue" ]; then |
| 31 |
if which ip6tables >/dev/null; then |
| 32 |
if ip6tables -t filter -L -n >/dev/null; then |
| 33 |
ip6tables-save >/etc/iptables/rules.v6 |
| 34 |
else |
| 35 |
echo "IPv6: Unable to save (table filter isn't available or module not loadable)" |
| 36 |
fi |
| 37 |
else |
| 38 |
echo "IPv6: Can't find ip6tables in $PATH, please check your system" |
| 39 |
fi |
| 40 |
fi |
| 41 |
|
| 42 |
db_set iptables-persistent/autosave_done true || true |
| 43 |
fi |
| 44 |
|
| 45 |
update-rc.d iptables-persistent remove |
| 46 |
;; |
| 47 |
esac |
| 48 |
|
| 49 |
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ]; then |
| 50 |
# Ensure the drop-in is loaded |
| 51 |
if [ -d /run/systemd/system ]; then |
| 52 |
systemctl --system daemon-reload >/dev/null || true |
| 53 |
fi |
| 54 |
fi |
| 55 |
|
| 56 |
# See #1036785 |
| 57 |
if [ -f /etc/systemd/system/netfilter-persistent.service.d ]; then |
| 58 |
rmdir --ignore-fail-on-non-empty /etc/systemd/system/netfilter-persistent.service.d |
| 59 |
fi |
| 60 |
|
| 61 |
#DEBHELPER# |