diff options
author | Rémy Oudompheng <remy@archlinux.org> | 2011-08-20 13:13:35 +0200 |
---|---|---|
committer | Rémy Oudompheng <remy@archlinux.org> | 2011-08-20 13:13:35 +0200 |
commit | 1227a80b24c943438757e933bd568ceddd00479b (patch) | |
tree | e88638495f85726377dfa6cf4279ab31c3f54534 /rc.d/net-auto-wired | |
parent | ec0e041a8eab919abef8e3af289c979ee1737382 (diff) | |
download | netctl-1227a80b24c943438757e933bd568ceddd00479b.tar.gz netctl-1227a80b24c943438757e933bd568ceddd00479b.tar.xz |
Reorganize files to match install location closer
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Diffstat (limited to 'rc.d/net-auto-wired')
-rwxr-xr-x | rc.d/net-auto-wired | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/rc.d/net-auto-wired b/rc.d/net-auto-wired new file mode 100755 index 0000000..9af8505 --- /dev/null +++ b/rc.d/net-auto-wired @@ -0,0 +1,52 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +if [[ ! -x /usr/sbin/ifplugd ]]; then + echo "Please install 'ifplugd' to use net-auto-wired" + exit 1 +fi + +CFG=/etc/ifplugd/ifplugd.conf +ACTION=/etc/ifplugd/netcfg.action +PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid +[[ -f $PIDFILE ]] && PID=$(cat $PIDFILE) + +# Source ifplugd configuration +[ -f $CFG ] && . $CFG + +case "$1" in + start) + stat_busy "Starting netcfg auto-wired mode for interface ${WIRED_INTERFACE}" + A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`" + [ -z "$A" ] && A="$ARGS" + [ -z "$PID" ] && /usr/sbin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A + # 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 + stat_done + fi + ;; + stop) + stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}" + [ -n "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon net-auto-wired + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 |