ppcrcd/trunk/conf.dir/usr/lib/ppcrcd: functions net-detect
sparky
cvs at pld-linux.org
Wed Mar 15 23:56:55 CET 2006
Author: sparky
Date: Wed Mar 15 23:56:48 2006
New Revision: 7176
Modified:
ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions
ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect
Log:
- move set_ifcfg() to functions file
- try to configure network only if udev automation is disabled
Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions Wed Mar 15 23:56:48 2006
@@ -148,4 +148,36 @@
return 1
}
+# prepare ifcfg file
+set_ifcfg() {
+ DEV=$1
+ IF=/etc/sysconfig/interfaces/ifcfg-$DEV
+ IP=$2
+ ONBOOT=$3
+ [[ -z $IP ]] && return
+ [[ -e $IF ]] && mv -f "${IF}" "${IF%/*}/backup.${IF##*/}"
+ [[ -n $ONBOOT ]] && ONBOOT=yes
+ verbose 4 " +-Creating ifcfg-$DEV config file"
+ if [ "$IP" == "dhcp" -o "$IP" == "pump" ]; then
+ IPADDR="192.168.1.1/24"
+ BOOTPROTO=$IP
+ else
+ IPADDR=$IP
+ BOOTPROTO=none
+ fi
+
+cat > $IF << EOF
+DEVICE=$DEV
+
+ONBOOT=$ONBOOT
+
+IPADDR=$IPADDR
+BOOTPROTO=$BOOTPROTO
+
+WLAN_NICKNAME="ppcrcd"
+DHCP_OPTIONS="-DHt 15"
+EOF
+}
+
+
# vi:ts=4:sw=4
Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect (original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect Wed Mar 15 23:56:48 2006
@@ -10,38 +10,6 @@
. /usr/lib/ppcrcd/functions
-verbose 1 -G "Setting network cards"
-
-set_ifcfg() {
- DEV=$1
- IF=/etc/sysconfig/interfaces/ifcfg-$DEV
- IP=$2
- ONBOOT=$3
- [[ -z $IP ]] && return
- [[ -e $IF ]] && mv -f "${IF}" "${IF%/*}/backup.${IF##*/}"
- [[ -n $ONBOOT ]] && ONBOOT=yes
- verbose 4 " +-Creating ifcfg-$DEV config file"
- if [ "$IP" == "dhcp" -o "$IP" == "pump" ]; then
- IPADDR="192.168.1.1/24"
- BOOTPROTO=$IP
- else
- IPADDR=$IP
- BOOTPROTO=none
- fi
-
-cat > $IF << EOF
-DEVICE=$DEV
-
-ONBOOT=$ONBOOT
-
-IPADDR=$IPADDR
-BOOTPROTO=$BOOTPROTO
-
-WLAN_NICKNAME="ppcrcd"
-DHCP_OPTIONS="-DHt 15"
-EOF
-}
-
confnet() {
ONBOOT=yes
if [[ $1 == noboot ]]; then
@@ -86,31 +54,22 @@
#@ Example:
#@ | eth=sungem:192.168.0.5/24:192.168.0.2:192.168.0.2
#@@ nonveth: don't configure ethernet specified in nvram
-ETHS=$(cmdvar eth)
-if [ -n "$ETHS" ]; then
- verbose 2 -B " +-Using cmdline network config"
- confnet $ETHS
-else
- if ! cmdopt nonveth; then
- ETHS=$(nvvar eth)
- if [ -n "$ETHS" ]; then
- verbose 2 -B " +-Using nvram network config"
- confnet $ETHS
- fi
- fi
+
+if cmdopt noauto; then
+ # if udev desactived
+ verbose 1 -G "Setting network cards"
- if ! egrep -q "^[[:space:]]*alias[[:space:]]*eth0" /etc/modprobe.conf; then
- verbose 2 -B " +-Autodetecting network"
- for WAIT in $(seq 5); do
- # wait if modules wasn't loaded yet
- [[ -d /sys/class/net/eth0 ]] && break
- sleep 1
- done
- if [[ -d /sys/class/net/eth0 ]]; then
- # if udev has detected something only setup ifcfg files
- for NET in /sys/class/net/eth*; do
- set_ifcfg ${NET##*/} dhcp no
- done
+ ETHS=$(cmdvar eth)
+ if [ -n "$ETHS" ]; then
+ verbose 2 -B " +-Using cmdline network config"
+ confnet $ETHS
+ else
+ if ! cmdopt nonveth; then
+ ETHS=$(nvvar eth)
+ if [ -n "$ETHS" ]; then
+ verbose 2 -B " +-Using nvram network config"
+ confnet $ETHS
+ fi
else
#old behaviour
confnet noboot $(/usr/bin/pcidev /m net | sed 's/$/:dhcp/')
More information about the pld-cvs-commit
mailing list