summaryrefslogtreecommitdiff
path: root/wpa_supplicant/wlan
blob: 9a2f935c5937fcca891ac56a99241a19977040e9 (plain)
    1 #!/bin/sh
    2 #
    3 # /etc/rc.d/wlan: start/stop wireless interface
    4 #
    5 
    6 DEV=wlp3s0
    7 
    8 
    9 SSD=/sbin/start-stop-daemon
   10 PROG_DHCP=/sbin/dhcpcd
   11 PROG_WIFI=/usr/sbin/wpa_supplicant
   12 PID_DHCP=/var/run/dhcpcd.pid
   13 PID_WIFI=/var/run/wpa_supplicant.pid
   14 
   15 OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV"
   16 OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV"
   17 
   18 
   19 print_status() {
   20 	$SSD --status --pidfile $2
   21 	case $? in
   22 	0) echo "$1 is running with pid $(cat $2)" ;;
   23 	1) echo "$1 is not running but the pid file $2 exists" ;;
   24 	3) echo "$1 is not running" ;;
   25 	4) echo "Unable to determine the program status" ;;
   26 	esac
   27 }
   28 
   29 case $1 in
   30 	start)
   31 		$SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \
   32 		$SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP
   33 		RETVAL=$?
   34 		;;
   35 	stop)
   36 		( $SSD --stop --retry 10 --pidfile $PID_DHCP 
   37 		  $SSD --stop --retry 10 --pidfile $PID_WIFI )
   38 		RETVAL=$?
   39 		;;
   40 	restart)
   41 		$0 stop
   42 		$0 start
   43 		;;
   44 	status)
   45 		print_status $PROG_WIFI $PID_WIFI
   46 		print_status $PROG_DHCP $PID_DHCP
   47 		;;
   48 	*)
   49 		echo "Usage: $0 [start|stop|restart|status]"
   50 		;;
   51 esac
   52 
   53 exit $RETVAL
   54 
   55 # End of file

Generated by cgit