Rev 73 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash## Noninteractive HW detection and configuration# in particular configure network devices## Urs Beyerle, PSI#### -----------------------------------------------------------### definitions### -----------------------------------------------------------# dir of mounted /$MOUNTDIR/liveMOUNTDIR=livecd# source functions. /$MOUNTDIR/live/liblinuxlive. /etc/init.d/functions### -----------------------------------------------------------### Get boot parameters### -----------------------------------------------------------# do not start networkNONET=$( cmdline_parameter nonet )# static IPIPADDR=$( cmdline_value ip )# gatewayGATEWAY=$( cmdline_value gw )# netmaskNETMASK=$( cmdline_value netmask )### -----------------------------------------------------------### Main### -----------------------------------------------------------### run kudzu in quiet modeaction $"Hardware auto-detection, please wait... " /usr/sbin/kudzu -q### never start on boot the following network devices (wifi0, ath0)for iface in wifi0 ath0; dofor file in networking/profiles/default/ifcfg \networking/devices/ifcfg \network-scripts/ifcfg; doif [ -e /etc/sysconfig/${file}-${iface} ]; thensed -i "s/ONBOOT=.*/ONBOOT=no/" /etc/sysconfig/${file}-${iface}fidonedone### disable start network devices, if NONET is definedif [ $NONET ]; then# find all network devices (exclude loopback device)config_files=$( find /etc/sysconfig -name ifcfg-* 2>/dev/null | grep -v ifcfg-lo )for file in $config_files; dosed -i "s/ONBOOT=.*/ONBOOT=no/" $filedonefi### define static IP and gateway, netmaskif [ $IPADDR ]; thenif [ ! $GATEWAY ]; then# default gatway x.y.z.1GATEWAY=$( echo $IPADDR | awk -F"." '{ print $1"."$2"."$3".1" }' )if [ ! $NETMASK ]; thenNETMASK=255.255.255.0fifi# create config files for eth0for iface in eth0; dofor file in networking/profiles/default/ifcfg \networking/devices/ifcfg \network-scripts/ifcfg; dosed -i "s/BOOTPROTO=.*/BOOTPROTO=none/" /etc/sysconfig/${file}-${iface}echo "IPADDR=$IPADDR" > /etc/sysconfig/${file}-${iface}echo "NETMASK=$NETMASK" > /etc/sysconfig/${file}-${iface}echo "GATEWAY=$GATEWAY" > /etc/sysconfig/${file}-${iface}donedonefi### activate ipw3945d daemon, if we have Intel IPW3945 WLANlspci | grep -q Intel.*3945ABG[ "$?" = "0" ] && chkconfig ipw3945d on 2>/dev/null### activate Atheros WLANlspci | grep -q Ethernet.*Atherosif [ "$?" = "0" ]; then# bring ath0 upifconfig ath0 up > /dev/null 2>&1# replace wifi with ath0for file in networking/profiles/default/ifcfg \networking/devices/ifcfg \network-scripts/ifcfg; doif [ -e /etc/sysconfig/${file}-wifi0 ]; thenmv /etc/sysconfig/${file}-wifi0 /etc/sysconfig/${file}-ath0sed -i "s/wifi0/ath0/" /etc/sysconfig/${file}-ath0grep -q Wireless /etc/sysconfig/${file}-ath0[ "$?" != "0" ] && echo "TYPE=Wireless" >> /etc/sysconfig/${file}-ath0fidonefi### enable 915resolution on Intel Mobile Display controllerlspci | grep -q Display.*Intel.*Mobile[ "$?" = "0" ] && chkconfig 915resolution on