sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
- From: Mads Laursen <dossen+sgl AT daimi.au.dk>
- To: sm-discuss AT lists.ibiblio.org
- Subject: Re: [SM-Discuss] [cauldron] tasks for team
- Date: Fri, 20 Jun 2003 14:07:24 +0200
On 20/06/03 14.01, Mads Laursen wrote:
[snip]
> It's a hack, and not a pretty one at that, but for reference I'm
> attaching the networking.sh and .dev files I came up with while
> playing around with ipv6[1].
[snip]
Just had to forget the attachments... ;-)
/dossen
--
"Nuclear war can ruin your whole compile."
-- Karl Lehenbauer
#!/bin/bash
# /etc/init.d/networking.sh
# SMGL-script-version=custom
# set the above to custom instead of date format if you use
# a custom networking script
# this sets the run levels and priority for links
# SMGL-START:3 4 5:S30
# SMGL-STOP:0 1 2 6:K70
# this script requires a file in /etc/sysconfig/network
# for each network device named <device>.dev
# with the following variables set as needed:
# MODULE=
# leave MODULE= blank if device driver built into the kernel
# MODE=dynamic if you use dhcpcd
# MODE=static if you do not
# The following is needed only if MODE=static
# IP=
# BROADCAST=
# NETMASK=
# GATEWAY=
# Leave GATEWAY= blank if your gateway is set by another program.
. /etc/init.d/functions
netdevdir=/etc/sysconfig/network
#change this if your .pid file hides somewhere else
DHCPCD_PATH="/etc/dhcpc/dhcpcd-"
# this provides you with the ability to start/stop/check status on
# one or more cards if you so desire.
if [ $# -le 1 ]; then
devices=$(ls $netdevdir | grep dev$ | cut -d. -f1)
else
devices=$(echo $@ | sed s/$1//)
fi
case "$1" in
start)
for DEVICE in $devices; do
if [ -f $netdevdir/$DEVICE.dev ]; then
unset MODE MODULE IP BROADCAST NETMASK GATEWAY PLUGANDPLAY
. $netdevdir/$DEVICE.dev
if [ -z "$MODE" ]; then
echo " There are errors in $netdevdir/$DEVICE.dev"
else
if [ -z "$PLUGANDPLAY" ]; then
# only load module if necessary; i.e. not built into kernel.
if [ ! -z "$MODULE" ]; then
echo "Starting $0 with $DEVICE ..."
loadproc modprobe $MODULE
fi
fi
if lsmod|grep -q "$MODULE"; then
if [ "$MODE" = dynamic ]; then
echo "Starting dhcpcd on $DEVICE ..."
if [ -e $DHCPCD_PATH$DEVICE.pid ]; then
dhcpcPid=`cat $DHCPCD_PATH$DEVICE.pid`
dhcpcd -k $DEVICE 1>/dev/null 2>&1
renice 10 $dhcpcPid 1>/dev/null 2>&1 || rm -f $DHCPCD_PATH$DEVICE.pid
sleep 1
fi
loadproc dhcpcd -t 30 -d $DEVICE
elif [ "$MODE" = autoconf ]; then
echo "Setting up ipv6 autoconf networking on $DEVICE"
loadproc modprobe ipv6
ifconfig $DEVICE inet6 up
evaluate_retval
elif [ "$MODE" = static ]; then
echo "Setting up static networking on $DEVICE"
ifconfig $DEVICE $IP broadcast $BROADCAST netmask $NETMASK
# check if GATEWAY is set; gateway is set by PPP or other software in some cases
if [ ! -z "$GATEWAY" ]; then
route add default gateway $GATEWAY
fi
evaluate_retval
else
echo " There are errors in $netdevdir/$DEVICE.dev"
fi
fi
fi
fi
done
;;
stop)
for DEVICE in $devices; do
if [ -f $netdevdir/$DEVICE.dev ] && ( 2>/dev/null >&2 ifconfig $DEVICE); then
unset MODE MODULE IP BROADCAST NETMASK GATEWAY PLUGANDPLAY
. $netdevdir/$DEVICE.dev
if [ -z "$MODE" ]; then
echo " There are errors in $netdevdir/$DEVICE.dev"
else
if [ "$MODE" = dynamic ]; then
echo "Stopping dhcpcd on $DEVICE ..."
dhcpcd -k $DEVICE
evaluate_retval
sleep 2
else
ifconfig $DEVICE down
fi
if [ -z "$PLUGANDPLAY" ]; then
# only do this if network device is a module
if [ ! -z "$MODULE" ]; then
echo "Stopping $0 on $DEVICE ..."
modprobe -r $MODULE
evaluate_retval
fi
fi
fi
fi
done
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
for DEVICE in $devices; do
if ( 2>/dev/null >&2 ifconfig $DEVICE); then
unset MODE MODULE IP BROADCAST NETMASK GATEWAY PLUGANDPLAY
. $netdevdir/$DEVICE.dev
if [ -z "$MODE" ]; then
echo " There are errors in $netdevdir/$DEVICE.dev"
else
if [ "$MODE" = dynamic ]; then
statusproc dhcpcd
fi
ifconfig $DEVICE
fi
else
echo "$DEVICE is not configured at the moment"
echo
fi
done
;;
*)
echo "Usage: $0 {start|stop|restart|status} [DEVICE]"
exit 1
;;
esac
# config file for eth0# MODE=dynamic if you use dhcp, static otherwise
# dynamic and static both require
# MODULE= (kernel module for eth0)
# if your eth0 driver is built into kernel then leave blank
# static requires the following in addition:
# IP= ip address of eth0
# BROADCAST= broadcast address
# NETMASK= netmask address
# GATEWAY= gateway address (leave blank if gateway is set by other program)
MODULE=3c59x
MODE=autoconf
# config file for eth0
# MODE=dynamic if you use dhcp, static otherwise
# dynamic and static both require
# MODULE= (kernel module for eth0)
# if your eth0 driver is built into kernel then leave blank
# static requires the following in addition:
# IP= ip address of eth0
# BROADCAST= broadcast address
# NETMASK= netmask address
# GATEWAY= gateway address (leave blank if gateway is set by other program)
MODULE=orinoco_cs
MODE=dynamic
PLUGANDPLAY=true
Attachment:
pgpvigHhapUO_.pgp
Description: PGP signature
-
[SM-Discuss] [cauldron] tasks for team,
wandre . l, 06/19/2003
-
Re: [SM-Discuss] [cauldron] tasks for team,
Sergey A. Lipnevich, 06/19/2003
- Re: [SM-Discuss] [cauldron] tasks for team, Eric Schabell, 06/19/2003
- Re: [SM-Discuss] [cauldron] tasks for team, Derek Moyes, 06/20/2003
-
Re: [SM-Discuss] [cauldron] tasks for team,
Casey Harkins, 06/19/2003
-
RE: [SM-Discuss] [cauldron] tasks for team,
Damien Mascord, 06/19/2003
-
RE: [SM-Discuss] [cauldron] tasks for team,
Casey Harkins, 06/19/2003
- RE: [SM-Discuss] [cauldron] tasks for team, Damien Mascord, 06/19/2003
-
RE: [SM-Discuss] [cauldron] tasks for team,
Mads Laursen, 06/20/2003
- Re: [SM-Discuss] [cauldron] tasks for team, Mads Laursen, 06/20/2003
-
RE: [SM-Discuss] [cauldron] tasks for team,
Casey Harkins, 06/19/2003
-
RE: [SM-Discuss] [cauldron] tasks for team,
Damien Mascord, 06/19/2003
-
Re: [SM-Discuss] [cauldron] tasks for team,
Sergey A. Lipnevich, 06/19/2003
Archive powered by MHonArc 2.6.24.