summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/ifplugd/files/ifplugd.action')
-rw-r--r--sys-apps/ifplugd/files/ifplugd.action55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys-apps/ifplugd/files/ifplugd.action b/sys-apps/ifplugd/files/ifplugd.action
new file mode 100644
index 000000000000..ba4cfd7d20b9
--- /dev/null
+++ b/sys-apps/ifplugd/files/ifplugd.action
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# Gentoo-specific ifplugd.action
+#
+# This file gets called by ifplugd when it wants to bring an interface
+# up or down.
+#
+
+if grep -q initng /proc/1/cmdline
+then
+ EXEC="/sbin/ngc"
+ INITNG="yes"
+else
+ EXEC="/etc/init.d/net.$1"
+ INITNG="no"
+fi
+
+case "$2" in
+ up)
+ if [ "${INITNG}" = "yes" ]
+ then
+ ARGS="-u net/$1"
+ else
+ ARGS="--quiet start"
+ fi
+ ;;
+ down)
+ if [ "${INITNG}" = "yes" ]
+ then
+ ARGS="-d net/$1"
+ else
+ ARGS="--quiet stop"
+ fi
+ ;;
+ *)
+ echo "$0: wrong arguments" >&2
+ echo "Call with <interface> <up|down>" >&2
+ exit 1
+ ;;
+esac
+
+export IN_BACKGROUND=true
+
+if [ -x "${EXEC}" ]
+then
+ ${EXEC} ${ARGS}
+ exit 0
+else
+ logger -t ifplugd.action "Error: Couldn't configure $1, no ${EXEC} !"
+ exit 1
+fi
+
+# vim: set ts=4