aboutsummaryrefslogtreecommitdiff
path: root/etc.BSD/rc.devd
diff options
context:
space:
mode:
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