#!/bin/sh # Buyer beware! This is really only useful if you have a # MiniPCI or other permanent wireless device. # However, the wpa_supplicant daemon will start, and sit waiting # for the name interface to come up. Therefore, if you want to use # this with pcmcia or other nonsense, it may be best to ifrename # your wireless interface if it has an "ethX" name that is variable. PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/wpa_supplicant PIDFILE="/var/run/wpasupplicant.pid" CONFIG="/etc/wpa_supplicant.conf" PNAME="wpa_supplicant" # insane defaults OPTIONS="-Bw" # daemonize and wait for interface ENABLED=0 [ -f /etc/default/wpasupplicant ] && . /etc/default/wpasupplicant if [ "$ENABLED" = "0" ]; then echo "wpasupplicant: disabled, see /etc/default/wpasupplicant" exit 0; fi [ -f $CONFIG ] || ( echo "No configuration file found, not starting."; \ exit 1; ) [ -f $DAEMON ] || exit 0 set -e case "$1" in start) echo -n "Starting wpasupplicant: " start-stop-daemon --start --name $PNAME \ --oknodo --startas $DAEMON -- -B $OPTIONS echo "done." ;; stop) echo -n "Stopping wpasupplicant: " start-stop-daemon --stop --name $PNAME \ --oknodo echo "done." if [ -f $PIDFILE ]; then rm -f $PIDFILE; fi ;; reload|force-reload) echo -n "Reloading wpasupplicant: " start-stop-daemon --stop --signal HUP \ --name $PNAME echo "done." ;; restart) echo -n "Restarting wpasupplicant: " start-stop-daemon --stop --name $PNAME \ --retry 5 --oknodo if [ -f $PIDFILE ]; then rm -f $PIDFILE; fi start-stop-daemon --start --name $PNAME \ --oknodo --startas $DAEMON -- -B $OPTIONS echo "done." ;; *) echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0