From: Artur Frysiak Date: Sat, 6 Nov 1999 00:23:54 +0000 (+0000) Subject: - now realy handle ifup X-Git-Tag: rel-0_1_3~24 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=111f7a0d7b052dd3ef37195eefde103cec5aa694;p=projects%2Frc-scripts.git - now realy handle ifup svn-id: @591 --- diff --git a/rc.d/init.d/functions.network b/rc.d/init.d/functions.network index dbee563a..aa4eea7f 100755 --- a/rc.d/init.d/functions.network +++ b/rc.d/init.d/functions.network @@ -1,5 +1,5 @@ # -# $Id: functions.network,v 1.29 1999/10/22 11:43:15 kloczek Exp $ +# $Id: functions.network,v 1.30 1999/11/06 00:23:53 wiget Exp $ # # This is not a shell script; it provides functions to network scripts # that source it. @@ -73,10 +73,14 @@ get_ldap_config () source_config () { - DEVNAME=`basename $CONFIG | sed 's/^ifcfg-//g'` - - if [ -f /etc/sysconfig/interfaces/ifcfg-$CONFIG ] ; then - . /etc/sysconfig/interfaces/ifcfg-$CONFIG + DEVNAME="`basename "$CONFIG" | sed 's/^ifcfg-//g'`" + + if echo "$CONFIG"|egrep "^/" >/dev/null 2>&1 ; then + if [ -f "$CONFIG" ] ; then + . "$CONFIG" + fi + elif [ -f "/etc/sysconfig/interfaces/$CONFIG" ] ; then + . "/etc/sysconfig/interfaces/$CONFIG" elif [ "$USE_LDAP" = "yes" ] ; then eval `get_ldap_config $DEVNAME` fi diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 3e66fae8..b56395d2 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -1,20 +1,20 @@ #!/bin/sh # -# $Id: ifdown,v 1.14 1999/10/13 21:28:40 kloczek Exp $ +# $Id: ifdown,v 1.15 1999/11/06 00:23:54 wiget Exp $ # PATH=/sbin:/usr/sbin:/bin:/usr/bin -. /etc/sysconfig/network -. /etc/rc.d/init.d/functions -. /etc/sysconfig/network-scripts/.functions +DEV=$1 -CONFIG=$1 - -[ -z "$CONFIG" ] && { +[ -z "$DEV" ] && { echo "usage: ifdown " >&2 exit 1 } +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /etc/sysconfig/network-scripts/.functions + if [ `id -u` != 0 ]; then if [ -x /usr/sbin/usernetctl ]; then exec /usr/sbin/usernetctl $CONFIG down @@ -23,6 +23,14 @@ if [ `id -u` != 0 ]; then exit 1 fi +IFCONFIGS="`ls /etc/sysconfig/interfaces/ifcfg-*|egrep -v '~$'`" +IFCONFIGS="`egrep -L '^#!' $IFCONFIGS`" +CONFIG="`egrep -l "DEVICE=[\"\']*$DEV[\"\']*\$" $IFCONFIGS`" + +if [ -z "$CONFIG" ]; then + CONFIG="$DEV" +fi + source_config # IPv4, IPv6 or both ? diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 0a423590..8f722379 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: ifup,v 1.29 1999/10/13 21:28:40 kloczek Exp $ +# $Id: ifup,v 1.30 1999/11/06 00:23:54 wiget Exp $ # PATH=/sbin:/usr/sbin:/bin:/usr/bin @@ -10,21 +10,29 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin need_hostname -CONFIG=$1 +DEV=$1 -[ -z "$CONFIG" ] && { +[ -z "$DEV" ] && { echo "usage: ifup " >&2 exit 1 } if [ `id -u` != 0 ]; then if [ -x /usr/sbin/usernetctl ]; then - exec /usr/sbin/usernetctl $CONFIG up + exec /usr/sbin/usernetctl $DEV up fi echo "Users cannot control this device." >&2 exit 1 fi +IFCONFIGS="`ls /etc/sysconfig/interfaces/ifcfg-*|egrep -v '~$'`" +IFCONFIGS="`egrep -L '^#!' $IFCONFIGS`" +CONFIG="`egrep -l "DEVICE=[\"\']*$DEV[\"\']*\$" $IFCONFIGS`" + +if [ -z "$CONFIG" ]; then + CONFIG="$DEV" +fi + source_config if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]; then @@ -184,10 +192,10 @@ if [ "$IPv4" = "yes" ]; then fi fi - . /etc/sysconfig/network +# . /etc/sysconfig/network if [ "${GATEWAY}" != "" ]; then - if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then + if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${FULLDEVICENAME}" ]; then # set up default gateway ip -family inet route add default via ${GATEWAY} dev ${DEVICE} ${SRC_ADDR} ${TNLOPTS} DEFGW=${GATEWAY} diff --git a/sysconfig/network-scripts/tnldown b/sysconfig/network-scripts/tnldown index 57ccb5f9..ef4c6c08 100755 --- a/sysconfig/network-scripts/tnldown +++ b/sysconfig/network-scripts/tnldown @@ -1,34 +1,38 @@ #!/bin/sh # -# $Id: tnldown,v 1.9 1999/10/13 21:28:40 kloczek Exp $ +# $Id: tnldown,v 1.10 1999/11/06 00:23:54 wiget Exp $ # # Author: Arkadiusz Mi¶kiewicz # -cd /etc/sysconfig/network-scripts +DEV=$1 + +[ -z "$DEV" ] && { + echo "usage: tnlup " >&2 + exit 1 +} + . /etc/sysconfig/network-scripts/.functions . /etc/sysconfig/network -CONFIG=$1 +TNLCONFIGS="`ls /etc/sysconfig/interfaces/tnlcfg-*|egrep -v '~$'`" +TNLCONFIGS="`egrep -L '^#!' $TNLCONFIGS`" +CONFIG="`egrep -l "DEVICE=[\"\']*$DEV[\"\']*\$" $TNLCONFIGS`" -[ -z "$CONFIG" ] && { - echo "usage: tnldown " >&2 - exit 1 -} +if [ -z "$CONFIG" ]; then + CONFIG="$DEV" +fi +if false; then [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || CONFIG=tnlcfg-$CONFIG [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || { - echo "usage: tnldown " >&2 + echo "usage: tnlup " >&2 exit 1 } +fi source_config -if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ] -then - exit -fi - if [ "${IPV6_TUNNELCONFIG}" != "yes" ] && [ "${MODE}" = "sit" ] || \ [ "${IPX}" != "yes" ] && [ "${MODE}" = "ipxip" ] || \ [ "${IPX}" != "yes" ] && [ "${MODE}" = "ipipx" ] diff --git a/sysconfig/network-scripts/tnlup b/sysconfig/network-scripts/tnlup index bf445b7a..127d7d37 100755 --- a/sysconfig/network-scripts/tnlup +++ b/sysconfig/network-scripts/tnlup @@ -1,25 +1,35 @@ #!/bin/sh # -# $Id: tnlup,v 1.13 1999/10/13 21:28:40 kloczek Exp $ +# $Id: tnlup,v 1.14 1999/11/06 00:23:54 wiget Exp $ # # Author: Arkadiusz Mi¶kiewicz # -. /etc/sysconfig/network-scripts/.functions -. /etc/sysconfig/network - -CONFIG=$1 +DEV=$1 -[ -z "$CONFIG" ] && { +[ -z "$DEV" ] && { echo "usage: tnlup " >&2 exit 1 } +. /etc/sysconfig/network-scripts/.functions +. /etc/sysconfig/network + +TNLCONFIGS="`ls /etc/sysconfig/interfaces/tnlcfg-*|egrep -v '~$'`" +TNLCONFIGS="`egrep -L '^#!' $TNLCONFIGS`" +CONFIG="`egrep -l "DEVICE=[\"\']*$DEV[\"\']*\$" $TNLCONFIGS`" + +if [ -z "$CONFIG" ]; then + CONFIG="$DEV" +fi + +if false; then [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || CONFIG=tnlcfg-$CONFIG [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || { echo "usage: tnlup " >&2 exit 1 } +fi source_config