From: Zoltán Felleg Date: Sat, 3 Jun 2023 18:16:10 +0000 (+0200) Subject: Updated dhcp.in (updated to Fedora 38). X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=c26d9ce605f0a2ef9b44a6253bc98db229285e2d;p=user-lxc.git Updated dhcp.in (updated to Fedora 38). --- diff --git a/sources/dhcp.in/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/dhcp.in/c3d/firstboot/scripts/01_setupnetworking.sh index 4392f3e..c3b5832 100755 --- a/sources/dhcp.in/c3d/firstboot/scripts/01_setupnetworking.sh +++ b/sources/dhcp.in/c3d/firstboot/scripts/01_setupnetworking.sh @@ -7,45 +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" + nmcli connection add \ connection.autoconnect yes \ connection.id internal \ connection.interface-name $CONNECTION_DEVICE \ connection.type 802-3-ethernet \ - ipv4.addresses "10.228.109.59/16" \ + ipv4.addresses "10.228.109.238/16" \ ipv4.dns "10.228.109.159, 10.228.92.159" \ ipv4.dns-search "in.useribm.hu" \ ipv4.gateway "10.228.109.254" \ @@ -53,6 +75,7 @@ nmcli connection add \ ipv6.method "disabled" \ save yes -nmcli connection delete uuid "$CONNECTION_UUID" - nmcli connection show + +hostnamectl hostname dhcp.in.useribm.hu +hostnamectl diff --git a/sources/dhcp.in/config b/sources/dhcp.in/config index 01144f9..eac04da 100644 --- a/sources/dhcp.in/config +++ b/sources/dhcp.in/config @@ -8,7 +8,7 @@ lxc.mount.auto = proc:rw sys:ro lxc.net.0.type = veth lxc.net.0.flags = up lxc.net.0.link = brci-dev -lxc.net.0.hwaddr = 02:0c:18:03:6d:3b +lxc.net.0.hwaddr = 02:0c:18:03:6d:ee lxc.autodev = 1 diff --git a/sources/dhcp.in/envvars b/sources/dhcp.in/envvars index 694d2a6..8c74bd4 100644 --- a/sources/dhcp.in/envvars +++ b/sources/dhcp.in/envvars @@ -1,3 +1,3 @@ DISTRIBUTION=Fedora -DISTRIBUTION_VERSION=37 +DISTRIBUTION_VERSION=38 SPEC_PACKAGES="dhcp-server"