M #-: Avoid slow contextualization

pull/280/head
Jan Orel 2 years ago
parent 7324b69f82
commit 381b5b10da
No known key found for this signature in database
GPG Key ID: C7B901ABAF4CFF1B

@ -269,6 +269,13 @@ gen_network_configuration()
{ {
_context_interfaces=$(get_context_interfaces) _context_interfaces=$(get_context_interfaces)
_networkd_version=$(networkctl --version | head -1 | awk '{print $2}')
if [ -n "$_networkd_version" ]; then
# put some dummy low version if not detected
_networkd_version="100"
fi
for _iface in $_context_interfaces; do for _iface in $_context_interfaces; do
setup_iface_vars "$_iface" setup_iface_vars "$_iface"
@ -286,6 +293,9 @@ gen_network_configuration()
# #
# This occurs at least with systemd/networkd version 248, which is on # This occurs at least with systemd/networkd version 248, which is on
# Cent OS 8 for example. # Cent OS 8 for example.
if [ $_networkd_version -le 250 ]; then
if is_networkd_iface_managed "${dev}" ; then if is_networkd_iface_managed "${dev}" ; then
# networkctl up/down is not on ubuntu <21.04 # networkctl up/down is not on ubuntu <21.04
networkctl down "$dev" 2>/dev/null || true networkctl down "$dev" 2>/dev/null || true
@ -293,6 +303,7 @@ gen_network_configuration()
# this is still necessary to really unconfigure the interface # this is still necessary to really unconfigure the interface
ip addr flush "$dev" ip addr flush "$dev"
fi fi
fi
{ {
cat <<EOT cat <<EOT

Loading…
Cancel
Save