* [gentoo-commits] proj/netifrc:master commit in: /, udev_rules/, mk/, udev_helper/
@ 2014-03-04 18:45 Robin H. Johnson
0 siblings, 0 replies; only message in thread
From: Robin H. Johnson @ 2014-03-04 18:45 UTC (permalink / raw
To: gentoo-commits
commit: 31acef83a5328bc14b5ebf6b6d132e6c4bdb336e
Author: Samuli Suominen <ssuominen <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 4 18:25:13 2014 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 4 18:25:13 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=31acef83
move udev rules from udev-init-scripts to netifrc
udev-init-scripts contains some rules to trigger network activation on
device creation. There are actually netifrc specific, so let's package
them instead.
X-Gentoo-Bug: 487922
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=487922#c4
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
Makefile | 2 +-
mk/os-Linux.mk | 1 +
udev_helper/Makefile | 11 +++++++++++
udev_helper/net.sh | 34 ++++++++++++++++++++++++++++++++++
udev_rules/90-network.rules | 8 ++++++++
udev_rules/Makefile | 11 +++++++++++
6 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index eba493e..8630c03 100644
--- a/Makefile
+++ b/Makefile
@@ -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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-04 18:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04 18:45 [gentoo-commits] proj/netifrc:master commit in: /, udev_rules/, mk/, udev_helper/ Robin H. Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox