From 1f5e9c6e40fe9aa7afda045140ef6c3bc4c949bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Sat, 20 May 2023 23:20:27 +0200 Subject: [PATCH] Updated pns.pm (updated to Fedora 38). --- .../firstboot/scripts/01_setupnetworking.sh | 70 +++++++++++++------ .../c3d/firstboot/scripts/90_setupservices.sh | 10 +++ .../postinstall/scripts/10_setupservices.sh | 6 +- sources/pns.pm/envvars | 2 +- 4 files changed, 61 insertions(+), 27 deletions(-) create mode 100755 sources/pns.pm/c3d/firstboot/scripts/90_setupservices.sh diff --git a/sources/pns.pm/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/pns.pm/c3d/firstboot/scripts/01_setupnetworking.sh index 86acd25..3aba29b 100755 --- a/sources/pns.pm/c3d/firstboot/scripts/01_setupnetworking.sh +++ b/sources/pns.pm/c3d/firstboot/scripts/01_setupnetworking.sh @@ -7,41 +7,67 @@ export PAGER= sleep 1 systemctl --quiet is-active NetworkManager.service NM_RC=$? -WAITED=0 +CYCLES_WAITED=0 while [ $NM_RC -ne 0 ] do + if [ $CYCLES_WAITED -ge 10 ] + then + exit 1 + fi + if [ $CYCLES_WAITED -eq 0 ] + then + echo -n "Waiting for NetworkManager" + fi echo -n . sleep 1 - WAITED=1 + CYCLES_WAITED=$(( $CYCLES_WAITED + 1 )) systemctl --quiet is-active NetworkManager.service NM_RC=$? done -[ $WAITED -eq 1 ] && echo +[ $CYCLES_WAITED -gt 0 ] && echo -CONNECTIONS=$(nmcli --terse connection show | wc -l) -while [ $CONNECTIONS -ne 1 ] +# wait for the two network connections to come up +CONNECTION_DEVICES_UP=$(nmcli --terse connection show \ + | grep --invert-match ':$' | wc -l) +CYCLES_WAITED=0 +while [ $CONNECTION_DEVICES_UP -lt 2 ] do - echo "Number of connections: $CONNECTIONS" >&2 + if [ $CYCLES_WAITED -ge 10 ] + then + nmcli connection show + exit 1 + fi + if [ $CYCLES_WAITED -eq 0 ] + then + echo -n "Waiting for the network connection" + fi + echo -n . sleep 1 - CONNECTIONS=$(nmcli --terse connection show | wc -l) + CYCLES_WAITED=$(( $CYCLES_WAITED + 1 )) + CONNECTION_DEVICES_UP=$(nmcli --terse connection show \ + | grep --invert-match ':$' | wc -l) done +[ $CYCLES_WAITED -gt 0 ] && echo -nmcli --terse connection show | grep ':$' >/dev/null -ALL_CONNECTION_DEVICES_KNOWN=$? -while [ $ALL_CONNECTION_DEVICES_KNOWN -eq 0 ] -do - echo "Not all connection devices are known yet" >&2 - sleep 1 - nmcli --terse connection show | grep ':$' >/dev/null - ALL_CONNECTION_DEVICES_KNOWN=$? -done +CONNECTIONS=$(nmcli --terse connection show | wc -l) +if [ $CONNECTIONS -ne 2 ] +then + echo "Number of connections: $CONNECTIONS instead of 2" >&2 + exit 1 +fi -CONNECTION_LINE=$(nmcli --terse connection show) +CONNECTION_LINE=$(nmcli --terse connection show | grep ':eth0$') CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':') CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':') nmcli connection delete uuid "$CONNECTION_UUID" +# ipv6.addresses "2a02:d400:0000:f2ad:000c:18ff:fe03:adae/64" \ +# ipv6.dns "2a02:d400:0000:f2ad:000c:18ff:fe03:adae" \ +# ipv6.dns-search "pm.useribm.hu" \ +# ipv6.gateway "2a02:d400:0000:f2ad:000c:18ff:fe03:adfe" \ +# ipv6.routes "2a02:d400:0000:f268::/64 2a02:d400:0000:f2ad:000c:18ff:fe03:ad01" \ +# ipv6.method "manual" \ nmcli connection add \ connection.autoconnect yes \ connection.id perimeter \ @@ -53,12 +79,10 @@ nmcli connection add \ ipv4.gateway "192.168.173.254" \ ipv4.method "manual" \ ipv4.routes "10.228.0.0/16 192.168.173.1" \ - ipv6.addresses "2a02:d400:0000:f2ad:000c:18ff:fe03:adae/64" \ - ipv6.dns "2a02:d400:0000:f2ad:000c:18ff:fe03:adae" \ - ipv6.dns-search "pm.useribm.hu" \ - ipv6.gateway "2a02:d400:0000:f2ad:000c:18ff:fe03:adfe" \ - ipv6.routes "2a02:d400:0000:f268::/64 2a02:d400:0000:f2ad:000c:18ff:fe03:ad01" \ - ipv6.method "manual" \ + ipv6.method "disabled" \ save yes nmcli connection show + +hostnamectl hostname pns.pm.useribm.hu +hostnamectl diff --git a/sources/pns.pm/c3d/firstboot/scripts/90_setupservices.sh b/sources/pns.pm/c3d/firstboot/scripts/90_setupservices.sh new file mode 100755 index 0000000..d758570 --- /dev/null +++ b/sources/pns.pm/c3d/firstboot/scripts/90_setupservices.sh @@ -0,0 +1,10 @@ +#!/bin/sh + + +systemctl enable named.service +systemctl start named.service +systemctl enable NetworkManager-wait-online.service +systemctl start NetworkManager-wait-online.service + +systemctl enable logrotate.timer +systemctl start logrotate.timer diff --git a/sources/pns.pm/c3d/postinstall/scripts/10_setupservices.sh b/sources/pns.pm/c3d/postinstall/scripts/10_setupservices.sh index 41df693..7241e78 100755 --- a/sources/pns.pm/c3d/postinstall/scripts/10_setupservices.sh +++ b/sources/pns.pm/c3d/postinstall/scripts/10_setupservices.sh @@ -1,7 +1,7 @@ #!/bin/sh -systemctl enable named.service -systemctl enable NetworkManager-wait-online.service +systemctl disable named.service +systemctl disable NetworkManager-wait-online.service -systemctl enable logrotate.timer +systemctl disable logrotate.timer diff --git a/sources/pns.pm/envvars b/sources/pns.pm/envvars index 897d3d9..cb1ec3e 100644 --- a/sources/pns.pm/envvars +++ b/sources/pns.pm/envvars @@ -1,3 +1,3 @@ DISTRIBUTION=Fedora -DISTRIBUTION_VERSION=37 +DISTRIBUTION_VERSION=38 SPEC_PACKAGES="bind bind-utils" -- 2.54.0