wpa_supplicant: add script to start wpa_supplicant together with dhcpcd (FS#1209)

This commit is contained in:
Juergen Daubert 2015-09-21 11:58:17 +02:00
parent f9050bf43d
commit 8fab25309d
4 changed files with 61 additions and 2 deletions

View File

@ -1,4 +1,6 @@
drwxr-xr-x root/root etc/
drwxr-xr-x root/root etc/rc.d/
-rwxr-xr-x root/root etc/rc.d/wlan
lrwxrwxrwx root/root etc/wpa.conf -> wpa_supplicant.conf
-rw------- root/root etc/wpa_supplicant.conf
drwxr-xr-x root/root usr/

View File

@ -1 +1,2 @@
3295bcafa5f4c7fb46dbfcece4f2f0a6 wlan
f0037dbe03897dcaf2ad2722e659095d wpa_supplicant-2.4.tar.gz

View File

@ -5,8 +5,9 @@
name=wpa_supplicant
version=2.4
release=1
source=(http://hostap.epitest.fi/releases/$name-$version.tar.gz)
release=2
source=(http://hostap.epitest.fi/releases/$name-$version.tar.gz
wlan)
build () {
cd $name-$version/$name
@ -28,4 +29,7 @@ build () {
# symlink for compatibility with older releases
ln -s wpa_supplicant.conf $PKG/etc/wpa.conf
# rc script
install -D -m 0755 $SRC/wlan $PKG/etc/rc.d/wlan
}

52
wpa_supplicant/wlan Normal file
View File

@ -0,0 +1,52 @@
#!/bin/sh
#
# /etc/rc.d/wlan: start/stop wireless interface
#
DEV=wlp3s0
SSD=/sbin/start-stop-daemon
PROG_DHCP=/sbin/dhcpcd
PROG_WIFI=/usr/sbin/wpa_supplicant
PID_DHCP=/var/run/dhcpcd.pid
PID_WIFI=/var/run/wpa_supplicant.pid
OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV"
OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV"
print_status() {
$SSD --status --pidfile $2
case $? in
0) echo "$1 is running with pid $(cat $2)" ;;
1) echo "$1 is not running but the pid file $2 exists" ;;
3) echo "$1 is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
}
case $1 in
start)
$SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI
$SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP
;;
stop)
$SSD --stop --retry 10 --pidfile $PID_DHCP
$SSD --stop --retry 10 --pidfile $PID_WIFI
;;
restart)
$0 stop
$0 start
;;
status)
print_status $PROG_WIFI $PID_WIFI
print_status $PROG_DHCP $PID_DHCP
;;
*)
echo "Usage: $0 [start|stop|restart|status]"
;;
esac
# End of file