All pastes #103885 Raw Edit

naderman

public shellscript v1 · immutable
#103885 ·published 2006-07-28 14:51 UTC
rendered paste body
#!/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/binDAEMON=/usr/sbin/wpa_supplicantPIDFILE="/var/run/wpasupplicant.pid"CONFIG="/etc/wpa_supplicant.conf"PNAME="wpa_supplicant"# insane defaultsOPTIONS="-Bw" # daemonize and wait for interfaceENABLED=0[ -f /etc/default/wpasupplicant ] && . /etc/default/wpasupplicantif [ "$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 0set -ecase "$1" in        start)                echo -n "Starting wpa_supplicant: "                start-stop-daemon --start --name $PNAME \                        --oknodo --startas $DAEMON -- -B $OPTIONS                echo "done."                ;;        stop)                echo -n "Stopping wpa_supplicant: "                start-stop-daemon --stop --name $PNAME \                        --oknodo                echo "done."                if [ -f $PIDFILE ]; then                        rm -f $PIDFILE;                fi                ;;        reload|force-reload)                echo -n "Reloading wpa_supplicant: "                start-stop-daemon --stop --signal HUP \                        --name $PNAME                echo "done."                ;;        restart)                echo -n "Restarting wpa_supplicant: "                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: wpa_supplicant {start|stop|restart|reload|force-reload}" >&2                exit 1                ;;esacexit 0