#!/bin/sh # # ifplugd.action for ArchLinux # . /etc/rc.conf # wireless settings [ -f /etc/conf.d/wireless ] && . /etc/conf.d/wireless # dhcpcd settings [ -f /etc/conf.d/dhcpcd ] && . /etc/conf.d/dhcpcd ifup() { eval iwcfg="\$wlan_${1}" if [ "$iwcfg" != "" ]; then /usr/sbin/iwconfig $iwcfg /bin/sleep 2 fi eval ifcfg="\$${1}" if [ "$ifcfg" = "dhcp" ]; then /sbin/dhcpcd $DHCPCD_ARGS ${1} else /sbin/ifconfig $ifcfg fi return $? } ifdown() { eval ifcfg="\$${1}" if [ "$ifcfg" = "dhcp" ]; then /bin/kill $(cat /var/run/dhcpcd-${1}.pid) fi /sbin/ifconfig ${1} down return $? } case "$2" in up) ifup $1 # ugly way to load up gateway, since # al's net configuration doesn't associate # gateways with specific interfaces /sbin/route add $gateway ;; down) ifdown $1 # same as up... /sbin/route del $1 ;; *) echo "Wrong arguments" > /dev/stderr ;; esac exit 1