From c669ae26aa10fd85abfd5cb3c79d526f2766e2d4 Mon Sep 17 00:00:00 2001 From: Gregory Giguashvili Date: Fri, 19 Apr 2024 10:14:02 +0300 Subject: [PATCH] Enhance removal of autoconnect option from network manager configuration --- test/kickstart-templates/includes/post-network.cfg | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/kickstart-templates/includes/post-network.cfg b/test/kickstart-templates/includes/post-network.cfg index 465e55e515..937f01a683 100644 --- a/test/kickstart-templates/includes/post-network.cfg +++ b/test/kickstart-templates/includes/post-network.cfg @@ -9,8 +9,9 @@ chmod 600 /home/redhat/.ssh/authorized_keys chown -R redhat:redhat /home/redhat/.ssh/ # Make sure all the Ethernet network interfaces are connected automatically -for uuid in $(nmcli -f uuid,type,autoconnect connection | awk '$2 == "ethernet" && $3 == "no" {print $1}') ; do - # Remove autoconnect option from the configuration file to keep it enabled after reboot - file=$(nmcli -f uuid,filename connection | awk -v uuid=${uuid} '$1 == uuid' | sed "s/${uuid}//g" | xargs) - sed -i '/autoconnect=.*/d' "${file}" +# by removing autoconnect option from the configuration files +find /etc/NetworkManager -name '*.nmconnection' -print0 | while IFS= read -r -d $'\0' file ; do + if grep -qE '^type=ethernet' "${file}" ; then + sed -i '/autoconnect=.*/d' "${file}" + fi done