diff options
author | Chad Huneycutt <chadh@gentoo.org> | 2002-06-04 02:31:32 +0000 |
---|---|---|
committer | Chad Huneycutt <chadh@gentoo.org> | 2002-06-04 02:31:32 +0000 |
commit | fc72891b9febfbb7a6ce419a28492572a20410a1 (patch) | |
tree | 3a1df25c8c11490a1c42c15534c1f44495e4ec88 /sys-apps/pcmcia-cs | |
parent | gnome-vfs dep update (diff) | |
download | gentoo-2-fc72891b9febfbb7a6ce419a28492572a20410a1.tar.gz gentoo-2-fc72891b9febfbb7a6ce419a28492572a20410a1.tar.bz2 gentoo-2-fc72891b9febfbb7a6ce419a28492572a20410a1.zip |
original pcmcia-cs network script, until we get ours fixed
Diffstat (limited to 'sys-apps/pcmcia-cs')
-rw-r--r-- | sys-apps/pcmcia-cs/files/network.orig | 253 | ||||
-rw-r--r-- | sys-apps/pcmcia-cs/files/pcmcia.conf | 2 |
2 files changed, 254 insertions, 1 deletions
diff --git a/sys-apps/pcmcia-cs/files/network.orig b/sys-apps/pcmcia-cs/files/network.orig new file mode 100644 index 000000000000..f730ca80cd84 --- /dev/null +++ b/sys-apps/pcmcia-cs/files/network.orig @@ -0,0 +1,253 @@ +#! /bin/sh +# +# network 1.84 2001/12/01 01:17:50 (David Hinds) +# +# Initialize or shutdown a PCMCIA ethernet adapter +# +# This script should be invoked with two arguments. The first is the +# action to be taken, either "start", "stop", or "restart". The +# second is the network interface name. +# +# The script passes an extended device address to 'network.opts' in +# the ADDRESS variable, to retrieve device-specific configuration +# options. The address format is "scheme,socket,instance,hwaddr" +# where "scheme" is the current PCMCIA device configuration scheme, +# "socket" is the socket number, "instance" is used to number multiple +# interfaces in a single socket, and "hwaddr" is the card's hardware +# ethernet address. +# + +if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi + +# Get device attributes +get_info $DEVICE +HWADDR=`/sbin/ifconfig $DEVICE | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p'` + +# Load site-specific settings +ADDRESS="$SCHEME,$SOCKET,$INSTANCE,$HWADDR" +start_fn () { return; } +stop_fn () { return; } +. $0.opts + +RESOLV=/etc/resolv.conf + +# Now, run the specific script for Wireless LAN interfaces +# Note : we need the wireless parameters to be set up before IP parameters, +# so that we can perform DHCP over the Wireless link if needed. Jean II +O_INFO=$INFO ; INFO= +if [ -x ./wireless ] ; then + . ./wireless +else + . /etc/pcmcia/wireless +fi +INFO=$O_INFO + +match () { case $1 in $2) return 0; ;; *) return 1; ;; esac ; } +bootp_setup () +{ + if match `uname -r` "2.[2-9].*" ; then + log /sbin/ifconfig $DEVICE up + else + log /sbin/ifconfig $DEVICE up 0.0.0.0 + log /sbin/route add default dev $DEVICE netmask 0.0.0.0 + fi +} + +case "$ACTION" in + +'start') + [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$INFO" + + [ -n "$IF_PORT" ] && /sbin/ifport $DEVICE $IF_PORT + + if is_true $PUMP ; then + log "/sbin/pump -i $DEVICE > /dev/null" || exit 1 + elif is_true $BOOTP ; then + bootp_setup + if [ -x /sbin/bootpc ] ; then + eval `/sbin/bootpc --bootfile '' --returniffail \ + --timeoutwait 10 --dev $DEVICE` + log /sbin/ifconfig $DEVICE down + if [ -n "$GATEWAYS" ] ; then + set - $GATEWAYS ; GATEWAY=$1 + fi + elif [ -x /sbin/pump ] ; then + log "/sbin/pump -i $DEVICE > /dev/null" || exit 1 + else + exit 1 + fi + elif is_true $DHCP ; then + bootp_setup + HN=${DHCP_HOSTNAME:+-h $DHCP_HOSTNAME} + if [ -x /sbin/dhcpcd ] ; then + # This is a version check: I know it looks weird + if /sbin/dhcpcd -XYZZY 2>&1 | grep -q DHCP ; then + log "/sbin/dhcpcd $HN $DEVICE >/dev/null 2>&1" || exit 1 + else + # Jump through hoops for lame 0.70-era dhcpcd + L=/var/run/dhcp-lock-$DEVICE + /bin/echo "#!/bin/sh\nrm $L" > $L ; chmod +x $L + log "/sbin/dhcpcd $HN -c $L $DEVICE >/dev/null 2>&1" + for t in 0 1 2 3 4 5 6 7 8 9 ; do + sleep 2 ; if [ ! -e $L ] ; then break ; fi + done + rm -f $L + if [ -e /etc/dhcpc/resolv.conf ] ; then + echo "# $DEVICE begin" > $RESOLV.N + chmod og+r $RESOLV.N + cat /etc/dhcpc/resolv.conf >> $RESOLV.N + echo "# $DEVICE end" >> $RESOLV.N + cat $RESOLV >> $RESOLV.N ; mv $RESOLV.N $RESOLV + fi + fi + elif [ -x /sbin/dhclient ] ; then + log "/sbin/dhclient $DEVICE >/dev/null 2>&1" || exit 1 + elif [ -x /sbin/pump ] ; then + log "/sbin/pump $HN -i $DEVICE > /dev/null" || exit 1 + else + exit 1 + fi + fi + + if [ -n "$IPADDR" ] ; then + # Basic network setup + NM=${NETMASK:+netmask $NETMASK} + BC=${BROADCAST:+broadcast $BROADCAST} + MTU=${MTU:+mtu $MTU} + log /sbin/ifconfig $DEVICE up $IPADDR $NM $BC $MTU + if [ -n "$NETWORK" ] ; then + /sbin/ifuser $DEVICE $NETWORK || \ + log /sbin/route add -net $NETWORK $NM dev $DEVICE + elif [ -n "$GATEWAY" ] ; then + /sbin/ifuser $DEVICE $GATEWAY || \ + log /sbin/route add $GATEWAY $DEVICE + fi + [ -n "$GATEWAY" ] && /sbin/route add default gw $GATEWAY metric 1 + fi + + # Update DNS stuff + if [ -n "$DOMAIN$SEARCH$DNSSRVS$DNS_1$DNS_2$DNS_3" ] ; then + echo "# $DEVICE begin" > $RESOLV.N + chmod og+r $RESOLV.N + [ -n "$DOMAIN" ] && echo "domain $DOMAIN" >> $RESOLV.N + [ -n "$SEARCH" ] && echo "search $SEARCH" >> $RESOLV.N + for DNS in $DNSSRVS $DNS_1 $DNS_2 $DNS_3 ; do + echo "nameserver $DNS" >> $RESOLV.N + done + echo "# $DEVICE end" >> $RESOLV.N + sed -e "/# $DEVICE begin/,/# $DEVICE end/d" $RESOLV >> $RESOLV.N + mv $RESOLV.N $RESOLV + fi + + # Handle NFS mounts + if [ -n "$MOUNTS" ] ; then + for MT in $MOUNTS ; do log mount -v $MT ; done + fi + + if [ -n "$IPX_NETNUM" ] ; then + log ipx_interface add $DEVICE $IPX_FRAME $IPX_NETNUM + fi + + start_fn $DEVICE + ;; + +'stop') + + stop_fn $DEVICE + + if is_true $PUMP || is_true $BOOTP || is_true $DHCP || \ + [ -n "$IPADDR" ] ; then + + # Shut down all NFS mounts on this interface + nfsstop () + { + local HOST MT + if read HOST MT ; then + nfsstop + if /sbin/ifuser $DEVICE $HOST ; then + do_fuser -k -m $MT > /dev/null + log umount -f -v $MT + fi + fi + } + mount -t nfs | sed -e 's/:.* on \(.*\) type .*/ \1/' | nfsstop + + [ -n "$IPX_NETNUM" ] && ipx_interface del $DEVICE $IPX_FRAME + + # Remove nameservers + if grep -q "# $DEVICE begin" $RESOLV ; then + sed -e "/# $DEVICE begin/,/# $DEVICE end/d" $RESOLV > $RESOLV.N + mv $RESOLV.N $RESOLV + fi + + if is_true $PUMP ; then + log pump -r -i $DEVICE + elif is_true $DHCP ; then + if [ -x /sbin/dhcpcd ] ; then + PID=`cat /var/run/dhcpcd-$DEVICE.pid 2>/dev/null` + if [ -n "$PID" ] ; then + kill -TERM $PID + sleep 2 + fi + /sbin/dhcpcd -XYZZY 2>&1 | grep -q DHCP || \ + rm -f /var/run/dhcpcd-$DEVICE.pid + elif [ -x /sbin/dhclient ] ; then + PID=`cat /var/run/dhclient.pid 2>/dev/null` + if [ -n "$PID" ] ; then kill -TERM $PID ; fi + elif [ -x /sbin/pump ] ; then + log /sbin/pump -r -i $DEVICE + fi + fi + fi + log /sbin/ifconfig $DEVICE down + ;; + +'check') + is_true $NO_CHECK && exit 0 + /sbin/ifconfig $DEVICE | grep -q RUNNING || exit 0 + + # Check for any in-use NFS mounts + nfscheck () + { + while read HOST MT ; do + /sbin/ifuser $DEVICE $HOST && do_fuser -sm $MT && exit 1 + done + } + mount -t nfs | sed -e 's/:.* on \(.*\) type .*/ \1/' | nfscheck + + # Check for active TCP or UDP connections + getdests () + { + IFS=" :" ; read A ; read A + while read A B C D E HOST PORT STATE ; do + if [ "$STATE" != "FIN_WAIT1" -a "$STATE" != "FIN_WAIT2" \ + -a "$STATE" != "CLOSE_WAIT" -a "$STATE" != "TIME_WAIT" \ + -a "$HOST" != "127.0.0.1" -a "$HOST" != "0.0.0.0" \ + -a "$STATE" != "CLOSE" -a "$PORT" != "*" ] ; then\ + echo $HOST + fi + done + } + DESTS=`netstat -ntuw | getdests` + /sbin/ifuser $DEVICE $DESTS && exit 1 + ;; + +'cksum') + if [ $WIRELESS = 1 ] ; then exit 1 ; fi + chk_simple "$NEW_SCHEME,$SOCKET,$INSTANCE,$HWADDR" || exit 1 + ;; + +'restart') + [ -n "$IPADDR" ] && /sbin/ifconfig $DEVICE down up + ;; + +'suspend'|'resume') + ;; + +*) + usage + ;; + +esac + +exit 0 diff --git a/sys-apps/pcmcia-cs/files/pcmcia.conf b/sys-apps/pcmcia-cs/files/pcmcia.conf index d44aa6f32c08..25685d5f8d43 100644 --- a/sys-apps/pcmcia-cs/files/pcmcia.conf +++ b/sys-apps/pcmcia-cs/files/pcmcia.conf @@ -1,5 +1,5 @@ # Put cardmgr options here -CARDMGR_OPTS="-f" +CARDMGR_OPTS="" # To set the PCMCIA scheme at startup... SCHEME="home" |