aboutsummaryrefslogtreecommitdiff
path: root/etc.BSD/rc.devd
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-23 12:16:12 +0000
committerRoy Marples <roy@marples.name>2007-11-23 12:16:12 +0000
commitd1090165f8cf273584a293d71a44c6e5eaa8378d (patch)
tree73587e094884e134a9ee3bee766a247bd3168ccd /etc.BSD/rc.devd
parentcd0cd1167e7d59218f5bfe3088c3c63e0ce4abf5 (diff)
Add devd and hooks
Diffstat (limited to 'etc.BSD/rc.devd')
-rw-r--r--etc.BSD/rc.devd27
1 files changed, 27 insertions, 0 deletions
diff --git a/etc.BSD/rc.devd b/etc.BSD/rc.devd
new file mode 100644
index 00000000..38425a1f
--- /dev/null
+++ b/etc.BSD/rc.devd
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+export IN_BACKGROUND=yes
+export IN_HOTPLUG=yes
+
+getmedia() {
+ ifconfig $1 | while read line; do
+ case ${line} in
+ media:" "*) echo "${line}"; return;;
+ esac
+ done
+}
+
+set -x
+if [ ! -e /etc/init.d/"$1" ]; then
+ base=$(basename ${1%%.*})
+ if [ "${base}" = "net" ]; then
+ # We only create links for pyhsical interfaces
+ [ -n "$(getmedia ${1#*.})" ] || exit 1
+ base="net.lo0"
+ fi
+ if [ -e /etc/init.d/"${base}" -a "${base}" != "$1" ]; then
+ ln -s "${base}" /etc/init.d/$1
+ fi
+fi
+
+exec /etc/init.d/$1 $2