[prev in list] [next in list] [prev in thread] [next in thread] 

List:       annvix-cvs
Subject:    [cvs] SVN commit in tools r524 - installer/trunk/tools
From:       cvsrep () annvix ! org
Date:       2006-12-30 22:15:47
Message-ID: E1H0mUV-0007lj-T2 () build ! annvix ! org
[Download RAW message or body]

Author: vdanen
Date: 2006-12-30 15:15:47 -0700 (Sat, 30 Dec 2006)
New Revision: 524

Modified:
   installer/trunk/tools/net-setup
Log:
- assume eth0 if no device has been provided


Modified: installer/trunk/tools/net-setup
===================================================================
--- installer/trunk/tools/net-setup	2006-12-30 22:09:08 UTC (rev 523)
+++ installer/trunk/tools/net-setup	2006-12-30 22:15:47 UTC (rev 524)
@@ -15,9 +15,15 @@
     exit 1
 fi
 
+ethdev="${1}"
+if [ "${ethdev}" == "" ]; then
+    echo "Unable to proceed without a specific ethernet device... assuming eth0..."
+    ethdev="eth0"
+fi
+
 # check if the nic to configure has been pre-setup in /etc/modprobe.conf
-if [ "`grep ${1} /etc/modprobe.conf >/dev/null 2>&1; echo $?`" == "1" ]; then
-    echo "Can't find net-device ${1} in /etc/modprobe.conf!"
+if [ "`grep ${ethdev} /etc/modprobe.conf >/dev/null 2>&1; echo $?`" == "1" ]; then
+    echo "Can't find net-device ${ethdev} in /etc/modprobe.conf!"
     echo ""
     echo "This probably means you didn't run net-setup in probe mode or you \
specified"  echo "an invalid network interface name."
@@ -36,60 +42,60 @@
 
 echo "127.0.0.1		localhost" >/etc/hosts
 
-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
-mynetsel=`cat ${1}.1`
+dialog --title "Network Setup" --menu "Time to set up the ${ethdev} 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> ${ethdev}.1 +mynetsel=`cat \
${ethdev}.1`  case ${mynetsel} in
 1)
-    dialog --title "Hostname" --inputbox "Please enter the FQDN hostname for this \
                system:" 20 50 "localhost" 2> ${1}.HN
-    hostname="`cat ${1}.HN`"
+    dialog --title "Hostname" --inputbox "Please enter the FQDN hostname for this \
system:" 20 50 "localhost" 2> ${ethdev}.HN +    hostname="`cat ${ethdev}.HN`"
     # make sure dhcpcd isn't already running
     /sbin/dhcpcd -k >/dev/null 2>&1
-    /sbin/dhcpcd -t 10 -h ${hostname} ${1} >/dev/null 2>&1
+    /sbin/dhcpcd -t 10 -h ${hostname} ${ethdev} >/dev/null 2>&1
     echo "HOSTNAME=${hostname}" >/etc/sysconfig/network
     echo "NETWORKING=yes" >>/etc/sysconfig/network
-    echo "DEVICE=${1}" >/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "BOOTPROTO=dhcp" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "ONBOOT=yes" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "MII_NOT_SUPPORTED=yes" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    search=`cat ${1}.HN|cut -d '.' -f 2-`
+    echo "DEVICE=${ethdev}" >/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "BOOTPROTO=dhcp" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "ONBOOT=yes" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "MII_NOT_SUPPORTED=yes" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    search=`cat ${ethdev}.HN|cut -d '.' -f 2-`
     ;;
 2)
-    dialog --title "IP address" --inputbox "Please enter an IP address for ${1}:" 20 \
                50 "192.168.1.1" 2> ${1}.IP
-    dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address \
                for ${1}:" 20 50 "192.168.1.255" 2> ${1}.B
-    dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${1}:" \
                20 50 "255.255.255.0" 2> ${1}.NM
-    dialog --title "Network address" --inputbox "Please enter a Network Address for \
                ${1}:" 20 50 "192.168.0.0" 2> ${1}.NW
-    dialog --title "Gateway" --inputbox "Please enter a Gateway for ${1} (hit enter \
                for none:)" 20 50 2> ${1}.GW
-    dialog --title "DNS server" --inputbox "Please enter a name server to use (hit \
                enter for none:)" 20 50 2> ${1}.NS
-    dialog --title "Hostname" --inputbox "Please enter the FQDN hostname for this \
                system:" 20 50 "localhost" 2> ${1}.HN
-    /sbin/ifconfig $1 `cat ${1}.IP` broadcast `cat ${1}.B` netmask `cat ${1}.NM`
-    myroute=`cat ${1}.GW`
+    dialog --title "IP address" --inputbox "Please enter an IP address for \
${ethdev}:" 20 50 "192.168.1.1" 2> ${ethdev}.IP +    dialog --title "Broadcast \
address" --inputbox "Please enter a Broadcast address for ${ethdev}:" 20 50 \
"192.168.1.255" 2> ${ethdev}.B +    dialog --title "Network mask" --inputbox "Please \
enter a Network Mask for ${ethdev}:" 20 50 "255.255.255.0" 2> ${ethdev}.NM +    \
dialog --title "Network address" --inputbox "Please enter a Network Address for \
${ethdev}:" 20 50 "192.168.0.0" 2> ${ethdev}.NW +    dialog --title "Gateway" \
--inputbox "Please enter a Gateway for ${ethdev} (hit enter for none:)" 20 50 2> \
${ethdev}.GW +    dialog --title "DNS server" --inputbox "Please enter a name server \
to use (hit enter for none:)" 20 50 2> ${ethdev}.NS +    dialog --title "Hostname" \
--inputbox "Please enter the FQDN hostname for this system:" 20 50 "localhost" 2> \
${ethdev}.HN +    /sbin/ifconfig $1 `cat ${ethdev}.IP` broadcast `cat ${ethdev}.B` \
netmask `cat ${ethdev}.NM` +    myroute=`cat ${ethdev}.GW`
     if [ "${myroute}" != "" ]
     then
         /sbin/route add default gw $myroute dev $1 netmask 0.0.0.0 metric 1	
     fi
-    myns="`cat ${1}.NS`"
+    myns="`cat ${ethdev}.NS`"
     if [ "${myns}" = "" ]
     then
         : > /etc/resolv.conf
     else
-        search=`cat ${1}.HN|cut -d '.' -f 2-`
+        search=`cat ${ethdev}.HN|cut -d '.' -f 2-`
         echo "search ${search}" > /etc/resolv.conf
         echo "nameserver ${myns}" >> /etc/resolv.conf
     fi
-    hostname="`cat ${1}.HN`"
-    ipaddr="`cat ${1}.IP`"
-    shorthost="`cat ${1}.HN|cut -d. -f1`"
+    hostname="`cat ${ethdev}.HN`"
+    ipaddr="`cat ${ethdev}.IP`"
+    shorthost="`cat ${ethdev}.HN|cut -d. -f1`"
     echo "HOSTNAME=${hostname}" >/etc/sysconfig/network
     echo "NETWORKING=yes" >>/etc/sysconfig/network
     echo "GATEWAY=${myroute}" >>/etc/sysconfig/network
-    echo "DEVICE=${1}" >/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "BOOTPROTO=static" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "IPADDR=${ipaddr}" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "NETMASK=`cat ${1}.NM`" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "NETWORK=`cat ${1}.NW`" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "BROADCAST=`cat ${1}.B`" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "ONBOOT=yes" >>/etc/sysconfig/network-scripts/ifcfg-${1}
-    echo "MII_NOT_SUPPORTED=yes" >>/etc/sysconfig/network-scripts/ifcfg-${1}
+    echo "DEVICE=${ethdev}" >/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "BOOTPROTO=static" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "IPADDR=${ipaddr}" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "NETMASK=`cat ${ethdev}.NM`" \
>>/etc/sysconfig/network-scripts/ifcfg-${ethdev} +    echo "NETWORK=`cat \
> > ${ethdev}.NW`" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "BROADCAST=`cat ${ethdev}.B`" \
>>/etc/sysconfig/network-scripts/ifcfg-${ethdev} +    echo "ONBOOT=yes" \
> > >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
+    echo "MII_NOT_SUPPORTED=yes" >>/etc/sysconfig/network-scripts/ifcfg-${ethdev}
     echo "${ipaddr}		${hostname} ${shorthost}" >>/etc/hosts
     ;;
 esac


_______________________________________________
cvs mailing list
cvs@annvix.org
http://annvix.org/mailman/listinfo/cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic