Updated git.pm (disabled NetworkManager boot time connection creating).
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Fri, 18 Oct 2024 10:37:37 +0000 (12:37 +0200)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Fri, 18 Oct 2024 10:37:37 +0000 (12:37 +0200)
sources/git.pm/c3d/firstboot/scripts/01_setupnetworking.sh

index 062dd874d9dfc58693d5e0638f4e59e9b55366dc..e4d68022143bdf325a0b357584cdaec5d5d556fb 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="perimeter"
+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 perimeter \
+    connection.id $CONNECTION_ID \
     connection.interface-name $CONNECTION_DEVICE \
     connection.type 802-3-ethernet \
     ipv4.addresses "192.168.173.42/24" \
@@ -81,6 +83,13 @@ nmcli connection add \
     ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
     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 git.pm.useribm.hu