--- admin/PlamoBuild.template.common.without_comment 2016-06-15 20:51:13.000000000 +0900 +++ plamo/01_minimum/network.txz/old/hostapd-20160920/PlamoBuild.hostapd-2.0 2016-09-20 15:52:27.000000000 +0900 @@ -1,15 +1,16 @@ #!/bin/sh ###################################################################### -url="" -pkgbase= -vers= +url="http://hostap.epitest.fi/releases/hostapd-2.0.tar.gz" +pkgbase=hostapd +vers=2.0 arch=`uname -m` -build=P1 +build=P2 src=$pkgbase-$vers patchfiles="" OPT_CONFIG="" -DOCS="README" +DOCS="COPYING README + `echo hostapd/{ChangeLog,README{,-WPS},{eap_testing,hlr_auc_gw}.txt}`" ###################################################################### fscheck() { @@ -233,8 +234,32 @@ esac done done + cd $B + cp -p hostapd/Makefile{,.orig} + sed 's@/local@@g' hostapd/Makefile.orig \ + | sed 's@\@sbin@g' > hostapd/Makefile + cp -p hostapd/{defconfig,.config} + cat <<- "EOF" | patch hostapd/.config + 10a11 + > CFLAGS += -I/usr/include/libnl3 + 16c17 + < #CONFIG_DRIVER_WIRED=y + --- + > CONFIG_DRIVER_WIRED=y + 106c107 + < #CONFIG_WPS=y + --- + > CONFIG_WPS=y + 155c156 + < #CONFIG_DEBUG_FILE=y + --- + > CONFIG_DEBUG_FILE=y + 269a271,272 + > + > CONFIG_LIBNL32=y + EOF for i in `seq 0 $((${#B[@]} - 1))` ; do - cd ${B[$i]} + cd ${B[$i]}/hostapd if [ -f Makefile ] ; then make clean fi @@ -250,7 +275,7 @@ fi if [ $opt_build -eq 1 ] ; then for i in `seq 0 $((${#B[@]} - 1))` ; do - cd ${B[$i]} + cd ${B[$i]}/hostapd if [ -f Makefile ] ; then make fi @@ -267,11 +292,92 @@ if [ -d $C ] ; then rm -rf $C ; fi ; mkdir -p $C touch $W/i.st ; sleep 1 for i in `seq 0 $((${#B[@]} - 1))` ; do - cd ${B[$i]} + cd ${B[$i]}/hostapd if [ -f Makefile ] ; then make install DESTDIR=$P fi done + install -d $mandir/man1 + install -m 644 $B/hostapd/hostapd_cli.1 $mandir/man1 + install -d $mandir/man8 + install -m 644 $B/hostapd/hostapd.8 $mandir/man8 + install -d $P/etc/rc.d/init.d + cat <<- "EOF" > $P/etc/rc.d/init.d/hostapd + #!/bin/sh + # Start/stop/restart the hostapd (IEEE 802.11 Wireless AP) server: + + start() { + if [ -x /usr/sbin/hostapd ] ; then + hostapd -B /etc/hostapd.conf + fi + } + + stop() { + killall hostapd + } + + case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + sleep 3 + start + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 + ;; + esac + exit 0 + EOF + chmod 644 $P/etc/rc.d/init.d/hostapd + cat <<- "EOF" > $P/etc/hostapd.conf.new + interface=wlan0 + ctrl_interface=/var/run/hostapd + ctrl_interface_group=wheel + ssid="replace SSID" + country_code=JP + ieee80211d=1 + hw_mode=g + macaddr_acl=0 + accept_mac_file=/etc/hostapd.accept + deny_mac_file=/etc/hostapd.deny + auth_algs=1 + wpa=2 + wpa_psk_file=/etc/hostapd.wpa_psk + wpa_key_mgmt=WPA-PSK + rsn_pairwise=CCMP + EOF + cat <<- "EOF" > $P/etc/hostapd.accept.new + # List of MAC addresses that are allowed to authenticate (IEEE 802.11) + # with the AP. + #00:11:22:33:44:55 + #00:66:77:88:99:aa + #00:00:22:33:44:55 + EOF + cat <<- "EOF" > $P/etc/hostapd.deny.new + # List of MAC addresses that are not allowed to authenticate (IEEE 802.11) + # with the AP. + #00:20:30:40:50:60 + #00:ab:cd:ef:12:34 + #00:00:30:40:50:60 + EOF + cat <<- "EOF" > $P/etc/hostapd.wpa_psk.new + # List of WPA PSKs. Each line, except for empty lines and lines starting + # with #, must contain a MAC address and PSK separated with a space. + # Special MAC address 00:00:00:00:00:00 can be used to configure PSKs that + # anyone can use. PSK can be configured as an ASCII passphrase of 8..63 + # characters or as a 256-bit hex PSK (64 hex digits). + #00:00:00:00:00:00 secret passphrase + #00:11:22:33:44:55 another passphrase + #00:22:33:44:55:66 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef + #00:00:00:00:00:00 another passphrase for all STAs + EOF touch $W/i.et cd $W find $P ! -type l -newer i.st ! -newer i.et \ @@ -294,10 +400,34 @@ fi ( cd $docdir ; find ${src[$i]} -type d -exec touch -r $W/{} {} \; ) done + install -d $docdir/$src/hostapd/examples + cp -p $S/hostapd/hostapd.[a-z]* $docdir/$src/hostapd/examples + chmod -R g-w $docdir/$src/hostapd/examples + chown -R root.root $docdir/$src/hostapd/examples + touch -r $S $docdir/$src/hostapd{/examples,} convert - tar cvpf $pkg.tar -C $P `cd $P ; find usr/bin | tail -n+2` + install -d $P/install + cat <<- "EOF" > $P/install/doinst.sh + hostapd_config() { + mv etc/hostapd.$1.new /tmp + if [ -f etc/hostapd.$1 ] ; then + mv /tmp/hostapd.$1.new etc/hostapd.$1.dist + else + mv /tmp/hostapd.$1.new etc/hostapd.$1 + fi + } + + for in conf accept deny wpa_psk; do + hostapd_config $i + done + EOF + touch -t `date '+%m%d0900'` $P/install/doinst.sh + tar cvpf $pkg.tar -C $P `cd $P ; find usr/sbin | tail -n+2` + tar rvpf $pkg.tar -C $P `cd $P ; find etc -type f` tar rvpf $pkg.tar -C $P `cd $P ; find usr/share/man/man1 | tail -n+2` + tar rvpf $pkg.tar -C $P `cd $P ; find usr/share/man/man8 | tail -n+2` tar rvpf $pkg.tar -C $P usr/share/doc/$src + tar rvpf $pkg.tar -C $P install/doinst.sh touch -t `date '+%m%d0900'` $pkg.tar ; xz $pkg.tar ; touch $pkg.tar.xz mv $pkg.tar.xz $pkg.txz read -p "Do you want to keep work files? [y/N] " ans