From aa7ab25a783495293c9fc738565600757dd6f0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Wed, 19 Jun 2019 21:03:54 +0200 Subject: [PATCH] configure_network: use classical function parsing --- network/setup-ip | 50 +++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/network/setup-ip b/network/setup-ip index f7ae533..cace94c 100755 --- a/network/setup-ip +++ b/network/setup-ip @@ -5,19 +5,16 @@ . /usr/lib/qubes/init/functions configure_network() { - local IFS=',' - read -r -a args <<< "$@" - - local MAC="${args[0]}" - local INTERFACE="${args[1]}" - local ip="${args[2]}" - local ip6="${args[3]}" - local netmask="${args[4]}" - local netmask6="${args[5]}" - local gateway="${args[6]}" - local gateway6="${args[7]}" - local primary_dns="${args[8]}" - local secondary_dns="${args[9]}" + local MAC="$1" + local INTERFACE="$2" + local ip="$3" + local ip6="$4" + local netmask="$5" + local netmask6="$6" + local gateway="$7" + local gateway6="$8" + local primary_dns="$9" + local secondary_dns="${10}" /sbin/ifconfig "$INTERFACE" "$ip" netmask "$netmask" if [ -n "$ip6" ]; then @@ -52,19 +49,16 @@ configure_network() { } configure_network_nm() { - local IFS=',' - read -r -a args <<< "$@" - - local MAC="${args[0]}" - local INTERFACE="${args[1]}" - local ip="${args[2]}" - local ip6="${args[3]}" - local netmask="${args[4]}" - local netmask6="${args[5]}" - local gateway="${args[6]}" - local gateway6="${args[7]}" - local primary_dns="${args[8]}" - local secondary_dns="${args[9]}" + local MAC="$1" + local INTERFACE="$2" + local ip="$3" + local ip6="$4" + local netmask="$5" + local netmask6="$6" + local gateway="$7" + local gateway6="$8" + local primary_dns="$9" + local secondary_dns="${10}" local prefix local prefix6 @@ -209,9 +203,9 @@ if [ -n "$INTERFACE" ]; then # If NetworkManager is enabled, let it configure the network if qsvc network-manager ; then - configure_network_nm "$MAC","$INTERFACE","$ip","$ip6","$netmask","$netmask6","$gateway","$gateway6","$primary_dns","$secondary_dns" + configure_network_nm "$MAC" "$INTERFACE" "$ip" "$ip6" "$netmask" "$netmask6" "$gateway" "$gateway6" "$primary_dns" "$secondary_dns" else - configure_network "$MAC","$INTERFACE","$ip","$ip6","$netmask","$netmask6","$gateway","$gateway6","$primary_dns","$secondary_dns" + configure_network "$MAC" "$INTERFACE" "$ip" "$ip6" "$netmask" "$netmask6" "$gateway" "$gateway6" "$primary_dns" "$secondary_dns" fi network=$(qubesdb-read /qubes-netvm-network 2>/dev/null)