Updated ns2.in (disabled NetworkManager boot time connection creating).
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Thu, 17 Oct 2024 13:59:10 +0000 (15:59 +0200)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Thu, 17 Oct 2024 13:59:10 +0000 (15:59 +0200)
sources/ns2.in/c3d/firstboot/scripts/01_setupnetworking.sh

index 543d868f79b2214db7f4f9af8603ac550375a486..9e4cc4e320286a687e707a8c6ce011be3d60eff6 100755 (executable)
@@ -34,6 +34,7 @@ while [ $CONNECTION_DEVICES_UP -lt 2 ]
 do
     if [ $CYCLES_WAITED -ge 10 ]
     then
+        echo
         nmcli connection show
         exit 1
     fi
@@ -56,15 +57,16 @@ then
     exit 1
 fi
 
-CONNECTION_LINE=$(nmcli --terse connection show | grep ':eth0$')
+CONNECTION_DEVICE="eth0"
+CONNECTION_ID="internal"
+CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
 CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
-CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
 
 nmcli connection delete uuid "$CONNECTION_UUID"
 
 nmcli connection add \
     connection.autoconnect yes \
-    connection.id internal \
+    connection.id $CONNECTION_ID \
     connection.interface-name $CONNECTION_DEVICE \
     connection.type 802-3-ethernet \
     ipv4.addresses "10.228.92.159/16" \
@@ -79,6 +81,13 @@ nmcli connection add \
     ipv6.method "manual" \
     save yes
 
+cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
+[device]
+match-device=interface-name:$CONNECTION_DEVICE
+allowed-connections=id:$CONNECTION_ID
+keep-configuration=no
+EOF
+
 nmcli connection show
 
 hostnamectl hostname ns2.in.useribm.hu