summaryrefslogtreecommitdiffstats
path: root/libexec/container/stop
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-05-05 16:33:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-05-05 16:33:37 +0000
commit4555baae98f8de055690d4d5c57e66b65156037f (patch)
tree0ee9e94efabd721e32893181a09429ed4eb2a114 /libexec/container/stop
parentReleasing debian version 20220430-1. (diff)
downloadopen-infrastructure-compute-tools-4555baae98f8de055690d4d5c57e66b65156037f.tar.xz
open-infrastructure-compute-tools-4555baae98f8de055690d4d5c57e66b65156037f.zip
Merging upstream version 20220505.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/stop')
-rwxr-xr-xlibexec/container/stop20
1 files changed, 18 insertions, 2 deletions
diff --git a/libexec/container/stop b/libexec/container/stop
index d2db38e..cb85c8d 100755
--- a/libexec/container/stop
+++ b/libexec/container/stop
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -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