From 75ffae7753bb7a705c72fc8c609a830c0591930c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Wed, 27 Feb 2019 13:07:38 +0100 Subject: [PATCH] Updated pns.usr.f29 (setupnetworking script). --- .../firstboot/01_setupnetworking.sh | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/sources/pns.usr.f29/firstboot/01_setupnetworking.sh b/sources/pns.usr.f29/firstboot/01_setupnetworking.sh index baca48d..c5d2f05 100755 --- a/sources/pns.usr.f29/firstboot/01_setupnetworking.sh +++ b/sources/pns.usr.f29/firstboot/01_setupnetworking.sh @@ -13,42 +13,43 @@ do systemctl --quiet is-active NetworkManager.service NM_RC=$? done -[ $WAITED -ne 0 ] && echo +[ $WAITED -eq 1 ] && echo -CONNECTIONS=$(nmcli connection show | grep -v '^NAME' | wc -l) -if [ $CONNECTIONS -ne 1 ] -then +CONNECTIONS=$(nmcli --terse connection show | wc -l) +while [ $CONNECTIONS -ne 1 ] +do echo "Number of connections: $CONNECTIONS" >&2 - exit 1 -fi - -CONNECTION_LINE=$(nmcli connection show | grep -v '^NAME') -CONNECTION_TOKENS=$(echo $CONNECTION_LINE | wc -w) -#CONNECTION_NAME_POS=$(( $CONNECTION_TOKENS - 3 )) -CONNECTION_UUID_POS=$(( $CONNECTION_TOKENS - 2 )) -#CONNECTION_TYPE_POS=$(( $CONNECTION_TOKENS - 1 )) -CONNECTION_DEVICE_POS=$CONNECTION_TOKENS -#CONNECTION_NAME=$(echo $CONNECTION_LINE \ -# | cut -f -$CONNECTION_NAME_POS -d ' ') -CONNECTION_UUID=$(echo $CONNECTION_LINE \ - | cut -f $CONNECTION_UUID_POS -d ' ') -#CONNECTION_TYPE=$(echo $CONNECTION_LINE \ -# | cut -f $CONNECTION_TYPE_POS -d ' ') -CONNECTION_DEVICE=$(echo $CONNECTION_LINE \ - | cut -f $CONNECTION_DEVICE_POS -d ' ') + sleep 1 + CONNECTIONS=$(nmcli --terse connection show | wc -l) +done + +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 + +CONNECTION_LINE=$(nmcli --terse connection show) +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 \ - type 802-3-ethernet \ - ifname $CONNECTION_DEVICE \ - con-name internal \ - autoconnect yes \ - save yes \ - ipv4.addresses "10.228.109.174/16" \ + connection.autoconnect yes \ + connection.id perimeter \ + connection.interface-name $CONNECTION_DEVICE \ + connection.type 802-3-ethernet \ + ipv4.addresses "10.228.109.174/24" \ ipv4.dns "10.228.109.104, 10.228.109.253" \ ipv4.dns-search "usr.user.hu" \ ipv4.gateway "10.228.109.254" \ ipv4.method "manual" \ - ipv6.method "ignore" + ipv6.method "ignore" \ + save yes + nmcli connection show -- 2.54.0