From f8af295ca5fc25883f34a1bfed0c5f3d025560a0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 5 May 2022 18:16:39 +0200 Subject: Supporting both ifupdown and systemd-networkd for the time being, depending on the existence of /etc/network/interfaces. Signed-off-by: Daniel Baumann --- libexec/container/stop | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'libexec/container/stop') diff --git a/libexec/container/stop b/libexec/container/stop index 455f08c..cb85c8d 100755 --- a/libexec/container/stop +++ b/libexec/container/stop @@ -146,6 +146,13 @@ then exit 1 fi +if systemctl status systemd-networkd > /dev/null 2>&1 +then + NETWORK_SUBSYSTEM="systemd-networkd" +else + NETWORK_SUBSYSTEM="ifupdown" +fi + # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" do @@ -220,7 +227,16 @@ case "${CLEAN}" in for VETH in ${VETHS} do INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" - FILE="/run/systemd/network/${INTERFACE}.network" + + case "${NETWORK_SUBSYSTEM}" in + ifupdown) + FILE="/etc/network/interfaces.d/${INTERFACE}" + ;; + + systemd-networkd) + FILE="/run/systemd/network/${INTERFACE}.network" + ;; + esac if [ -f "${FILE}" ] then -- cgit v1.2.3