From: Zoltán Felleg Date: Wed, 27 Feb 2019 10:16:51 +0000 (+0100) Subject: Updated pns.pm.f29 (setupnetworking script). X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=e186c641fe7645b7fa4ff933d9634660a153e97d;p=user-lxc.git Updated pns.pm.f29 (setupnetworking script). --- diff --git a/sources/pns.pm.f29/firstboot/01_setupnetworking.sh b/sources/pns.pm.f29/firstboot/01_setupnetworking.sh index aeac781..9c87c34 100755 --- a/sources/pns.pm.f29/firstboot/01_setupnetworking.sh +++ b/sources/pns.pm.f29/firstboot/01_setupnetworking.sh @@ -13,43 +13,44 @@ 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 perimeter \ - autoconnect yes \ - save yes \ + connection.autoconnect yes \ + connection.id perimeter \ + connection.interface-name $CONNECTION_DEVICE \ + connection.type 802-3-ethernet \ ipv4.addresses "192.168.173.174/24" \ ipv4.dns "127.0.0.1" \ ipv4.dns-search "pm.user.hu" \ ipv4.gateway "192.168.173.254" \ ipv4.method "manual" \ ipv4.routes "10.228.0.0/16 192.168.173.1" \ - ipv6.method "ignore" + ipv6.method "ignore" \ + save yes + nmcli connection show