diff options
author | jpaetzel <jpaetzel@FreeBSD.org> | 2012-05-03 21:21:45 +0000 |
---|---|---|
committer | jpaetzel <jpaetzel@FreeBSD.org> | 2012-05-03 21:21:45 +0000 |
commit | 593ade1bddc87e9ddb3e4aa2313c4f5f83bc23dc (patch) | |
tree | 5151e400541406e63924ab4d5790251e3a68408c | |
parent | b410e7655763d64188f826ef3aeea00da20105e0 (diff) | |
download | FreeBSD-src-593ade1bddc87e9ddb3e4aa2313c4f5f83bc23dc.zip FreeBSD-src-593ade1bddc87e9ddb3e4aa2313c4f5f83bc23dc.tar.gz |
Add the ability to configure multiple interfaces.
Submitted by: glarkin
Obtained from: PC-BSD
MFC after: 3 days
-rwxr-xr-x | usr.sbin/pc-sysinstall/backend/functions-networking.sh | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions-networking.sh b/usr.sbin/pc-sysinstall/backend/functions-networking.sh index d8e3da7..1aa08bd 100755 --- a/usr.sbin/pc-sysinstall/backend/functions-networking.sh +++ b/usr.sbin/pc-sysinstall/backend/functions-networking.sh @@ -192,7 +192,7 @@ save_manual_nic() # Get the target nic NIC="$1" - get_value_from_cfg netSaveIP + get_value_from_cfg netSaveIP_${NIC} NETIP="${VAL}" if [ "$NETIP" = "DHCP" ] @@ -212,7 +212,7 @@ save_manual_nic() IFARGS="inet ${NETIP}" # Check if we have a netmask to set - get_value_from_cfg netSaveMask + get_value_from_cfg netSaveMask_${NIC} NETMASK="${VAL}" if [ -n "${NETMASK}" ] then @@ -220,7 +220,7 @@ save_manual_nic() fi fi - get_value_from_cfg netSaveIPv6 + get_value_from_cfg netSaveIPv6_${NIC} NETIP6="${VAL}" if [ -n "${NETIP6}" ] then @@ -239,6 +239,12 @@ save_manual_nic() echo "ifconfig_${NIC}_ipv6=\"${IF6ARGS}\"" >>${FSMNT}/etc/rc.conf fi +}; + +# Function which saves a manual gateway router setup to the installed system +save_manual_router() +{ + # Check if we have a default router to set get_value_from_cfg netSaveDefaultRouter NETROUTE="${VAL}" @@ -253,19 +259,30 @@ save_manual_nic() echo "ipv6_defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf fi +}; + +save_manual_nameserver() +{ # Check if we have a nameserver to enable : > ${FSMNT}/etc/resolv.conf - get_value_from_cfg netSaveNameServer - NAMESERVER="${VAL}" - if [ -n "${NAMESERVER}" ] + get_value_from_cfg_with_spaces netSaveNameServer + NAMESERVERLIST="${VAL}" + if [ ! -z "${NAMESERVERLIST}" ] then - echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf + for NAMESERVER in ${NAMESERVERLIST} + do + echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf + done fi - get_value_from_cfg netSaveIPv6NameServer - NAMESERVER="${VAL}" - if [ -n "${NAMESERVER}" ] + + get_value_from_cfg_with_spaces netSaveIPv6NameServer + NAMESERVERLIST="${VAL}" + if [ ! -z "${NAMESERVERLIST}" ] then - echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf + for NAMESERVER in ${NAMESERVERLIST} + do + echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf + done fi }; @@ -454,25 +471,30 @@ save_networking_install() { # Check if we have any networking requested to save - get_value_from_cfg netSaveDev + get_value_from_cfg_with_spaces netSaveDev if [ -z "${VAL}" ] then return 0 fi - NETDEV="${VAL}" - if [ "$NETDEV" = "AUTO-DHCP" ] + NETDEVLIST="${VAL}" + if [ "$NETDEVLIST" = "AUTO-DHCP" ] then save_auto_dhcp - elif [ "$NETDEV" = "IPv6-SLAAC" ] + elif [ "$NETDEVLIST" = "IPv6-SLAAC" ] then save_auto_slaac - elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ] + elif [ "$NETDEVLIST" = "AUTO-DHCP-SLAAC" ] then save_auto_dhcp save_auto_slaac else - save_manual_nic ${NETDEV} + for NETDEV in ${NETDEVLIST} + do + save_manual_nic ${NETDEV} + done + save_manual_router + save_manual_nameserver fi }; |