summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Gianelloni <wolf31o2@gentoo.org>2005-03-01 18:13:51 +0000
committerChris Gianelloni <wolf31o2@gentoo.org>2005-03-01 18:13:51 +0000
commit01ecddab83f6fb1ec719c68fb6360a6451ca87f8 (patch)
treefe320fdd99ba172c86702b84969da35555e17e33 /net-setup
parentMaking use of a no_gl function, rather than repeating code. (diff)
downloadlivecd-tools-01ecddab83f6fb1ec719c68fb6360a6451ca87f8.tar.gz
livecd-tools-01ecddab83f6fb1ec719c68fb6360a6451ca87f8.tar.bz2
livecd-tools-01ecddab83f6fb1ec719c68fb6360a6451ca87f8.zip
Fixed net-setup and x-setup and also updated headers on all files.
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/livecd-tools/trunk@44 7bf51bff-881f-0410-a643-fba68b97345e
Diffstat (limited to 'net-setup')
-rwxr-xr-xnet-setup70
1 files changed, 36 insertions, 34 deletions
diff --git a/net-setup b/net-setup
index 4df4a28..b48cce0 100755
--- a/net-setup
+++ b/net-setup
@@ -1,6 +1,6 @@
-# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.11 2005/02/24 23:01:52 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.12 2005/03/01 18:13:51 wolf31o2 Exp $
#!/bin/bash
@@ -14,42 +14,44 @@ if [ -z ${1} ]; then
exit 1
fi
+iface=${1}
+
[ ! -d /tmp/setup.opts ] && mkdir /tmp/setup.opts
cd /tmp/setup.opts
config_wireless() {
cd /tmp/setup.opts
- dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${1}.SSID
- SSID=`cat ${1}.SSID`
+ dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${iface}.SSID
+ SSID=`cat ${iface}.SSID`
if [ -n "${SSID}" ]; then
- dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${1}.WEP
- WEP=`cat ${1}.WEP`
+ dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${iface}.WEP
+ WEP=`cat ${iface}.WEP`
case ${WEP} in
1)
- dialog --title "WEP (Part 2)" --menu "Are you entering your WEP key in HEX or ASCII?" 20 60 7 1 "HEX" 2 "ASCII" 2> ${1}.WEPTYPE
- WEP_TYPE=`cat ${1}.WEPTYPE`
+ dialog --title "WEP (Part 2)" --menu "Are you entering your WEP key in HEX or ASCII?" 20 60 7 1 "HEX" 2 "ASCII" 2> ${iface}.WEPTYPE
+ WEP_TYPE=`cat ${iface}.WEPTYPE`
case ${WEP_TYPE} in
1)
- dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${1}.WEPKEY
- WEP_KEY=`cat ${1}.WEPKEY`
+ dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${iface}.WEPKEY
+ WEP_KEY=`cat ${iface}.WEPKEY`
if [ -n "${WEP_KEY}" -a -x /usr/sbin/iwconfig ]; then
- /usr/sbin/iwconfig ${1} essid \"${SSID}\"
- /usr/sbin/iwconfig ${1} key "${WEP_KEY}"
+ /usr/sbin/iwconfig ${iface} essid \"${SSID}\"
+ /usr/sbin/iwconfig ${iface} key "${WEP_KEY}"
fi
;;
2)
- dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form. This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${1}.WEPKEY
- WEP_KEY=`cat ${1}.WEPKEY`
+ dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form. This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${iface}.WEPKEY
+ WEP_KEY=`cat ${iface}.WEPKEY`
if [ -n "${WEP_KEY}" -a -x /usr/sbin/iwconfig ]; then
- /usr/sbin/iwconfig ${1} essid \"${SSID}\"
- /usr/sbin/iwconfig ${1} key s:"${WEP_KEY}"
+ /usr/sbin/iwconfig ${iface} essid \"${SSID}\"
+ /usr/sbin/iwconfig ${iface} key s:"${WEP_KEY}"
fi
;;
esac
;;
2)
- /usr/sbin/iwconfig ${1} essid \"${SSID}\"
- /usr/sbin/iwconfig ${1} key off
+ /usr/sbin/iwconfig ${iface} essid \"${SSID}\"
+ /usr/sbin/iwconfig ${iface} key off
;;
esac
fi
@@ -57,25 +59,25 @@ config_wireless() {
config_ip() {
cd /tmp/setup.opts
- dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${1}.DHCP
- DHCP=`cat ${1}.DHCP`
+ dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${iface}.DHCP
+ DHCP=`cat ${iface}.DHCP`
case ${DHCP} in
1)
- /sbin/dhcpcd -t 10 ${1} &
+ /sbin/dhcpcd -t 10 ${iface} &
;;
2)
- dialog --title "IP address" --inputbox "Please enter an IP address for ${1}:" 20 50 "192.168.1.1" 2> ${1}.IP
- IP=`cat ${1}.IP`
+ dialog --title "IP address" --inputbox "Please enter an IP address for ${iface}:" 20 50 "192.168.1.1" 2> ${1}.IP
+ IP=`cat ${iface}.IP`
BC_TEMP="`echo $IP|cut -d . -f 1`.`echo $IP|cut -d . -f 2`.`echo $IP|cut -d . -f 3`.255"
- dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address for ${1}:" 20 50 "${BC_TEMP}" 2> ${1}.BC
- BROADCAST=`cat ${1}.BC`
- dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${1}:" 20 50 "255.255.255.0" 2> ${1}.NM
- NETMASK=`cat ${1}.NM`
- dialog --title "Gateway" --inputbox "Please enter a Gateway for ${1} (hit enter for none:)" 20 50 2> ${1}.GW
- GATEWAY=`cat ${1}.GW`
- dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${1}.DNS
- DNS=`cat ${1}.DNS`
- /sbin/ifconfig ${1} ${IP} broadcast ${BROADCAST} netmask ${NETMASK}
+ dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address for ${iface}:" 20 50 "${BC_TEMP}" 2> ${1}.BC
+ BROADCAST=`cat ${iface}.BC`
+ dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${iface}:" 20 50 "255.255.255.0" 2> ${1}.NM
+ NETMASK=`cat ${iface}.NM`
+ dialog --title "Gateway" --inputbox "Please enter a Gateway for ${iface} (hit enter for none:)" 20 50 2> ${1}.GW
+ GATEWAY=`cat ${iface}.GW`
+ dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${iface}.DNS
+ DNS=`cat ${iface}.DNS`
+ /sbin/ifconfig ${iface} ${IP} broadcast ${BROADCAST} netmask ${NETMASK}
if [ -n "${GATEWAY}" ]; then
/sbin/route add default gw ${GATEWAY} dev $1 netmask 0.0.0.0 metric 1
fi
@@ -88,8 +90,8 @@ config_ip() {
esac
}
-dialog --title "Network setup" --menu "This script is designed to setup both wired and wireless network settings. All questions below apply to the ${1} interface only. Choose one option:" 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${1}.WIRED_WIRELESS
-WIRED_WIRELESS=`cat ${1}.WIRED_WIRELESS`
+dialog --title "Network setup" --menu "This script is designed to setup both wired and wireless network settings. All questions below apply to the ${iface} interface only. Choose one option:" 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${1}.WIRED_WIRELESS
+WIRED_WIRELESS=`cat ${iface}.WIRED_WIRELESS`
case ${WIRED_WIRELESS} in
1)
config_wireless