ports/opt (3.2): wpa_supplicant: add script to start wpa_supplicant together with dhcpcd (FS#1209)
commit 8fab25309d2d3b1b86dec3a353629a1ea53df10f Author: Juergen Daubert <jue@jue.li> Date: Mon Sep 21 11:58:17 2015 +0200 wpa_supplicant: add script to start wpa_supplicant together with dhcpcd (FS#1209) diff --git a/wpa_supplicant/.footprint b/wpa_supplicant/.footprint index 58bdf26..4e2d821 100644 --- a/wpa_supplicant/.footprint +++ b/wpa_supplicant/.footprint @@ -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/ diff --git a/wpa_supplicant/.md5sum b/wpa_supplicant/.md5sum index ae17477..6d4a7a8 100644 --- a/wpa_supplicant/.md5sum +++ b/wpa_supplicant/.md5sum @@ -1 +1,2 @@ +3295bcafa5f4c7fb46dbfcece4f2f0a6 wlan f0037dbe03897dcaf2ad2722e659095d wpa_supplicant-2.4.tar.gz diff --git a/wpa_supplicant/Pkgfile b/wpa_supplicant/Pkgfile index 6139518..c215d07 100644 --- a/wpa_supplicant/Pkgfile +++ b/wpa_supplicant/Pkgfile @@ -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 } diff --git a/wpa_supplicant/wlan b/wpa_supplicant/wlan new file mode 100644 index 0000000..666d30c --- /dev/null +++ b/wpa_supplicant/wlan @@ -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 +
participants (1)
-
crux@crux.nu