]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- start some scripts after interface is upped or downed
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 8 Mar 2000 16:30:14 +0000 (16:30 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 8 Mar 2000 16:30:14 +0000 (16:30 +0000)
  (/etc/sysconfig/interfaces/scripts/ifname/somename.{up,down}

svn-id: @665

README
rc.d/init.d/functions.network
sysconfig/network-scripts/ifdown-post
sysconfig/network-scripts/ifup
sysconfig/network-scripts/ifup-post

diff --git a/README b/README
index 245ace03ad57a505f1a632c8c51d90d244342e63..6d91a4381d56819015f9d178bd3258dbc220bcaa 100644 (file)
--- a/README
+++ b/README
@@ -1,9 +1,15 @@
 
-       $Id: README,v 1.4 1999/09/02 12:38:52 misiek Exp $
+       $Id: README,v 1.5 2000/03/08 16:30:13 misiek Exp $
 
-If you want use this rc-scripts remember to compile 'netlink'
-support into your kernel. This is very important !
-([*] Kernel/User netlink socket)
+CRITICAL THINGS
+If you want use this rc-scripts remember to compile:
+- Kernel/User netlink socket
+support into your kernel. This is very important ! Without
+this network scripts will fail.
 
-If you want use IPv6 networking remember to compile 'IPv6 support'
-into you kernel !
+STANDARD THINGS
+If you want use IPv6 networking remember to compile:
+- The IPv6 protocol (EXPERIMENTAL) 
+- IPv6: enable EUI-64 token format
+- IPv6: disable provider based addresses
+into your kernel (last two options are optional) !
index 859150fc3b4b0f07f1567196cf081f6e9eace737..f5c1b0ede69841975960bfa10c5d72c06f0e0211 100755 (executable)
@@ -1,5 +1,5 @@
 #
-# $Id: functions.network,v 1.36 2000/02/03 11:50:04 misiek Exp $
+# $Id: functions.network,v 1.37 2000/03/08 16:30:14 misiek Exp $
 # vi:syntax=sh
 # This is not a shell script; it provides functions to network scripts
 # that source it.
@@ -127,6 +127,26 @@ fi
 # PLD/Linux network functions
 # (C) 1999 Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
 #
+
+# same as shell script run-parts from *cron* daemons
+rparts()
+{
+if [ -d "$1" -a "$ISALIAS" = "no" ]; then
+       if [ "$2" = "start" ]; then
+               FLIST="`ls $1/*.up | xargs 2>/dev/null`"
+       else if [ "$2" = "stop" ]; then
+               FLIST="`ls $1/*.down | xargs 2>/dev/null`"
+            fi
+       fi
+       for i in $FLIST ; do
+               [ -d $i ] && continue
+               if [ -x $i ]; then
+                       $i
+               fi
+       done
+fi
+}
+
 # All functions must be called "name_of_function on" or "name_of_function off"
 
 # Setup Network Address Translation (NAT)
index f1c67c55e1ecfbdd97a617789d311daab277a3eb..f30545ac3c235c0a5adc48d5f6b39af38ac16482 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: ifdown-post,v 1.8 1999/10/13 21:28:40 kloczek Exp $
+#      $Id: ifdown-post,v 1.9 2000/03/08 16:30:14 misiek Exp $
 #
 # This should be called whenever an interface goes down, not just when
 # it is brought down explicitly.
@@ -12,6 +12,23 @@ CONFIG=$1
 
 source_config
 
+# full device name as specified by user
+FULLDEVNAME="$DEVICE"
+# type of device for example "dummy" or "eth"
+DEVICETYPE=`echo $FULLDEVNAME | sed "s/[0-9]*$//"`
+# name of real device ie. eth0 when eth0,eth0:1,eth0:alias
+DEVICE=`echo $FULLDEVNAME | sed 's/:.*//g'`
+
+if echo "$FULLDEVNAME" | grep -q ':' ; then
+        ISALIAS=yes
+else
+        ISALIAS=no
+fi
+
+# run scripts in /etc/sysconfig/interfaces/scripts/$DEVICE/
+# named somename.up
+rparts "/etc/sysconfig/interfaces/scripts/$DEVICE" stop
+
 # Notify programs that have requested notification
 do_netreport
 
index 9ba44b18e8ecf53a9268381fc6e0cc4917237da2..38e3cdf34154f45235872e44589d647d3f38c21e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: ifup,v 1.35 1999/12/19 16:06:02 jajcus Exp $
+#      $Id: ifup,v 1.36 2000/03/08 16:30:14 misiek Exp $
 #
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
@@ -13,7 +13,7 @@ need_hostname
 DEV=$1
 
 [ -z "$DEV" ] && {
-    echo "usage: ifup <device name>" >&2
+    nls "usage: ifup <device name>" >&2
     exit 1
 }
 
@@ -21,7 +21,7 @@ if [ `id -u` != 0 ]; then
     if [ -x /sbin/usernetctl ]; then
        exec /sbin/usernetctl $DEV up
     fi
-    echo "Users cannot control this device." >&2
+    nls "Users cannot control this device." >&2
     exit 1
 fi
 
@@ -49,7 +49,7 @@ IPSETUP=no
 FULLDEVNAME="$DEVICE"
 # detect network device type (dummy, eth ..)
 DEVICETYPE=`echo $FULLDEVNAME | sed "s/[0-9]*$//"`
-# przyjmuje eth0 przy {eth0,eth0:1,eth0:alias}
+# real name of device (is eth0 for eth0,eth0:1,eth0:alias)
 DEVICE=`echo $FULLDEVNAME | sed 's/:.*//g'`
 
 if echo "$FULLDEVNAME" | grep -q ':' ; then
@@ -69,7 +69,7 @@ fi
 
 # IPv4, IPv6 or both ?
 [ -n "$IPV6_ADDR" ]                  && IPv6=yes || IPv6=no
-[ -n "$IPADDR" -o "$PUMP" = "true" ] && IPv4=yes || IPv4=no
+[ -n "$IPADDR" -o "$PUMP" = "true" ] && IPv4=yes || IPv6=no
 
 # Tunnel device ?
 [ -f /etc/sysconfig/interfaces/tnlcfg-${FULLDEVNAME} ] && TNL=yes || TNL=no
@@ -91,9 +91,9 @@ if [ -z "$NETMASK" -a -n "$PREFIX" ]; then
 fi
 
 [ "$MULTICAST" = "yes" ] && MULTICAST=on               || MULTICAST=off
-[ -n "$SRC_ADDR" ]        && SRC_ADDR="src ${SRC_ADDR}" || SRC_ADDR=""
-[ -n "$SCOPE" ]        && SCOPE="scope ${SCOPE}" || SCOPE=""
-[ -z "$PROTOCOL" ]        && PROTOCOL=ip
+[ -n "$SRC_ADDR" ]       && SRC_ADDR="src ${SRC_ADDR}" || SRC_ADDR=""
+[ -n "$SCOPE" ]          && SCOPE="scope ${SCOPE}"     || SCOPE=""
+[ -z "$PROTOCOL" ]       && PROTOCOL=ip
 
 if [ "$ARP" ]; then
        [ "$ARP" = "yes" ]      && ARP=on       || ARP=off
@@ -135,11 +135,11 @@ fi
 
 if [ -n "$PUMP" -a "$ISALIAS" = "no" ]; then
 
-    echo -n "Determining IP information for $FULLDEVNAME..."
+    echo -n "`nls "Determining IP information for"` $FULLDEVNAME..."
     if /sbin/pump -i $FULLDEVNAME ; then
-       echo " done."
+       nls " done."
     else
-       echo " failed."
+       nls " failed."
        exit 1
     fi
 
index c533701af7c8530ada8ec82a44a9a4053cd88be2..705fce7b1842c68fe4d23df1c4e6217ac2e3779e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: ifup-post,v 1.15 1999/12/19 16:07:02 jajcus Exp $
+#      $Id: ifup-post,v 1.16 2000/03/08 16:30:14 misiek Exp $
 #
 
 . /etc/sysconfig/network
@@ -10,11 +10,11 @@ need_hostname
 CONFIG=$1
 source_config
 
-# pelna nazwa dewajsa jaka podal user
+# full device name as specified by user
 FULLDEVNAME="$DEVICE"
-# przyjmuje warto¶æ np: "dummy" czy "eth" itd.
+# type of device for example "dummy" or "eth"
 DEVICETYPE=`echo $FULLDEVNAME | sed "s/[0-9]*$//"`
-# przyjmuje eth0 przy {eth0,eth0:1,eth0:alias}
+# name of real device ie. eth0 when eth0,eth0:1,eth0:alias
 DEVICE=`echo $FULLDEVNAME | sed 's/:.*//g'`
 
 if echo "$FULLDEVNAME" | grep -q ':' ; then
@@ -36,6 +36,10 @@ if [ -n "$NEEDHOSTNAME" -a "${DEVICE}" != lo -a "${DEVICETYPE}" != "ppp" -a "${D
        eval `/bin/ipcalc --silent --hostname ${IPADDR}` && set_hostname $HOSTNAME
 fi
 
+# run scripts in /etc/sysconfig/interfaces/scripts/$DEVICE/
+# named somename.up
+rparts "/etc/sysconfig/interfaces/scripts/$DEVICE" start
+
 # Notify programs that have requested notification
 do_netreport
 
This page took 0.161243 seconds and 4 git commands to generate.