summaryrefslogtreecommitdiffstats
path: root/ifplugd
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-11-14 01:29:11 +0100
committerJames Rayner <james@archlinux.org>2009-11-14 01:29:11 +0100
commitaf082228395c4c30bc4ae1159cfc6786502bcb3f (patch)
tree05d0684e90c901307e33beffbb69e8c7ca0bee76 /ifplugd
parentecd51d8dc54e1a5c81f2c7d229b60ad089fa9de0 (diff)
downloadnetctl-af082228395c4c30bc4ae1159cfc6786502bcb3f.tar.gz
netctl-af082228395c4c30bc4ae1159cfc6786502bcb3f.tar.xz
finish net-auto-wired, tested and added to Makefile
Diffstat (limited to 'ifplugd')
-rwxr-xr-xifplugd/net-auto-wired9
1 files changed, 6 insertions, 3 deletions
diff --git a/ifplugd/net-auto-wired b/ifplugd/net-auto-wired
index 79e5beb..12d1201 100755
--- a/ifplugd/net-auto-wired
+++ b/ifplugd/net-auto-wired
@@ -5,7 +5,8 @@
CFG=/etc/ifplugd/ifplugd.conf
ACTION=/etc/ifplugd/netcfg.action
-PID=$(cat /var/run/ifplugd.$WIRED_INTERFACE)
+PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid
+[[ -f $PIDFILE ]] && PID=$(cat $PIDFILE)
# Source ifplugd configuration
[ -f $CFG ] && . $CFG
@@ -16,7 +17,9 @@ case "$1" in
A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`"
[ -z "$A" ] && A="$ARGS"
[ -z "$PID" ] && /usr/sbin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A
- if [ $? -gt 0 ]; then
+ # ifplugd may return non-zero, but still succeed if -w is passed, as default in upstream config.
+ sleep 1
+ if [[ ! -f $PIDFILE ]]; then
stat_fail
else
add_daemon net-auto-wired
@@ -25,7 +28,7 @@ case "$1" in
;;
stop)
stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}"
- [ ! -z "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION
+ [ -n "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION
if [ $? -gt 0 ]; then
stat_fail
else