summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-scripts/net.modules.d/ifplugd')
-rw-r--r--net-scripts/net.modules.d/ifplugd38
1 files changed, 9 insertions, 29 deletions
diff --git a/net-scripts/net.modules.d/ifplugd b/net-scripts/net.modules.d/ifplugd
index d7006ea..2d6024c 100644
--- a/net-scripts/net.modules.d/ifplugd
+++ b/net-scripts/net.modules.d/ifplugd
@@ -4,19 +4,14 @@
# Contributed by Roy Marples (uberlord@gentoo.org)
-# char* ifplugd_provides(void)
-#
-# Returns a string to change module definition for starting up
-ifplugd_provides() {
- echo "plug"
-}
-
# void ifplugd_depend(void)
#
# Sets up the dependancies for the module
ifplugd_depend() {
- after macnet
+ after macnet rename
before interface
+ functions interface_exists interface_get_mac_address
+ provide plug
}
# bool ifplugd_check_installed(void)
@@ -30,21 +25,6 @@ ifplugd_check_installed() {
return 0
}
-# bool ifplugd_check_depends(void)
-#
-# Checks to see if we have the needed functions
-ifplugd_check_depends() {
- local f
-
- for f in interface_exists interface_get_mac_address; do
- [[ $( type -t "${f}" ) == "function" ]] && continue
- eerror "ifplugd: missing required function ${f}\n"
- return 1
- done
-
- return 0
-}
-
# bool ifplugd_pre_start(char *interface)
#
# Start ifplugd on an interface
@@ -72,7 +52,7 @@ ifplugd_pre_start() {
fi
# We don't work on bridges
- if [[ $(type -t bridge_exists) == "function" ]]; then
+ if is_function bridge_exists ; then
if bridge_exists "${iface}"; then
veinfo "netplug does not work on bridges"
return 0
@@ -80,7 +60,7 @@ ifplugd_pre_start() {
fi
# We don't work on tun/tap interfaces
- if [[ $(type -t tuntap_exists) == "function" ]]; then
+ if is_function tuntap_exists ; then
if tuntap_exists "${iface}"; then
veinfo "netplug does not work on tun/tap interfaces"
return 0
@@ -94,7 +74,7 @@ ifplugd_pre_start() {
# Although ifplugd can, we prefer wpa_supplicant, unless explicitly told
# so via our options
if [[ ${opts} != *" -m wlan "* && ${opts} != *" --api-mode=wlan "* ]]; then
- if [[ $(type -t wireless_check_extensions) == "function" ]]; then
+ if is_function wireless_check_extensions ; then
if wireless_check_extensions "${iface}"; then
veinfo "ifplugd does not work on wireless interfaces"
return 0
@@ -144,11 +124,11 @@ ifplugd_pre_start() {
exit 0
}
-# bool ifplugd_post_stop(char *iface)
+# bool ifplugd_stop(char *iface)
#
# Stops ifplugd on an interface
# Returns 0 (true) when successful, non-zero otherwise
-ifplugd_post_stop() {
+ifplugd_stop() {
${IN_BACKGROUND} && return 0
local iface="$1"
local pidfile="/var/run/ifplugd.${iface}.pid"
@@ -157,7 +137,7 @@ ifplugd_post_stop() {
ebegin "Stopping ifplugd on ${iface}"
start-stop-daemon --stop --exec /usr/sbin/ifplugd \
- --pidfile "${pidfile}"
+ --pidfile "${pidfile}" --signal 3
eend $?
}