#!/bin/sh # # wpa_supplicant: Service to manage WPA rekeying # chkconfig: 2345 09 91 # description: wpa_supplicant does dynamic rekeying for WPA on wireless connections. SERVICE=wpa_supplicant # Source function library. . /etc/rc.d/init.d/functions . /etc/sysconfig/network [ ${NETWORKING} = "no" ] && exit 0 if [ -r /etc/sysconfig/$SERVICE ] then . /etc/sysconfig/$SERVICE fi if [ -z "$WPAARGS" ] then WPAARGS="" # try and auto-detect driver and device DRIVERARGS=`awk '/^alias *(ath|eth|wlan).* *(ath_|ipw2.00|ndiswrapper|prism54|atmel*)/ {sub(/ipw2.00/, "ipw"); sub(/ath_.*/, "madwifi"); print "-i",$2,"-D",$3}' /etc/modprobe.conf` if [ -n "$DRIVERARGS" ] then WPAARGS=${WPAOPTS:-"-B -w -c /etc/wpa_supplicant.conf ${DRIVERARGS}"} fi fi start() { gprintf "Starting $SERVICE: " daemon $SERVICE $WPAARGS RETVAL=$? if [ $RETVAL -eq 0 ] then touch /var/lock/subsys/$SERVICE fi echo return $RETVAL } stop() { gprintf "Shutting down $SERVICE: " killproc $SERVICE RETVAL=$? if [ $RETVAL -eq 0 ] then rm -f /var/lock/subsys/$SERVICE fi echo return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; condrestart) [ -e /var/lock/subsys/$SERVICE ] && (stop; start) ;; status) status $SERVICE ;; *) gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0" exit 1 esac exit $?