Don't install ifupdown script in /etc/network/if-down.d on Debian

- Network Manager sets PHASE=post-down when calling our updown script
  so we must process down commands in that phase.

- Modify the generated script to eliminate PHASE checks.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2020-04-18 10:34:53 -07:00
parent 5101a6be4a
commit 381d55760b
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
2 changed files with 12 additions and 11 deletions

View File

@ -169,7 +169,7 @@ if [ -z "$BUILD" ]; then
;; ;;
*) *)
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID=) ID=$(grep '^ID=' /etc/os-release | sed 's/ID=//; s/"//g;')
case $ID in case $ID in
fedora|rhel|centos|foobar) fedora|rhel|centos|foobar)
@ -357,12 +357,11 @@ fi
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755 make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755
make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755
make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755 make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755
elif [ $configure -eq 0 ]; then elif [ $configure -eq 0 ]; then
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755 make_parent_directory ${CONFDIR}/network/if-up.d 0755
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755 make_parent_directory ${CONFDIR}/network/if-post-down.d 0755
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755 rm -f ${CONFDIR}/network/if-down.d/shorewall
fi fi
if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then
@ -388,7 +387,7 @@ else
elif [ $HOST = openwrt ]; then elif [ $HOST = openwrt ]; then
# Not implemented on OpenWRT # Not implemented on OpenWRT
/bin/true /bin/true
else elif [ "$HOST" != debian ]; then
make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755 make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755
fi fi
fi fi
@ -417,19 +416,21 @@ if [ $HOST != openwrt ]; then
fi fi
if [ -d ${DESTDIR}/etc/NetworkManager ]; then if [ -d ${DESTDIR}/etc/NetworkManager ]; then
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755 if [ "$HOST" = debian ]; then
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544 rm -f ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall
else
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
fi
fi fi
case $HOST in case $HOST in
debian) debian)
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544 install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
else else
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-post-down.d/shorewall 0544 install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-post-down.d/shorewall 0544
fi fi
;; ;;

View File

@ -2069,7 +2069,7 @@ sub compile_updown() {
q( COMMAND=enable) , q( COMMAND=enable) ,
q( detect_configuration $1), q( detect_configuration $1),
q( enable_provider $1), q( enable_provider $1),
q( elif [ "$PHASE" != post-down ]; then # pre-down or not Debian) , q( else ),
q( progress_message3 "Attempting disable on interface $1") , q( progress_message3 "Attempting disable on interface $1") ,
q( COMMAND=disable) , q( COMMAND=disable) ,
q( detect_configuration $1), q( detect_configuration $1),