diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2020-11-18 17:29:39 +0000 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2021-02-27 23:47:58 -0600 |
commit | 28df69f8ef2c29a6c2da5e37cf8c26b520101407 (patch) | |
tree | 412513d5780af5060d78d1f1fdc846fc6d1ef32d /netconfig | |
parent | e1b2962f0f2bf976c5f7d2bb8e9c53f896ef84b5 (diff) | |
download | slacknetsetup-28df69f8ef2c29a6c2da5e37cf8c26b520101407.tar.xz |
Clean up after ourselves in various places with new code.
* Keep a file with the VLAN ID while processing VLANs.
* Touched up a couple more bits of dialog text.
Diffstat (limited to 'netconfig')
-rw-r--r-- | netconfig | 56 |
1 files changed, 41 insertions, 15 deletions
@@ -508,15 +508,26 @@ elif [ "$ERRNO" = "1" ]; then true else while true; do + [ -r $TMP/SeTVLAN ] && VLAN="$(cat $TMP/SeTVLAN)" dialog --title "VLAN ID" --cancel-label "Skip" --inputbox \ - "Enter the VLAN ID used on this network:" 8 45 2>$TMP/reply + "Enter the VLAN ID used on this network:" 8 45 "$VLAN" 2>$TMP/reply ERRNO="$?" if [ "$ERRNO" = "255" ]; then + rm -f $TMP/SeTVLAN exit elif [ "$ERRNO" = "1" ]; then + unset VLAN + rm -f $TMP/SeTVLAN break else - if [[ ! "$(cat $TMP/reply)" =~ ^[0-9]+$ ]]; then + VLAN="$(cat $TMP/reply)" + echo "$VLAN" >$TMP/SeTVLAN + if [ "$VLAN" = "" ]; then + unset VLAN + rm -f $TMP/SeTVLAN + break + fi + if [[ ! "$VLAN" =~ ^[0-9]+$ ]]; then dialog --title "VLAN ID" --ok-button "Back" --msgbox \ "That doesn't appear to be a valid VLAN ID." 5 46 if [ "$?" = "255" ]; then @@ -524,7 +535,8 @@ else fi continue else - VLAN=".$(( 10#$(cat $TMP/reply) ))" + rm -f $TMP/SeTVLAN + VLAN=".$(( 10#$VLAN ))" break fi fi @@ -582,7 +594,7 @@ pure IPv6 network, or 'Both' to try and set up both types of network." 13 73 3 \ that the DHCP hostname be set in order to connect. If so, they'll have assigned \ a hostname to your machine, which may look something like CC-NUMBER-A (this \ depends on your ISP). If you were assigned a DHCP hostname, please enter it \ -below. If you do not have a DHCP hostname, just hit ENTER or select 'Skip'." 13 62 \ +below. If you do not have a DHCP hostname, just leave it blank or select 'Skip'." 13 62 \ 2> $TMP/SeTDHCPHOST if [ "$?" = "255" ]; then exit @@ -619,18 +631,21 @@ If a net mask is not specified a default of 24 will be used. The first address entered will become the primary IPv4 address of this host. If you do not want to configure a static IPv4 -address, just hit ENTER or select 'Skip' " \ +address, just leave it blank or select 'Skip'." \ 17 69 "${IPADDRS[*]}" 2> $TMP/SeTlip ERRNO="$?" if [ "$ERRNO" = "1" ]; then + IPADDRS=() + rm -f $TMP/SeTIPSv4 $TMP/SeTlip break elif [ "$ERRNO" = "255" ]; then - rm -f $TMP/SeTlip + rm -f $TMP/SeTIPSv4 $TMP/SeTlip exit fi IPADDRS=($(cat $TMP/SeTlip)) rm -f $TMP/SeTlip if [ "${IPADDRS[*]}" = "" ]; then + rm -f $TMP/SeTIPSv4 break fi for ((I=0; I < ${#IPADDRS[@]}; I++)); do @@ -638,7 +653,11 @@ address, just hit ENTER or select 'Skip' " \ MASK="${IPADDRS[$I]#*/}" if [ "$IP" = "" ]; then dialog --title "NO IPv4 ADDRESSES" --ok-button "Back" --msgbox \ - "No IP specified in entry: ${IPADDRS[$I]}." 5 46 + "No IP specified in entry: ${IPADDRS[$I]}." 5 55 + if [ "$?" = "255" ]; then + rm -f $TMP/SeTIPSv4 + exit + fi continue fi syntax_check_v4 "$IP" 4 WARN || continue 2 @@ -649,14 +668,16 @@ address, just hit ENTER or select 'Skip' " \ if [[ ! "$MASK" =~ ^[0-9]+$ ]] || (($MASK <= 0)) || (($MASK > 32)); then dialog --title "INVALID NET MASK" --msgbox \ "Invalid net mask specified for entry: ${IPADDRS[$I]}. -Valid net masks will be in the range 1-32." 6 70 +Valid net masks will be in the range 1-32." 6 65 + if [ "$?" = "255" ]; then + rm -f $TMP/SeTIPSv4 + exit + fi echo "${IPADDRS[@]}" >$TMP/SeTIPSv4 continue 2 fi done - # echo "${IPADDRS[0]%%/*}" >$TMP/SeTIP - # echo "${IPADDRS[0]#*/}" >$TMP/SeTnetmask - echo "${IPADDRS[@]}" >$TMP/SeTIPSv4 + rm -f $TMP/SeTIPSv4 $TMP/SeTlip break done @@ -669,8 +690,8 @@ Valid net masks will be in the range 1-32." 6 70 "Enter the address for the IPv4 gateway on your network, such as: `echo ${IPADDRS[0]} | cut -f 1-3 -d .`.1 -If you don't have an IPv4 gateway on your network just hit ENTER -without entering a gateway IP address, or select 'Skip'. +If you don't have an IPv4 gateway on your network leave it blank +or select 'Skip'. Enter IPv4 gateway address:" 14 68 "$GATEWAY" 2> $TMP/SeTgate4 if [ $? = 1 -o $? = 255 ]; then @@ -693,11 +714,16 @@ Enter IPv4 gateway address:" 14 68 "$GATEWAY" 2> $TMP/SeTgate4 done fi -exit + + + + + + while [ 0 ]; do if [ -r $TMP/SeTIP6 ]; then - IPADDR6=`cat $TMP/SeTIP6` + IPADDR6="`cat $TMP/SeTIP6`" fi dialog --title "ENTER IPv6 ADDRESS FOR '$HOSTNM.$DOMAIN'" --inputbox \ "Enter the IPv6 address for the local machine. |