New commits:
commit 37c8022d03d89bd5d100b61686e44329f2b714af
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
ripper: DEPENDS: added libpcap #12414
two other bugs remaining to get it working, splitting them for bugzilla
commit b88a638110e69d02ce0532e4c5d9f2b8556fd5c1
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
netconf:netconf:: removed tabs in favour of spaces
diff --git a/net/netconf/netconf b/net/netconf/netconf
index cc6938b..2ec049c 100644
--- a/net/netconf/netconf
+++ b/net/netconf/netconf
@@ -46,6 +46,9 @@ ## Software Foundation, Inc., 675 Mass A
#---------------------------------------------------------------------#
#
# ------------------------- ChangeLog ------------------------------- #
+# 2006-10-15 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+# - Changed all tabs to spaces
+#
# 2006-06-09 Juuso Alasuutari <iuso AT sourcemage.org>
# - Added DEVICE_MAC option to be used by udev for binding interface
# names to devices. At the moment udev spell's 07-bindings.rules
@@ -114,7 +117,7 @@ # - version 1.4
#
# 2004-03-16 charkins <charkins AT pobox.com>
# - fix parsing of module names in getnetmods() courtesy
-# of rycee (bug #6373)
+# of rycee (bug #6373)
#
# 2004-02-11 charkins <charkins AT pobox.com>
# - removed special handling of loopback device, lo.dev file will
@@ -313,20 +316,20 @@ ## @param suffix [optional]
## @Stdout basename of path
#---
function get_basename() {
- local s
+ local s
- # remove trailing slash if it exists
- s=${1%/}
+ # remove trailing slash if it exists
+ s=${1%/}
- # strip directory by removing largest .*/ prefix
- s=${s##*/}
+ # strip directory by removing largest .*/ prefix
+ s=${s##*/}
- # strip suffix if necessary
- if [ -n "$2" ]; then
- s=${s%"$2"}
- fi
+ # strip suffix if necessary
+ if [ -n "$2" ]; then
+ s=${s%"$2"}
+ fi
- echo $s
+ echo $s
}
#--- getnetmods()
@@ -341,25 +344,25 @@ ## @Global NETMODSMENU: array of id
## @External modprobe, sed
#---
function getnetmods() {
- # only run once
- if [ -n "$GOTNETMODS" ]; then
- return
- fi
-
- local id
- local modname
-
- unset NETMODSMENU NETMODS
- id=0
- for modname in $( modprobe -l \
- | sed -n '/\/net\// { s!.*/!!; s!\..*!!; p; }' |
sort); do
- NETMODSMENU[$id]="${id} ${modname}"
- NETMODS[$id]="${modname}"
- id=$((id+1))
- done
- GOTNETMODS=1
-
- return
+ # only run once
+ if [ -n "$GOTNETMODS" ]; then
+ return
+ fi
+
+ local id
+ local modname
+
+ unset NETMODSMENU NETMODS
+ id=0
+ for modname in $( modprobe -l \
+ | sed -n '/\/net\// { s!.*/!!; s!\..*!!; p; }' | sort); do
+ NETMODSMENU[$id]="${id} ${modname}"
+ NETMODS[$id]="${modname}"
+ id=$((id+1))
+ done
+ GOTNETMODS=1
+
+ return
}
#--- getnetdevs()
@@ -376,30 +379,30 @@ ## @Global NETDEVDIR: path to netwo
## @External rm
#---
function getnetdevs() {
- # only run if necessary (on start, add or remove)
- if [ -n "$GOTNETDEVS" ]; then
- return 0;
- fi
-
- # remove the unused lo.dev file if it exists
- if [ -e ${NETDEVDIR}/lo.dev ]; then
- rm -f ${NETDEVDIR}/lo.dev >> /dev/null
- fi
-
- local id
- local i
-
- unset NETDEVSMENU NETDEVS
- id=0
- for i in $NETDEVDIR/*.dev; do
- if [ "$i" = "$NETDEVDIR/*.dev" ] ; then
- break
- fi
- NETDEVSMENU[$id]="${id} `get_basename $i .dev`"
- NETDEVS[$id]="${i}"
- id=$((id+1))
- done
- GOTNETDEVS=1
+ # only run if necessary (on start, add or remove)
+ if [ -n "$GOTNETDEVS" ]; then
+ return 0;
+ fi
+
+ # remove the unused lo.dev file if it exists
+ if [ -e ${NETDEVDIR}/lo.dev ]; then
+ rm -f ${NETDEVDIR}/lo.dev >> /dev/null
+ fi
+
+ local id
+ local i
+
+ unset NETDEVSMENU NETDEVS
+ id=0
+ for i in $NETDEVDIR/*.dev; do
+ if [ "$i" = "$NETDEVDIR/*.dev" ] ; then
+ break
+ fi
+ NETDEVSMENU[$id]="${id} `get_basename $i .dev`"
+ NETDEVS[$id]="${i}"
+ id=$((id+1))
+ done
+ GOTNETDEVS=1
}
#--- cfg_ns()
@@ -416,35 +419,35 @@ ## @External dialog
##
#---
function cfg_ns() {
- if [ -z "$1" ]; then
- echo "Error: cfg_ns() called with no parameter"
- exit 1
- fi
-
- local ns
- case $1 in
- '1') ns=$ns1 ;;
- '2') ns=$ns2 ;;
- '3') ns=$ns3 ;;
- *) ns="" ;;
- esac
-
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Configure Nameserver $1" \
- --ok-label "$BTN_ACCEPT" \
- --cancel-label "$BTN_CANCEL" \
- --inputbox \
- "Enter the IP address of nameserver $1:" \
- 0 0 $ns`
-
- if [ $? -eq 0 ]; then
- case $1 in
- '1') ns1=$COMMAND ;;
- '2') ns2=$COMMAND ;;
- '3') ns3=$COMMAND ;;
- esac
- fi
+ if [ -z "$1" ]; then
+ echo "Error: cfg_ns() called with no parameter"
+ exit 1
+ fi
+
+ local ns
+ case $1 in
+ '1') ns=$ns1 ;;
+ '2') ns=$ns2 ;;
+ '3') ns=$ns3 ;;
+ *) ns="" ;;
+ esac
+
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Configure Nameserver $1" \
+ --ok-label "$BTN_ACCEPT" \
+ --cancel-label "$BTN_CANCEL" \
+ --inputbox \
+ "Enter the IP address of nameserver $1:" \
+ 0 0 $ns`
+
+ if [ $? -eq 0 ]; then
+ case $1 in
+ '1') ns1=$COMMAND ;;
+ '2') ns2=$COMMAND ;;
+ '3') ns3=$COMMAND ;;
+ esac
+ fi
}
@@ -465,73 +468,73 @@ ## @External dialog, grep, sed, mv, r
#---
function cfg_dns() {
- local i
- unset ns1
- unset ns2
- unset ns3
-
- if [ ! -f "$RESOLVFN" ]; then
- touch $RESOLVFN
- fi
-
- # find the current nameservers
- for i in `grep ^nameserver $RESOLVFN | sed 's/^nameserver //'`; do
- if [ -z "$ns1" ]; then
- echo "ns1=$i" >> /tmp/foo
- ns1="$i"
- elif [ -z "$ns2" ]; then
- echo "ns2=$i" >> /tmp/foo
- ns2="$i"
- elif [ -z "$ns3" ]; then
- echo "ns3=$i" >> /tmp/foo
- ns3="$i"
- else
- break;
- fi
- done
-
- while [ true ]; do
-
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Configure DNS" \
- --ok-label "$BTN_SELECT" \
- --cancel-label "$BTN_CANCEL" \
- --menu \
- "Choose a name server to modify." \
- 0 0 0 \
- "1" "$ns1" \
- "2" "$ns2" \
- "3" "$ns3" \
- "Save" "Save changes to $RESOLVFN"`
-
- if [ $? != 0 ]; then
- return 0
- fi
-
- case $COMMAND in
- '1') cfg_ns "1" ;;
- '2') cfg_ns "2" ;;
- '3') cfg_ns "3" ;;
-
- 'Save')
- mv $RESOLVFN /tmp/resolv.conf.$$
- grep -v ^nameserver /tmp/resolv.conf.$$ >
$RESOLVFN
- if [ ${#ns1} -gt 0 ]; then
- echo "nameserver $ns1" >> $RESOLVFN
- fi
- if [ ${#ns2} -gt 0 ]; then
- echo "nameserver $ns2" >> $RESOLVFN
- fi
- if [ ${#ns3} -gt 0 ]; then
- echo "nameserver $ns3" >> $RESOLVFN
- fi
- rm /tmp/resolv.conf.$$
- return 0
- ;;
- esac
-
- done
+ local i
+ unset ns1
+ unset ns2
+ unset ns3
+
+ if [ ! -f "$RESOLVFN" ]; then
+ touch $RESOLVFN
+ fi
+
+ # find the current nameservers
+ for i in `grep ^nameserver $RESOLVFN | sed 's/^nameserver //'`; do
+ if [ -z "$ns1" ]; then
+ echo "ns1=$i" >> /tmp/foo
+ ns1="$i"
+ elif [ -z "$ns2" ]; then
+ echo "ns2=$i" >> /tmp/foo
+ ns2="$i"
+ elif [ -z "$ns3" ]; then
+ echo "ns3=$i" >> /tmp/foo
+ ns3="$i"
+ else
+ break;
+ fi
+ done
+
+ while [ true ]; do
+
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Configure DNS" \
+ --ok-label "$BTN_SELECT" \
+ --cancel-label "$BTN_CANCEL" \
+ --menu \
+ "Choose a name server to modify." \
+ 0 0 0 \
+ "1" "$ns1" \
+ "2" "$ns2" \
+ "3" "$ns3" \
+ "Save" "Save changes to $RESOLVFN"`
+
+ if [ $? != 0 ]; then
+ return 0
+ fi
+
+ case $COMMAND in
+ '1') cfg_ns "1" ;;
+ '2') cfg_ns "2" ;;
+ '3') cfg_ns "3" ;;
+
+ 'Save')
+ mv $RESOLVFN /tmp/resolv.conf.$$
+ grep -v ^nameserver /tmp/resolv.conf.$$ > $RESOLVFN
+ if [ ${#ns1} -gt 0 ]; then
+ echo "nameserver $ns1" >> $RESOLVFN
+ fi
+ if [ ${#ns2} -gt 0 ]; then
+ echo "nameserver $ns2" >> $RESOLVFN
+ fi
+ if [ ${#ns3} -gt 0 ]; then
+ echo "nameserver $ns3" >> $RESOLVFN
+ fi
+ rm /tmp/resolv.conf.$$
+ return 0
+ ;;
+ esac
+
+ done
}
@@ -546,10 +549,10 @@ ## @Global HOSTNAMEFN: path to host
#---
function check_hostname() {
- # check if HOSTNAMEFN exists
- if [ ! -f "$HOSTNAMEFN" ]; then
- cfg_hostname
- fi
+ # check if HOSTNAMEFN exists
+ if [ ! -f "$HOSTNAMEFN" ]; then
+ cfg_hostname
+ fi
- if [ ! -f "$HOSTSFN" ]; then
- cat > $HOSTSFN << EOF
+ if [ ! -f "$HOSTSFN" ]; then
+ cat > $HOSTSFN << EOF
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
@@ -712,13 +715,13 @@ # "named" name server. Ju
# and any aliases to this file...
#
EOF
- fi
+ fi
- # check if NETDEVDIR exists
- if [ ! -e $NETDEVDIR ]; then
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Create Directory" \
- --yesno \
- "The network configuration directory (${NETDEVDIR})
does not exist, create it now?" \
- 0 0`
-
- if [ $? != 0 ]; then
- echo "Error: Directory '${NETDEVDIR}' does not exist"
- exit 1
- fi
-
- mkdir -p $NETDEVDIR
-
- if [ $? != 0 ]; then
- echo "Error: Could not create directory
'${NETDEVDIR}'"
- exit 1
- fi
-
- return 0
- fi
-
- # check if NETDEVDIR is a directory
- if [ ! -d $NETDEVDIR ]; then
- echo "Error: '${NETDEVDIR}' exists, but is not a directory"
- exit 1
- fi
-
- # check if NETDEVDIR is writable
- if [ ! -w $NETDEVDIR ]; then
- echo "Error: '${NETDEVDIR}' is not writeable"
- exit 1
- fi
+ # check if NETDEVDIR exists
+ if [ ! -e $NETDEVDIR ]; then
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Create Directory" \
+ --yesno \
+ "The network configuration directory (${NETDEVDIR}) does
not exist, create it now?" \
+ 0 0`
+
+ if [ $? != 0 ]; then
+ echo "Error: Directory '${NETDEVDIR}' does not exist"
+ exit 1
+ fi
+
+ mkdir -p $NETDEVDIR
+
+ if [ $? != 0 ]; then
+ echo "Error: Could not create directory '${NETDEVDIR}'"
+ exit 1
+ fi
+
+ return 0
+ fi
+
+ # check if NETDEVDIR is a directory
+ if [ ! -d $NETDEVDIR ]; then
+ echo "Error: '${NETDEVDIR}' exists, but is not a directory"
+ exit 1
+ fi
+
+ # check if NETDEVDIR is writable
+ if [ ! -w $NETDEVDIR ]; then
+ echo "Error: '${NETDEVDIR}' is not writeable"
+ exit 1
+ fi
}
@@ -802,30 +805,30 @@ ## @Global UP_ON_BOOT: 'no' if device
## @Global NEEDS: specifies on which device this device depends
#---
function loadnetdev() {
- if [ -z "$1" ]; then
- echo "Error: loadnetdev() called with no parameter"
- exit 1
- fi
+ if [ -z "$1" ]; then
+ echo "Error: loadnetdev() called with no parameter"
+ exit 1
+ fi
- local devname
+ local devname
- unset MODULE MODE IP BROADCAST NETMASK GATEWAY POINTOPOINT MTU \
+ unset MODULE MODE IP BROADCAST NETMASK GATEWAY POINTOPOINT MTU \
WIFI_NWID WIFI_ESSID WIFI_RATE WIFI_MODE WIFI_SECMODE \
WIFI_KEY WIFI_KEY1 WIFI_KEY2 WIFI_KEY3 WIFI_KEY4
WIFI_DEFAULTKEY \
DEVICE_MAC MAC CUSTOM UP_ON_BOOT NEEDS
- if [ -e $1 ]; then
- # file exists, load it
- source $1
- else
- # new device, set defaults
- MODE='dynamic_set_hostname'
- POINTOPOINT=''
- MTU=''
- UP_ON_BOOT='yes'
- fi
+ if [ -e $1 ]; then
+ # file exists, load it
+ source $1
+ else
+ # new device, set defaults
+ MODE='dynamic_set_hostname'
+ POINTOPOINT=''
+ MTU=''
+ UP_ON_BOOT='yes'
+ fi
}
#--- cfg_module_enter()
@@ -836,19 +839,19 @@ ## @Global MODULE: kernel module or b
## @External dialog
#---
function cfg_module_enter() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure MODULE"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the name of the kernel module which your
device uses, without the trailing \".o\"." \
- 0 0 $MODULE`
-
- if [ $? -eq 0 ]; then
- MODULE=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure MODULE"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the name of the kernel module which your device
uses, without the trailing \".o\"." \
+ 0 0 $MODULE`
+
+ if [ $? -eq 0 ]; then
+ MODULE=$COMMAND
+ fi
+ return 0
}
#--- cfg_module_choose()
@@ -860,105 +863,105 @@ ## @Global MODULE: kernel module or b
## @External dialog
#---
function cfg_module_choose() {
- getnetmods
-
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure MODULE"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --menu
\
- "Select the network module from the following list,
or choose 'Enter' if the module is not shown." \
- 0 0 0
\
- ${NETMODSMENU[*]}
\
- "Enter" "Enter a module name"`
-
-
- if [ $? != 0 ]; then
- return 0
- fi
-
- case $COMMAND in
- 'Enter') cfg_module_enter ;;
- *) MODULE=${NETMODS[${COMMAND}]} ;;
- esac
- return 0
+ getnetmods
+
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure MODULE"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --menu
\
+ "Select the network module from the following list, or
choose 'Enter' if the module is not shown." \
+ 0 0 0
\
+ ${NETMODSMENU[*]}
\
+ "Enter" "Enter a module name"`
+
+
+ if [ $? != 0 ]; then
+ return 0
+ fi
+
+ case $COMMAND in
+ 'Enter') cfg_module_enter ;;
+ *) MODULE=${NETMODS[${COMMAND}]} ;;
+ esac
+ return 0
}
#--- cfg_module()
##
## Prompts user for MODULE setting. Three options are presented:
## <ul>
-## <li>Enter a module name</li>
-## <li>Choose from a list of available network modules</li>
-## <li>None (use static driver)</li>
+## <li>Enter a module name</li>
+## <li>Choose from a list of available network modules</li>
+## <li>None (use static driver)</li>
## </ul>
##
## @Global MODULE: kernel module or blank for static driver
## @External dialog
#---
function cfg_module() {
- if [ -z "$MODULE" ]; then
- dmodule="None (use static driver)"
- else
- dmodule=$MODULE
- fi
-
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure MODULE"
\
- --ok-label "$BTN_SELECT"
\
- --cancel-label "$BTN_BACK"
\
- --menu
\
- "Choose how to select the kernel module. Select
'None' if the driver is compiled into the kernel, or select '$BTN_BACK' to
keep the current setting. [${dmodule}]" \
- 0 0 0
\
- "Enter" "Enter a module name"
\
- "Choose" "Choose from a list of available network
modules"\
- "None" "Use a static driver"`
-
- if [ $? != 0 ]; then
- return 0
- fi
-
- case $COMMAND in
- 'Enter') cfg_module_enter ;;
- 'Choose') cfg_module_choose ;;
- 'None') MODULE='' ;;
- esac
- return 0
+ if [ -z "$MODULE" ]; then
+ dmodule="None (use static driver)"
+ else
+ dmodule=$MODULE
+ fi
+
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure MODULE"
\
+ --ok-label "$BTN_SELECT"
\
+ --cancel-label "$BTN_BACK"
\
+ --menu
\
+ "Choose how to select the kernel module. Select 'None' if
the driver is compiled into the kernel, or select '$BTN_BACK' to keep the
current setting. [${dmodule}]" \
+ 0 0 0
\
+ "Enter" "Enter a module name"
\
+ "Choose" "Choose from a list of available network
modules"\
+ "None" "Use a static driver"`
+
+ if [ $? != 0 ]; then
+ return 0
+ fi
+
+ case $COMMAND in
+ 'Enter') cfg_module_enter ;;
+ 'Choose') cfg_module_choose ;;
+ 'None') MODULE='' ;;
+ esac
+ return 0
}
#--- cfg_mode()
##
## Prompts user for MODE setting. Two options are presented:
## <ul>
-## <li>dynamic (use dhcp)</li>
-## <li>static (specify network settings)</li>
+## <li>dynamic (use dhcp)</li>
+## <li>static (specify network settings)</li>
## </ul>
##
## @Global MODE: 'dynamic' for dhcp, or 'static' for static
## @External dialog
#---
function cfg_mode() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure MODE"
\
- --ok-label "$BTN_SELECT"
\
- --cancel-label "$BTN_BACK"
\
- --menu
\
- "Choose which mode this network device uses. Select
'dynamic_set_hostname' to use dhcp with your own hostname,
'dynamic_get_hostname' to set the hostname provided by the DHCP server, or
'static' to specify IP, BROADCAST, NETMASK, and GATEWAY. Select '${BTN_BACK}'
to keep current setting. [${MODE}]" \
- 0 0 0
\
- "dynamic_set_hostname" "use dhcp"
\
- "dynamic_get_hostname" "use dhcp"
\
- "static" "specify network settings"`
-
- if [ $? != 0 ]; then
- return 0
- fi
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure MODE"
\
+ --ok-label "$BTN_SELECT"
\
+ --cancel-label "$BTN_BACK"
\
+ --menu
\
+ "Choose which mode this network device uses. Select
'dynamic_set_hostname' to use dhcp with your own hostname,
'dynamic_get_hostname' to set the hostname provided by the DHCP server, or
'static' to specify IP, BROADCAST, NETMASK, and GATEWAY. Select '${BTN_BACK}'
to keep current setting. [${MODE}]" \
+ 0 0 0
\
+ "dynamic_set_hostname" "use dhcp"
\
+ "dynamic_get_hostname" "use dhcp"
\
+ "static" "specify network settings"`
+
+ if [ $? != 0 ]; then
+ return 0
+ fi
MODE="$COMMAND"
- return 0
+ return 0
}
#--- cfg_ip()
@@ -969,19 +972,19 @@ ## @Global IP: ip address
## @External dialog
#---
function cfg_ip() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure IP address"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the IP address for this network device"
\
- 0 0 $IP`
-
- if [ $? -eq 0 ]; then
- IP=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure IP address"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the IP address for this network device"
\
+ 0 0 $IP`
+
+ if [ $? -eq 0 ]; then
+ IP=$COMMAND
+ fi
+ return 0
}
@@ -993,19 +996,19 @@ ## @Global BROADCAST: broadcast addre
## @External dialog
#---
function cfg_broadcast() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure BROADCAST address"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the broadcast address for this network
device" \
- 0 0 $BROADCAST`
-
- if [ $? -eq 0 ]; then
- BROADCAST=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure BROADCAST address"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the broadcast address for this network device"
\
+ 0 0 $BROADCAST`
+
+ if [ $? -eq 0 ]; then
+ BROADCAST=$COMMAND
+ fi
+ return 0
}
@@ -1017,19 +1020,19 @@ ## @Global NETMASK: netmask
## @External dialog
#---
function cfg_netmask() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure NETMASK"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the netmask for this network device"
\
- 0 0 $NETMASK`
-
- if [ $? -eq 0 ]; then
- NETMASK=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure NETMASK"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the netmask for this network device"
\
+ 0 0 $NETMASK`
+
+ if [ $? -eq 0 ]; then
+ NETMASK=$COMMAND
+ fi
+ return 0
}
@@ -1041,19 +1044,19 @@ ## @Global GATEWAY: gateway address
## @External dialog
#---
function cfg_gateway() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure GATEWAY address"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the gateway address for this network device"
\
- 0 0 $GATEWAY`
-
- if [ $? -eq 0 ]; then
- GATEWAY=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure GATEWAY address"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the gateway address for this network device"
\
+ 0 0 $GATEWAY`
+
+ if [ $? -eq 0 ]; then
+ GATEWAY=$COMMAND
+ fi
+ return 0
}
#--- cfg_pointopoint()
@@ -1064,19 +1067,19 @@ ## @Global POINTTOPOINT: point to poi
## @External dialog
#---
function cfg_pointopoint() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure POINTOPOINT address"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the point to point address for this network
device."\
- 0 0 $POINTOPOINT`
-
- if [ $? -eq 0 ]; then
- POINTOPOINT=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure POINTOPOINT address"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the point to point address for this network
device."\
+ 0 0 $POINTOPOINT`
+
+ if [ $? -eq 0 ]; then
+ POINTOPOINT=$COMMAND
+ fi
+ return 0
}
#--- cfg_mtu()
@@ -1087,19 +1090,19 @@ ## @Global MTU: maximum transfer unit
## @External dialog
#---
function cfg_mtu() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Configure MTU"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the maximum transfer unit for this network
device." \
- 0 0 $MTU`
-
- if [ $? -eq 0 ]; then
- MTU=$COMMAND
- fi
- return 0
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Configure MTU"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the maximum transfer unit for this network
device." \
+ 0 0 $MTU`
+
+ if [ $? -eq 0 ]; then
+ MTU=$COMMAND
+ fi
+ return 0
}
@@ -1432,18 +1435,18 @@ ## @Global DEVICE_MAC: native MAC add
## @External dialog
#---
function cfg_device_mac() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Configure device MAC address" \
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Configure device MAC address" \
--ok-label "$BTN_ACCEPT" \
- --cancel-label "$BTN_CANCEL" \
- --inputbox \
- "Enter the device's native MAC address. (Used by
udev for binding interface name to device.)" \
- 0 0 ${DEVICE_MAC}`
-
- if [ $? -eq 0 ]; then
- DEVICE_MAC="${COMMAND}"
- fi
+ --cancel-label "$BTN_CANCEL" \
+ --inputbox \
+ "Enter the device's native MAC address. (Used by udev for
binding interface name to device.)" \
+ 0 0 ${DEVICE_MAC}`
+
+ if [ $? -eq 0 ]; then
+ DEVICE_MAC="${COMMAND}"
+ fi
}
#--- cfg_mac()
@@ -1454,18 +1457,18 @@ ## @Global MAC: new MAC address for t
## @External dialog
#---
function cfg_mac() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Configure MAC address" \
- --ok-label "$BTN_ACCEPT" \
- --cancel-label "$BTN_CANCEL" \
- --inputbox \
- "Enter the MAC address you want this device to use.
(Usually not required, sometimes not even supported.)" \
- 0 0 ${MAC}`
-
- if [ $? -eq 0 ]; then
- MAC="${COMMAND}"
- fi
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Configure MAC address" \
+ --ok-label "$BTN_ACCEPT" \
+ --cancel-label "$BTN_CANCEL" \
+ --inputbox \
+ "Enter the MAC address you want this device to use.
(Usually not required, sometimes not even supported.)" \
+ 0 0 ${MAC}`
+
+ if [ $? -eq 0 ]; then
+ MAC="${COMMAND}"
+ fi
}
@@ -1501,18 +1504,18 @@ ## @Global CUSTOM: any custom options
## @External dialog
#---
function cfg_custom() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Configure custom options" \
- --ok-label "$BTN_ACCEPT" \
- --cancel-label "$BTN_CANCEL" \
- --inputbox \
- "Enter the custom options you need for this device.
Everything you enter here is passed straight to ifconfig. (Please file a bug
to get missing options added.)" \
- 0 0 "${CUSTOM}"`
-
- if [ $? -eq 0 ]; then
- CUSTOM="${COMMAND}"
- fi
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Configure custom options" \
+ --ok-label "$BTN_ACCEPT" \
+ --cancel-label "$BTN_CANCEL" \
+ --inputbox \
+ "Enter the custom options you need for this device.
Everything you enter here is passed straight to ifconfig. (Please file a bug
to get missing options added.)" \
+ 0 0 "${CUSTOM}"`
+
+ if [ $? -eq 0 ]; then
+ CUSTOM="${COMMAND}"
+ fi
}
@@ -1523,13 +1526,13 @@ ##
## @Global UP_ON_BOOT: 'no' if device should not be brought up on boot
#---
function toggle_boot() {
- if [ $UP_ON_BOOT = "no" ]; then
- UP_ON_BOOT="yes"
- else
- UP_ON_BOOT="no"
- fi
+ if [ $UP_ON_BOOT = "no" ]; then
+ UP_ON_BOOT="yes"
+ else
+ UP_ON_BOOT="no"
+ fi
- return 0
+ return 0
}
#--- remove_device()
@@ -1544,33 +1547,33 @@ ## @Global GOTNETDEVS: unset if devic
## @External dialog, rm
#---
function remove_device() {
- if [ -z "$1" ]; then
- echo "Error: remove_device() called with no parameter"
- exit 1
- fi
+ if [ -z "$1" ]; then
+ echo "Error: remove_device() called with no parameter"
+ exit 1
+ fi
- # confirm removal of network device
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Confirm remove device" \
- --yesno \
- "Are you sure you want to remove device file:
${devname}?" \
- 0 0`
+ # confirm removal of network device
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Confirm remove device" \
+ --yesno \
+ "Are you sure you want to remove device file:
${devname}?" \
+ 0 0`
- if [ $? -eq 0 ]; then
- rm -f $1
+ if [ $? -eq 0 ]; then
+ rm -f $1
- # cause getnetdevs() to run to remove device from main menu
- unset GOTNETDEVS devname
-
- return 1 # return 1 to return back to main menu
- fi
+ # cause getnetdevs() to run to remove device from main menu
+ unset GOTNETDEVS devname
+
+ return 1 # return 1 to return back to main menu
+ fi
- return 0
+ return 0
}
#--- confirm_save()
@@ -1586,31 +1589,31 @@ ## @Global GOTNETDEVS: unset if devic
## @External dialog
#---
function confirm_save() {
- if [ -z "$1" ]; then
- echo "Error: confirm_save() called with no parameter"
- exit 1
- fi
-
- local devname
- devname=$(get_basename $1)
-
- COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
- --stdout \
- --title "Confirm save device" \
- --yesno \
- "Are you sure you want to save device file:
${devname}?" \
- 0 0`
-
- if [ $? -eq 0 ]; then
- if [ -e $1 ]; then
- save_update $1
- else
- save_new $1
- fi
- return 1 # return 1 to return back to main menu
- fi
-
- return 0
+ if [ -z "$1" ]; then
+ echo "Error: confirm_save() called with no parameter"
+ exit 1
+ fi
+
+ local devname
+ devname=$(get_basename $1)
+
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Confirm save device" \
+ --yesno \
+ "Are you sure you want to save device file: ${devname}?" \
+ 0 0`
+
+ if [ $? -eq 0 ]; then
+ if [ -e $1 ]; then
+ save_update $1
+ else
+ save_new $1
+ fi
+ return 1 # return 1 to return back to main menu
+ fi
+
+ return 0
}
@@ -1648,14 +1651,14 @@ ## @Global NEEDS: specifies on which
## @External cat, date
#---
function save_new() {
- if [ -z "$1" ]; then
- echo "Error: save_new() called with no parameter"
- exit 1
- fi
-
- local now
- now=`date`
- cat > $1 << EOF
+ if [ -z "$1" ]; then
+ echo "Error: save_new() called with no parameter"
+ exit 1
+ fi
+
+ local now
+ now=`date`
+ cat > $1 << EOF
# $devname configuration
# created by: ${BACKTITLE}
# created on: $now
@@ -1671,51 +1674,51 @@ MTU=${MTU}
UP_ON_BOOT=${UP_ON_BOOT}
EOF
- if [ ! -z ${WIFI_NWID} ]; then
- echo "WIFI_NWID='${WIFI_NWID}'" >> $1
- fi
- if [ ! -z ${WIFI_ESSID} ]; then
- echo "WIFI_ESSID='${WIFI_ESSID}'" >> $1
- fi
- if [ ! -z ${WIFI_RATE} ]; then
- echo "WIFI_RATE=${WIFI_RATE}" >> $1
- fi
- if [ ! -z ${WIFI_MODE} ]; then
- echo "WIFI_MODE=${WIFI_MODE}" >> $1
- fi
- if [ ! -z ${WIFI_SECMODE} ]; then
- echo "WIFI_SECMODE=${WIFI_SECMODE}" >> $1
- fi
- if [ ! -z $WIFI_KEY ]; then
- echo "WIFI_KEY=$WIFI_KEY" >> $1
- fi
- if [ ! -z $WIFI_KEY1 ]; then
- echo "WIFI_KEY1=${WIFI_KEY1}" >> $1
- fi
- if [ ! -z $WIFI_KEY2 ]; then
- echo "WIFI_KEY2=${WIFI_KEY2}" >> $1
- fi
- if [ ! -z $WIFI_KEY3 ]; then
- echo "WIFI_KEY3=${WIFI_KEY3}" >> $1
- fi
- if [ ! -z $WIFI_KEY4 ]; then
- echo "WIFI_KEY4=${WIFI_KEY4}" >> $1
- fi
- if [ ! -z $WIFI_DEFAULTKEY ]; then
- echo "WIFI_DEFAULTKEY=$WIFI_DEFAULTKEY" >> $1
- fi
- if [ ! -z ${DEVICE_MAC} ]; then
- echo "DEVICE_MAC='${DEVICE_MAC}'" >> $1
- fi
- if [ ! -z ${MAC} ]; then
- echo "MAC='${MAC}'" >> $1
- fi
- if [ ! -z "${CUSTOM}" ]; then
- echo "CUSTOM='${CUSTOM}'" >> $1
- fi
+ if [ ! -z ${WIFI_NWID} ]; then
+ echo "WIFI_NWID='${WIFI_NWID}'" >> $1
+ fi
+ if [ ! -z ${WIFI_ESSID} ]; then
+ echo "WIFI_ESSID='${WIFI_ESSID}'" >> $1
+ fi
+ if [ ! -z ${WIFI_RATE} ]; then
+ echo "WIFI_RATE=${WIFI_RATE}" >> $1
+ fi
+ if [ ! -z ${WIFI_MODE} ]; then
+ echo "WIFI_MODE=${WIFI_MODE}" >> $1
+ fi
+ if [ ! -z ${WIFI_SECMODE} ]; then
+ echo "WIFI_SECMODE=${WIFI_SECMODE}" >> $1
+ fi
+ if [ ! -z $WIFI_KEY ]; then
+ echo "WIFI_KEY=$WIFI_KEY" >> $1
+ fi
+ if [ ! -z $WIFI_KEY1 ]; then
+ echo "WIFI_KEY1=${WIFI_KEY1}" >> $1
+ fi
+ if [ ! -z $WIFI_KEY2 ]; then
+ echo "WIFI_KEY2=${WIFI_KEY2}" >> $1
+ fi
+ if [ ! -z $WIFI_KEY3 ]; then
+ echo "WIFI_KEY3=${WIFI_KEY3}" >> $1
+ fi
+ if [ ! -z $WIFI_KEY4 ]; then
+ echo "WIFI_KEY4=${WIFI_KEY4}" >> $1
+ fi
+ if [ ! -z $WIFI_DEFAULTKEY ]; then
+ echo "WIFI_DEFAULTKEY=$WIFI_DEFAULTKEY" >> $1
+ fi
+ if [ ! -z ${DEVICE_MAC} ]; then
+ echo "DEVICE_MAC='${DEVICE_MAC}'" >> $1
+ fi
+ if [ ! -z ${MAC} ]; then
+ echo "MAC='${MAC}'" >> $1
+ fi
+ if [ ! -z "${CUSTOM}" ]; then
+ echo "CUSTOM='${CUSTOM}'" >> $1
+ fi
if [ ! -z "$NEEDS" ]; then
- echo "NEEDS='${NEEDS}'" >> $1
- fi
+ echo "NEEDS='${NEEDS}'" >> $1
+ fi
}
#--- save_update()
@@ -1757,108 +1760,108 @@ ## @Global NEEDS: specifies on which
## @External date
#---
function save_update() {
- if [ -z "$1" ]; then
- echo "Error: save_update() called with no parameter"
- exit 1
- fi
-
- if [ ! -e $1 ]; then
- echo "Error: save_update() device file does not exist: $1"
- exit 1
- fi
-
- cat_or_sedit "^# created by:.*" "# created by: ${BACKTITLE}" $1
- cat_or_sedit "^# last modified:.*" "# last modified: `date`" $1
- cat_or_sedit "^MODULE=.*" "MODULE=${MODULE}" $1
- cat_or_sedit "^MODE=.*" "MODE=${MODE}" $1
- cat_or_sedit "^IP=.*" "IP=${IP}" $1
- cat_or_sedit "^BROADCAST=.*" "BROADCAST=${BROADCAST}" $1
- cat_or_sedit "^NETMASK=.*" "NETMASK=${NETMASK}" $1
- cat_or_sedit "^GATEWAY=.*" "GATEWAY=${GATEWAY}" $1
- cat_or_sedit "^POINTOPOINT=.*" "POINTOPOINT=${POINTOPOINT}" $1
- cat_or_sedit "^MTU=.*" "MTU=${MTU}" $1
- if [ ! -z ${WIFI_NWID} ]; then
- cat_or_sedit "^WIFI_NWID=.*" "WIFI_NWID='${WIFI_NWID}'" $1
- else
- sed -i '/^WIFI_NWID=.*/d' $1
- fi
- if [ ! -z ${WIFI_ESSID} ]; then
- cat_or_sedit "^WIFI_ESSID=.*" "WIFI_ESSID='${WIFI_ESSID}'" $1
- else
- sed -i '/^WIFI_ESSID=.*/d' $1
- fi
- if [ ! -z ${WIFI_RATE} ]; then
- cat_or_sedit "^WIFI_RATE=.*" "WIFI_RATE=${WIFI_RATE}" $1
- else
- sed -i '/^WIFI_RATE=.*/d' $1
- fi
- if [ ! -z ${WIFI_MODE} ]; then
- cat_or_sedit "^WIFI_MODE=.*" "WIFI_MODE=${WIFI_MODE}" $1
- else
- sed -i '/^WIFI_MODE=.*/d' $1
- fi
- if [ ! -z ${WIFI_SECMODE} ]; then
- cat_or_sedit "^WIFI_SECMODE=.*" "WIFI_SECMODE=${WIFI_SECMODE}" $1
- else
- sed -i '/^WIFI_SECMODE=.*/d' $1
- fi
- if [ ! -z ${WIFI_KEY} ]; then
- cat_or_sedit "^WIFI_KEY=.*" "WIFI_KEY=${WIFI_KEY}" $1
- else
- sed -i '/^WIFI_KEY=.*/d' $1
- fi
- if [ ! -z ${WIFI_KEY1} ]; then
- cat_or_sedit "^WIFI_KEY1=.*" "WIFI_KEY1=${WIFI_KEY1}" $1
- else
- sed -i '/^WIFI_KEY1=.*/d' $1
- fi
- if [ ! -z ${WIFI_KEY2} ]; then
- cat_or_sedit "^WIFI_KEY2=.*" "WIFI_KEY2=${WIFI_KEY2}" $1
- else
- sed -i '/^WIFI_KEY2=.*/d' $1
- fi
- if [ ! -z ${WIFI_KEY3} ]; then
- cat_or_sedit "^WIFI_KEY3=.*" "WIFI_KEY3=${WIFI_KEY3}" $1
- else
- sed -i '/^WIFI_KEY3=.*/d' $1
- fi
- if [ ! -z ${WIFI_KEY4} ]; then
- cat_or_sedit "^WIFI_KEY4=.*" "WIFI_KEY4=${WIFI_KEY4}" $1
- else
- sed -i '/^WIFI_KEY4=.*/d' $1
- fi
- if [ ! -z ${WIFI_DEFAULTKEY} ]; then
- cat_or_sedit "^WIFI_DEFAULTKEY=.*"
"WIFI_DEFAULTKEY=${WIFI_DEFAULTKEY}" $1
- else
- sed -i '/^WIFI_DEFAULTKEY=.*/d' $1
- fi
- if [ ! -z ${DEVICE_MAC} ]; then
- cat_or_sedit "^DEVICE_MAC=.*" "DEVICE_MAC='${DEVICE_MAC}'" $1
- else
- sed -i '/^DEVICE_MAC=.*/d' $1
- fi
- if [ ! -z ${MAC} ]; then
- cat_or_sedit "^MAC=.*" "MAC='${MAC}'" $1
- else
- sed -i '/^MAC=.*/d' $1
- fi
- if [ ! -z "${CUSTOM}" ]; then
- cat_or_sedit "^CUSTOM=.*" "CUSTOM='${CUSTOM}'" $1
- else
- sed -i '/^CUSTOM=.*/d' $1
- fi
-
- cat_or_sedit "^UP_ON_BOOT=.*" "UP_ON_BOOT=${UP_ON_BOOT}" $1
-
- if [ ! -z "${NEEDS}" ]; then
- cat_or_sedit "^NEEDS=.*" "NEEDS='${NEEDS}'" $1
- else
- sed -i '/^NEEDS=.*/d' $1
- fi
-
- # removing leftovers from older netconf versions
- sed -i '/^WIFI=.*/d' $1
- sed -i '/^WIFI_ADVANCED=.*/d' $1
+ if [ -z "$1" ]; then
+ echo "Error: save_update() called with no parameter"
+ exit 1
+ fi
+
+ if [ ! -e $1 ]; then
+ echo "Error: save_update() device file does not exist: $1"
+ exit 1
+ fi
+
+ cat_or_sedit "^# created by:.*" "# created by: ${BACKTITLE}" $1
+ cat_or_sedit "^# last modified:.*" "# last modified: `date`" $1
+ cat_or_sedit "^MODULE=.*" "MODULE=${MODULE}" $1
+ cat_or_sedit "^MODE=.*" "MODE=${MODE}" $1
+ cat_or_sedit "^IP=.*" "IP=${IP}" $1
+ cat_or_sedit "^BROADCAST=.*" "BROADCAST=${BROADCAST}" $1
+ cat_or_sedit "^NETMASK=.*" "NETMASK=${NETMASK}" $1
+ cat_or_sedit "^GATEWAY=.*" "GATEWAY=${GATEWAY}" $1
+ cat_or_sedit "^POINTOPOINT=.*" "POINTOPOINT=${POINTOPOINT}" $1
+ cat_or_sedit "^MTU=.*" "MTU=${MTU}" $1
+ if [ ! -z ${WIFI_NWID} ]; then
+ cat_or_sedit "^WIFI_NWID=.*" "WIFI_NWID='${WIFI_NWID}'" $1
+ else
+ sed -i '/^WIFI_NWID=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_ESSID} ]; then
+ cat_or_sedit "^WIFI_ESSID=.*" "WIFI_ESSID='${WIFI_ESSID}'" $1
+ else
+ sed -i '/^WIFI_ESSID=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_RATE} ]; then
+ cat_or_sedit "^WIFI_RATE=.*" "WIFI_RATE=${WIFI_RATE}" $1
+ else
+ sed -i '/^WIFI_RATE=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_MODE} ]; then
+ cat_or_sedit "^WIFI_MODE=.*" "WIFI_MODE=${WIFI_MODE}" $1
+ else
+ sed -i '/^WIFI_MODE=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_SECMODE} ]; then
+ cat_or_sedit "^WIFI_SECMODE=.*" "WIFI_SECMODE=${WIFI_SECMODE}" $1
+ else
+ sed -i '/^WIFI_SECMODE=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_KEY} ]; then
+ cat_or_sedit "^WIFI_KEY=.*" "WIFI_KEY=${WIFI_KEY}" $1
+ else
+ sed -i '/^WIFI_KEY=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_KEY1} ]; then
+ cat_or_sedit "^WIFI_KEY1=.*" "WIFI_KEY1=${WIFI_KEY1}" $1
+ else
+ sed -i '/^WIFI_KEY1=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_KEY2} ]; then
+ cat_or_sedit "^WIFI_KEY2=.*" "WIFI_KEY2=${WIFI_KEY2}" $1
+ else
+ sed -i '/^WIFI_KEY2=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_KEY3} ]; then
+ cat_or_sedit "^WIFI_KEY3=.*" "WIFI_KEY3=${WIFI_KEY3}" $1
+ else
+ sed -i '/^WIFI_KEY3=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_KEY4} ]; then
+ cat_or_sedit "^WIFI_KEY4=.*" "WIFI_KEY4=${WIFI_KEY4}" $1
+ else
+ sed -i '/^WIFI_KEY4=.*/d' $1
+ fi
+ if [ ! -z ${WIFI_DEFAULTKEY} ]; then
+ cat_or_sedit "^WIFI_DEFAULTKEY=.*" "WIFI_DEFAULTKEY=${WIFI_DEFAULTKEY}"
$1
+ else
+ sed -i '/^WIFI_DEFAULTKEY=.*/d' $1
+ fi
+ if [ ! -z ${DEVICE_MAC} ]; then
+ cat_or_sedit "^DEVICE_MAC=.*" "DEVICE_MAC='${DEVICE_MAC}'" $1
+ else
+ sed -i '/^DEVICE_MAC=.*/d' $1
+ fi
+ if [ ! -z ${MAC} ]; then
+ cat_or_sedit "^MAC=.*" "MAC='${MAC}'" $1
+ else
+ sed -i '/^MAC=.*/d' $1
+ fi
+ if [ ! -z "${CUSTOM}" ]; then
+ cat_or_sedit "^CUSTOM=.*" "CUSTOM='${CUSTOM}'" $1
+ else
+ sed -i '/^CUSTOM=.*/d' $1
+ fi
+
+ cat_or_sedit "^UP_ON_BOOT=.*" "UP_ON_BOOT=${UP_ON_BOOT}" $1
+
+ if [ ! -z "${NEEDS}" ]; then
+ cat_or_sedit "^NEEDS=.*" "NEEDS='${NEEDS}'" $1
+ else
+ sed -i '/^NEEDS=.*/d' $1
+ fi
+
+ # removing leftovers from older netconf versions
+ sed -i '/^WIFI=.*/d' $1
+ sed -i '/^WIFI_ADVANCED=.*/d' $1
}
@@ -1873,11 +1876,11 @@ ## @param absolute path to network d
## @External grep, cat
#---
function cat_or_sedit() {
- if ( cat $3 | grep -q "$1" ); then
- sed -i "s/${1}/${2}/" ${3}
- else
- echo "$2" >> ${3}
- fi
+ if ( cat $3 | grep -q "$1" ); then
+ sed -i "s/${1}/${2}/" ${3}
+ else
+ echo "$2" >> ${3}
+ fi
}
#--- add_device()
@@ -1891,29 +1894,29 @@ ## @Global GOTNETDEVS: unset if dev
## @External dialog
#---
function add_device() {
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Add new network device"
\
- --ok-label "$BTN_ACCEPT"
\
- --cancel-label "$BTN_CANCEL"
\
- --inputbox
\
- "Enter the name for this device. (Examples: eth0,
plip1.)" \
- 0 0`
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
+ --stdout
\
+ --title "Add new network device"
\
+ --ok-label "$BTN_ACCEPT"
\
+ --cancel-label "$BTN_CANCEL"
\
+ --inputbox
\
+ "Enter the name for this device. (Examples: eth0,
plip1.)" \
+ 0 0`
- if [ $? != 0 ]; then
- return 0
- fi
+ if [ $? != 0 ]; then
+ return 0
+ fi
- if [ -z "$COMMAND" ]; then
- return 0
- fi
+ if [ -z "$COMMAND" ]; then
+ return 0
+ fi
- parse_args $*
- check_hostname
- check_devdir
-
- local curhostname
- unset GOTNETMODS GOTNETDEVS
-
- true
- while [ $? -eq 0 ]; do
-
- getnetdevs
-
- curhostname=`cat $HOSTNAMEFN`
-
- COMMAND=`$DIALOG --backtitle "$BACKTITLE"
\
- --stdout
\
- --title "Add, modify, remove network
devices" \
- --ok-label "$BTN_SELECT"
\
- --cancel-label "$BTN_EXIT"
\
- --menu
\
- "Choose a device to modify or remove, or
select 'Add' to add a new device. 'Hostname' will allow you to change the
hostname of this computer." \
- 0 0 0
\
- ${NETDEVSMENU[*]}
\
- "Add" "Add new network device"
\
- "Hostname" "Change hostname (currently:
$curhostname)" \
- "DNS" "Configure DNS servers"`
-
- if [ $? != 0 ]; then
- # Exit
- exit 0
- fi
-
- case $COMMAND in
- 'Add') add_device ;;
- 'Hostname') cfg_hostname ;;
- 'DNS') cfg_dns ;;
- *) cfg_device "${NETDEVS[$COMMAND]}" ;;
- esac
-
- done
+ parse_args $*
+ check_hostname
+ check_devdir
+
+ local curhostname
+ unset GOTNETMODS GOTNETDEVS
+
+ true
+ while [ $? -eq 0 ]; do
+
+ getnetdevs
+
+ curhostname=`cat $HOSTNAMEFN`
+
+ COMMAND=`$DIALOG --backtitle "$BACKTITLE" \
+ --stdout \
+ --title "Add, modify, remove network devices" \
+ --ok-label "$BTN_SELECT" \
+ --cancel-label "$BTN_EXIT" \
+ --menu \
+ "Choose a device to modify or remove, or select 'Add'
to add a new device. 'Hostname' will allow you to change the hostname of this
computer." \
+ 0 0 0 \
+ ${NETDEVSMENU[*]} \
+ "Add" "Add new network device" \
+ "Hostname" "Change hostname (currently: $curhostname)" \
+ "DNS" "Configure DNS servers"`
+
+ if [ $? != 0 ]; then
+ # Exit
+ exit 0
+ fi
+
+ case $COMMAND in
+ 'Add') add_device ;;
+ 'Hostname') cfg_hostname ;;
+ 'DNS') cfg_dns ;;
+ *) cfg_device "${NETDEVS[$COMMAND]}" ;;
+ esac
+
+ done
}
# ------------------------- Entry Point ----------------------------- #
if [ "$ROOTCHECK" -eq 1 ]; then
- if [ "$UID" != 0 ]; then
- echo "Enter the root password, please."
- su -c "$0 $*"
- exit
- fi
+ if [ "$UID" != 0 ]; then
+ echo "Enter the root password, please."
+ su -c "$0 $*"
+ exit
+ fi
fi