summaryrefslogtreecommitdiffstats
path: root/ifplugd
diff options
context:
space:
mode:
authorRémy Oudompheng <remy@archlinux.org>2011-08-20 13:13:35 +0200
committerRémy Oudompheng <remy@archlinux.org>2011-08-20 13:13:35 +0200
commit1227a80b24c943438757e933bd568ceddd00479b (patch)
treee88638495f85726377dfa6cf4279ab31c3f54534 /ifplugd
parentec0e041a8eab919abef8e3af289c979ee1737382 (diff)
downloadnetctl-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 'ifplugd')
-rwxr-xr-xifplugd/net-auto-wired52
-rw-r--r--ifplugd/net-auto-wired.service13
-rw-r--r--ifplugd/netcfg.action54
3 files changed, 0 insertions, 119 deletions
diff --git a/ifplugd/net-auto-wired b/ifplugd/net-auto-wired
deleted file mode 100755
index 9af8505..0000000
--- a/ifplugd/net-auto-wired
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/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
diff --git a/ifplugd/net-auto-wired.service b/ifplugd/net-auto-wired.service
deleted file mode 100644
index b356fef..0000000
--- a/ifplugd/net-auto-wired.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Provides automatic netcfg wired connection
-Before=network.target
-
-[Service]
-EnvironmentFile=/etc/rc.conf
-EnvironmentFile=-/etc/ifplugd/ifplugd.conf
-ExecStart=-/usr/sbin/ifplugd -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -fIn -u0 -d10
-ExecStop=-/usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action
-Type=simple
-
-[Install]
-WantedBy=multi-user.target
diff --git a/ifplugd/netcfg.action b/ifplugd/netcfg.action
deleted file mode 100644
index 0c081df..0000000
--- a/ifplugd/netcfg.action
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-#
-# ifplugd.action script for netcfg
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-. /usr/lib/network/network
-shopt -s extglob
-
-case "$2" in
- up)
- # Look for a dhcp based profile to try first
- # dhcp can actually outright fail, whereas
- # it's difficult to tell if static succeeded
- # Also check profile is same iface and is right connection
- echo "up"
- declare -a preferred_profiles
- declare -a dhcp_profiles
- declare -a static_profiles
- for profile in $(list_profiles); do (
- load_profile "$profile"
- echo "loading $profile"
- [[ "$INTERFACE" != "$1" ]] && continue
- [[ "$CONNECTION" != @(ethernet|ethernet-iproute) ]] && continue
- checkyesno "${AUTO_WIRED:-no}" && exit 1 # user preferred AUTO profile
- [[ "$IP" == "dhcp" ]] && exit 2 # dhcp profile
- exit 3 # static profile
- )
- case $? in
- 1) preferred_profiles+=("$profile");;
- 2) dhcp_profiles+=("$profile");;
- 3) static_profiles+=("$profile");;
- esac
- done
- if [[ ${#preferred_profiles[@]} > 1 ]]; then
- echo "AUTO_WIRED flag for $1 set in more than one profile (${preferred_profiles[*]})"
- else
- for profile in "${preferred_profiles[@]}" "${dhcp_profiles[@]}" "${static_profiles[@]}"; do (
- netcfg "$profile" && exit 1
- exit 0
- ) || exit 0; done
- fi
- ;;
- down)
- if check_iface "$1"; then
- netcfg -i "$1" && exit 0
- fi
- ;;
- *)
- echo "Wrong arguments" > /dev/stderr
- ;;
-esac
-
-exit 1