From 36c06f7bd1c769e3affd6a0590023feba5cbd43f Mon Sep 17 00:00:00 2001 From: Gregory Giguashvili Date: Sun, 21 Apr 2024 20:17:13 +0300 Subject: [PATCH] Fix all kickstart files not to use nmcli --- docs/config/microshift-starter.ks | 9 +++++---- scripts/image-builder/config/kickstart.ks.template | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/config/microshift-starter.ks b/docs/config/microshift-starter.ks index ce83bd6011..c8438cc909 100644 --- a/docs/config/microshift-starter.ks +++ b/docs/config/microshift-starter.ks @@ -53,10 +53,11 @@ RuntimeMaxUse=1G EOF # 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 %end diff --git a/scripts/image-builder/config/kickstart.ks.template b/scripts/image-builder/config/kickstart.ks.template index b9ea69fd4f..cf4a77bbbe 100644 --- a/scripts/image-builder/config/kickstart.ks.template +++ b/scripts/image-builder/config/kickstart.ks.template @@ -82,10 +82,11 @@ RuntimeMaxUse=1G EOF # 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 # Update certificate trust storage in case new certificates were