r1765 - in crux-2.2/ports/opt: . udev-netif-hotplug-handler
Author: jw Date: 2006-08-23 21:48:06 +0200 (Wed, 23 Aug 2006) New Revision: 1765 Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/ crux-2.2/ports/opt/udev-netif-hotplug-handler/.footprint crux-2.2/ports/opt/udev-netif-hotplug-handler/.md5sum crux-2.2/ports/opt/udev-netif-hotplug-handler/26-crux-netif.rules crux-2.2/ports/opt/udev-netif-hotplug-handler/Pkgfile crux-2.2/ports/opt/udev-netif-hotplug-handler/README crux-2.2/ports/opt/udev-netif-hotplug-handler/netif_handler Log: udev-netif-hotplug-handler: initial commit Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/.footprint =================================================================== --- crux-2.2/ports/opt/udev-netif-hotplug-handler/.footprint (rev 0) +++ crux-2.2/ports/opt/udev-netif-hotplug-handler/.footprint 2006-08-23 19:48:06 UTC (rev 1765) @@ -0,0 +1,7 @@ +drwxr-xr-x root/root etc/ +drwxr-xr-x root/root etc/udev/ +drwxr-xr-x root/root etc/udev/rules.d/ +-rw-r--r-- root/root etc/udev/rules.d/26-crux-netif.rules +drwxr-xr-x root/root lib/ +drwxr-xr-x root/root lib/udev/ +-rwxr-xr-x root/root lib/udev/netif_handler Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/.md5sum =================================================================== --- crux-2.2/ports/opt/udev-netif-hotplug-handler/.md5sum (rev 0) +++ crux-2.2/ports/opt/udev-netif-hotplug-handler/.md5sum 2006-08-23 19:48:06 UTC (rev 1765) @@ -0,0 +1,2 @@ +7bf9a4d9a27373c7402735fbd3ff1f1f 26-crux-netif.rules +7e3eef4cd843bf9c4b53b0e2d83abedc netif_handler Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/26-crux-netif.rules =================================================================== --- crux-2.2/ports/opt/udev-netif-hotplug-handler/26-crux-netif.rules (rev 0) +++ crux-2.2/ports/opt/udev-netif-hotplug-handler/26-crux-netif.rules 2006-08-23 19:48:06 UTC (rev 1765) @@ -0,0 +1,3 @@ +# Network hotplugging +ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="*", RUN+="/lib/udev/netif_handler" +ACTION=="remove", SUBSYSTEM=="net", ENV{INTERFACE}=="*", RUN+="/lib/udev/netif_handler" Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/Pkgfile =================================================================== --- crux-2.2/ports/opt/udev-netif-hotplug-handler/Pkgfile (rev 0) +++ crux-2.2/ports/opt/udev-netif-hotplug-handler/Pkgfile 2006-08-23 19:48:06 UTC (rev 1765) @@ -0,0 +1,15 @@ +# Maintainer: Johannes Winkelmann, jw at smts dot ch +# Description: udev network interface hotplug handler +# URL: http://crux.nu/ +# Depends on: udev + +name=udev-netif-hotplug-handler +version=1.2 +release=1 +source=(netif_handler 26-crux-netif.rules) + +build() { + install -m 755 -D netif_handler $PKG/lib/udev/netif_handler + install -m 644 -D 26-crux-netif.rules \ + $PKG/etc/udev/rules.d/26-crux-netif.rules +} Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/README =================================================================== --- crux-2.2/ports/opt/udev-netif-hotplug-handler/README (rev 0) +++ crux-2.2/ports/opt/udev-netif-hotplug-handler/README 2006-08-23 19:48:06 UTC (rev 1765) @@ -0,0 +1,6 @@ +This port implements a hotplug handler for network devices, allowing to react +on hotplug events i.e. to assign an IP. + +Once active, a handler script will call + /etc/rc.d/net.<ifname> [start|stop] +where 'ifname' is the name of the interface, i.e. eth0, ath0, usb0 etc. Added: crux-2.2/ports/opt/udev-netif-hotplug-handler/netif_handler =================================================================== --- crux-2.2/ports/opt/udev-netif-hotplug-handler/netif_handler (rev 0) +++ crux-2.2/ports/opt/udev-netif-hotplug-handler/netif_handler 2006-08-23 19:48:06 UTC (rev 1765) @@ -0,0 +1,47 @@ +#!/bin/bash +# udev network interface starter +# adapted from +# http://linuxfromscratch.org/pipermail/cross-lfs/2006-January/001042.html +# +# Johannes Winkelmann, jw at smts dot ch + +version=1.2 +DEBUG=no + +log() { + logger $* +} +debug() { + if [ x"$DEBUG" = "xyes" ]; then + log $* + fi +} + + +# validate $INTERFACE +case "$INTERFACE" in + "") + debug_log "$call: empty device; exiting" + exit 1 + ;; + ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*) + debug_log "assuming $INTERFACE is already up" + exit 0 + ;; +esac + +# valid interface, try calling the appropriate handler +call=`basename $0` +if [ ! -f /etc/rc.d/net.$INTERFACE ]; then + debug_log "$call: not found: /etc/rc.d/net.$INTERFACE" + exit 0 +fi + +if [ "$ACTION" = "add" ]; then + command=start +else + command=stop +fi + +/etc/rc.d/net.$INTERFACE $command +log "$call $INTERFACE $command"
participants (1)
-
crux@crux.nu