r1028 - in trunk/udev: . contrib contrib/common contrib/network

jim at linuxfromscratch.org jim at linuxfromscratch.org
Sun Jan 8 22:41:24 PST 2006


Author: jim
Date: 2006-01-08 23:41:24 -0700 (Sun, 08 Jan 2006)
New Revision: 1028

Added:
   trunk/udev/contrib/
   trunk/udev/contrib/common/
   trunk/udev/contrib/common/helper.functions
   trunk/udev/contrib/network/
   trunk/udev/contrib/network/network
   trunk/udev/contrib/network/network_helper.sh
   trunk/udev/contrib/network/rules
Modified:
   trunk/udev/
   trunk/udev/Makefile
Log:
 r1326 at server:  jim | 2006-01-08 22:41:02 -0800
 Added: network helper



Property changes on: trunk/udev
___________________________________________________________________
Name: svk:merge
   - 3949c430-d905-0410-97b6-f115d20341b5:/udev:1314
   + 3949c430-d905-0410-97b6-f115d20341b5:/udev:1326

Modified: trunk/udev/Makefile
===================================================================
--- trunk/udev/Makefile	2006-01-09 06:12:20 UTC (rev 1027)
+++ trunk/udev/Makefile	2006-01-09 06:41:24 UTC (rev 1028)
@@ -4,9 +4,8 @@
 RULESMODE=644
 CONFMODE=644
 
+all: help
 
-all: install
-
 install: device_dirs device_links rules scripts boot mknod_devices
 
 rules:
@@ -73,4 +72,27 @@
 		fi \
 	fi
 
-.PHONY: all install device_dirs device_links rules scripts boot mknod_devices
+help:
+	@echo "command				description"
+	@echo "---------------------------------------------------------------------------------------"
+	@echo "make install			install udev rules package and helper scripts"
+	@echo "make install-network		install network helper package"
+	@echo "make install-network-upgrade	upgrades current network helper package"
+	@echo "---------------------------------------------------------------------------------------"
+
+install-helper-functions:
+	install -m 644 contrib/common/helper.functions ${DESTDIR}/lib/udev/helper.functions
+	
+install-network: install-helper-functions
+	install -m ${SCRIPTMODE} contrib/network/network_helper.sh ${DESTDIR}/lib/udev/network_helper.sh
+	install -m ${INITMODE} contrib/network/network ${DESTDIR}/etc/rc.d/init.d/network
+	@echo "Adding rules to ${DESTDIR}/etc/udev/rules.d/35-helper.rules."
+	@cp ${DESTDIR}/etc/udev/rules.d/35-helper.rules /tmp/first
+	@cat /tmp/first contrib/network/rules > ${DESTDIR}/etc/udev/rules.d/35-helper.rules 2>&1
+
+install-network-update:
+	install -m ${SCRIPTMODE} contrib/network/network_helper.sh ${DESTDIR}/lib/udev/network_helper.sh
+	install -m ${INITMODE} contrib/network/network ${DESTDIR}/etc/rc.d/init.d/network
+
+.PHONY: all install device_dirs device_links rules scripts boot mknod_devices \
+	help install-helper-functions install-network install-network-update

Added: trunk/udev/contrib/common/helper.functions
===================================================================
--- trunk/udev/contrib/common/helper.functions	2006-01-09 06:12:20 UTC (rev 1027)
+++ trunk/udev/contrib/common/helper.functions	2006-01-09 06:41:24 UTC (rev 1028)
@@ -0,0 +1,37 @@
+########################################################################
+#
+# Description : helper.functions
+#
+# Authors     : Jim Gifford
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+# Find Logger
+if [ -x /usr/bin/logger ]; then
+	LOGGER=/usr/bin/logger
+elif [ -x /bin/logger ]; then
+	LOGGER=/bin/logger
+else
+	unset LOGGER
+fi
+
+# Output Routine
+if [ -t 1 -o -z "$LOGGER" ]; then
+	mesg () {
+		echo "$@"
+	}
+else
+	mesg () {
+		$LOGGER -t $(basename $0)"[$$]" "$@"
+	}
+fi
+
+debug_mesg () {
+	test "$DEBUG" = "" -o "$DEBUG" = no && return
+	mesg "$@"
+}
+

Added: trunk/udev/contrib/network/network
===================================================================
--- trunk/udev/contrib/network/network	2006-01-09 06:12:20 UTC (rev 1027)
+++ trunk/udev/contrib/network/network	2006-01-09 06:41:24 UTC (rev 1028)
@@ -0,0 +1,39 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/network
+#
+# Description : Network Control Script
+#
+# Authors     : Gerard Beekmans - gerard at linuxfromscratch.org
+#		Nathan Coulson - nathan at linuxfromscratch.org
+#		Kevin P. Fleming - kpfleming at linuxfromscratch.org
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+. /etc/sysconfig/network
+
+case "${1}" in
+	stop)
+		# Stop all network interfaces
+		IFACE="`ls /sys/class/net`"
+		for interface in $IFACE
+		do
+			if [ "$interface" != "lo" ]; then
+				IN_BOOT=1 ${network_devices}/ifdown ${interface}
+			fi
+		done
+		;;
+
+	*)
+		echo "Usage: ${0} {stop}"
+		exit 1
+		;;
+esac
+
+# End /etc/rc.d/init.d/network


Property changes on: trunk/udev/contrib/network/network
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/udev/contrib/network/network_helper.sh
===================================================================
--- trunk/udev/contrib/network/network_helper.sh	2006-01-09 06:12:20 UTC (rev 1027)
+++ trunk/udev/contrib/network/network_helper.sh	2006-01-09 06:41:24 UTC (rev 1028)
@@ -0,0 +1,58 @@
+#!/bin/sh
+########################################################################
+#
+# Description : network_helper.sh
+#
+# Authors     : Jim Gifford
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /lib/udev/helper.functions
+. /etc/sysconfig/udev_helper
+
+if [ "$INTERFACE" = "" ]; then
+	mesg Bad NET invocation: \$INTERFACE is not set
+	exit 1
+fi
+
+case $ACTION in
+	add)
+		case $INTERFACE in
+
+		ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
+			debug_mesg assuming $INTERFACE is already up
+			exit 0
+		;;
+
+		*)
+			export IN_HOTPLUG=1
+			exec /etc/sysconfig/network-devices/ifup $INTERFACE
+		;;
+
+	esac
+	;;
+
+	remove)
+		case $INTERFACE in
+
+		ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
+			debug_mesg assuming $INTERFACE is already up
+			exit 0
+		;;
+
+		*)
+			export IN_HOTPLUG=1
+			exec /etc/sysconfig/network-devices/ifdown $INTERFACE
+		;;
+
+	esac
+	;;
+
+	*)
+	exit 1
+	;;
+esac


Property changes on: trunk/udev/contrib/network/network_helper.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/udev/contrib/network/rules
===================================================================
--- trunk/udev/contrib/network/rules	2006-01-09 06:12:20 UTC (rev 1027)
+++ trunk/udev/contrib/network/rules	2006-01-09 06:41:24 UTC (rev 1028)
@@ -0,0 +1,4 @@
+# Run network stuff when the network device is loaded
+ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="*", RUN+="network_helper.sh"
+ACTION=="remove", SUBSYSTEM=="net", ENV{INTERFACE}=="*", RUN+="network_helper.sh"
+




More information about the cross-lfs mailing list