diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | mk/os-Linux.mk | 1 | ||||
-rw-r--r-- | udev_helper/Makefile | 11 | ||||
-rw-r--r-- | udev_helper/net.sh | 34 | ||||
-rw-r--r-- | udev_rules/90-network.rules | 8 | ||||
-rw-r--r-- | udev_rules/Makefile | 11 |
6 files changed, 66 insertions, 1 deletions
@@ -4,7 +4,7 @@ include Makefile.inc -SUBDIR = doc init.d net sh +SUBDIR = doc init.d net sh udev_helper udev_rules INSTALLAFTER= _installafter diff --git a/mk/os-Linux.mk b/mk/os-Linux.mk index 40d9c34..618cc3b 100644 --- a/mk/os-Linux.mk +++ b/mk/os-Linux.mk @@ -3,6 +3,7 @@ SFX= .Linux.in PKG_PREFIX?= /usr +UDEVDIR?= $(shell pkg-config udev --variable=udevdir) CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700 LIBDL= -Wl,-Bdynamic -ldl diff --git a/udev_helper/Makefile b/udev_helper/Makefile new file mode 100644 index 0000000..45ad96b --- /dev/null +++ b/udev_helper/Makefile @@ -0,0 +1,11 @@ +DIR= ${UDEVDIR} +SRCS= ${SRCS-${OS}} +BIN= ${BIN-${OS}} + +MK= ../mk +include ${MK}/os.mk + +SRCS-Linux= net.sh +BIN-Linux= net.sh + +include ${MK}/scripts.mk diff --git a/udev_helper/net.sh b/udev_helper/net.sh new file mode 100644 index 0000000..af61870 --- /dev/null +++ b/udev_helper/net.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# net.sh: udev external RUN script +# +# Copyright 2007 Roy Marples <uberlord@gentoo.org> +# Distributed under the terms of the GNU General Public License v2 + +IFACE=$1 +ACTION=$2 + +SCRIPT=/etc/init.d/net.$IFACE + +# ignore interfaces that are registered after being "up" (?) +case ${IFACE} in + ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*|br*) + exit 0 ;; +esac + +# stop here if coldplug is disabled, Bug #206518 +if [ "${do_not_run_plug_service}" = 1 ]; then + exit 0 +fi + +if [ ! -x "${SCRIPT}" ] ; then + #do not flood log with messages, bug #205687 + #logger -t udev-net.sh "${SCRIPT}: does not exist or is not executable" + exit 1 +fi + +# If we're stopping then sleep for a bit in-case a daemon is monitoring +# the interface. This to try and ensure we stop after they do. +[ "${ACTION}" == "stop" ] && sleep 2 + +IN_HOTPLUG=1 "${SCRIPT}" --quiet "${ACTION}" diff --git a/udev_rules/90-network.rules b/udev_rules/90-network.rules new file mode 100644 index 0000000..50903af --- /dev/null +++ b/udev_rules/90-network.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +# /etc/udev/rules/90-network.rules: triggering network init-scripts + +# Activate our network if we can +SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" +SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" + diff --git a/udev_rules/Makefile b/udev_rules/Makefile new file mode 100644 index 0000000..f622ebc --- /dev/null +++ b/udev_rules/Makefile @@ -0,0 +1,11 @@ +DIR= ${UDEVDIR}/rules.d +SRCS= ${SRCS-${OS}} +INC= ${INC-${OS}} + +MK= ../mk +include ${MK}/os.mk + +SRCS-Linux= 90-network.rules +INC-Linux= 90-network.rules + +include ${MK}/scripts.mk |