diff options
author | James Rayner <james@archlinux.org> | 2009-10-21 15:18:15 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-10-21 15:18:15 +0200 |
commit | d176d9fa5013a0c4a8b25754cec053c24a0d83d1 (patch) | |
tree | c43da11e9be9238ed87bfbe139f04e5a89e35858 /ifplugd/netcfg.action | |
parent | ea1a71895e6b8776cc5f69372836feecbb767df0 (diff) | |
download | netctl-d176d9fa5013a0c4a8b25754cec053c24a0d83d1.tar.gz netctl-d176d9fa5013a0c4a8b25754cec053c24a0d83d1.tar.xz |
Add initial net-auto-wired concept
Diffstat (limited to 'ifplugd/netcfg.action')
-rwxr-xr-x | ifplugd/netcfg.action | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ifplugd/netcfg.action b/ifplugd/netcfg.action new file mode 100755 index 0000000..cb8ad7f --- /dev/null +++ b/ifplugd/netcfg.action @@ -0,0 +1,41 @@ +#!/bin/sh +# +# ifplugd.action script for netcfg + +. /etc/rc.conf +. /etc/rc.d/functions +. /usr/lib/network/network + +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 + for profile in $(list_profiles); do ( + load_profile $profile + [[ $INTERFACE != $1 ]] && continue + [[ $CONNECTION != @(ethernet|ethernet-iproute) ]] && continue + if [[ $IP == "dhcp" ]]; then + netcfg $profile && exit 0 + fi + ) done + for profile in $(list profiles}; do ( + load_profile $profile + [[ $INTERFACE != $1 ]] && continue + [[ $CONNECTION != "(ethernet|ethernet-iproute)" ]] && continue + netcfg $profile && exit 0 + ) done + exit 1 + ;; + down) + if check_iface $1; then + netcfg -i $1 + fi + ;; + *) + echo "Wrong arguments" > /dev/stderr + ;; +esac + +exit 1 |