/[livecd-tools]/trunk/net-setup
Gentoo

Contents of /trunk/net-setup

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sun Mar 21 20:09:33 2004 UTC (10 years, 5 months ago) by zhen
File size: 1877 byte(s)
adding header to net-select

1 # Copyright 1999-2004 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.2 2004/03/21 20:09:33 zhen Exp $
4
5 #!/bin/bash
6 # John Davis <zhen@gentoo.org>
7
8 if [ `whoami` != "root" ]
9 then
10 echo "net-setup: must be root to continue"
11 exit 1
12 fi
13
14 if [ -z ${1} ]
15 then
16 echo "net-setup: please specify a network interface"
17 exit 1
18 fi
19
20 [ ! -d /tmp/setup.opts ] && mkdir /tmp/setup.opts
21 cd /tmp/setup.opts
22
23 dialog --title "Network Setup" --menu "Time to set up the ${1} interface! 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}.1
24 mynetsel=`cat ${1}.1`
25 case $mynetsel in
26 1)
27 /sbin/dhcpcd -t 10 ${1}
28 ;;
29 2)
30 dialog --title "IP address" --inputbox "Please enter an IP address for $1:" 20 50 "192.168.1.1" 2> ${1}.IP
31 dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address for $1:" 20 50 "192.168.1.255" 2> ${1}.B
32 dialog --title "Network mask" --inputbox "Please enter a Network Mask for $1:" 20 50 "255.255.255.0" 2> ${1}.NM
33 dialog --title "Gateway" --inputbox "Please enter a Gateway for $1 (hit enter for none:)" 20 50 2> ${1}.GW
34 dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${1}.NS
35 /sbin/ifconfig $1 `cat ${1}.IP` broadcast `cat ${1}.B` netmask `cat ${1}.NM`
36 myroute=`cat ${1}.GW`
37 if [ "$myroute" != "" ]
38 then
39 /sbin/route add default gw $myroute dev $1 netmask 0.0.0.0 metric 1
40 fi
41 myns="`cat ${1}.NS`"
42 if [ "$myns" = "" ]
43 then
44 : > /etc/resolv.conf
45 else
46 echo "nameserver $myns" > /etc/resolv.conf
47 fi
48 ;;
49 esac
50
51 echo "Type \"ifconfig\" to make sure the interface was configured correctly."

Properties

Name Value
svn:eol-style native
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20