From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/netifrc:master commit in: /, udev_rules/, mk/, udev_helper/
Date: Tue, 4 Mar 2014 18:45:53 +0000 (UTC) [thread overview]
Message-ID: <1393957513.31acef83a5328bc14b5ebf6b6d132e6c4bdb336e.robbat2@OpenRC> (raw)
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
reply other threads:[~2014-03-04 18:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393957513.31acef83a5328bc14b5ebf6b6d132e6c4bdb336e.robbat2@OpenRC \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox