--- admin/PlamoBuild-template-20170415 2017-04-15 12:25:32.000000000 +0900 +++ plamo/01_minimum/network.txz/hostapd/PlamoBuild.hostapd-2.5 2017-06-14 07:51:32.000000000 +0900 @@ -1,18 +1,19 @@ #!/bin/sh ###################################################################### -url="" +url="http://hostap.epitest.fi/releases/hostapd-2.5.tar.gz" verify= digest= commitid= -pkgbase= -vers= +pkgbase=hostapd +vers=2.5 arch=`uname -m` -build=P1 +build=P2 src=$pkgbase-$vers patchfiles="" OPT_CONFIG="" -DOCS="README" +DOCS="CONTRIBUTIONS COPYING README + `echo hostapd/{ChangeLog,README{,-WPS},{eap_testing,hlr_auc_gw}.txt}`" template=20170415 tmplurl=ftp://plamo.linet.gr.jp/pub/Plamo-src/admin ###################################################################### @@ -36,8 +37,28 @@ if [ -d ${B[$i]} ] ; then rm -rf ${B[$i]} ; fi ; cp -a ${S[$i]} ${B[$i]} done apply_patches + cd $B + cp -p hostapd/{defconfig,.config} + cat <<- "EOF" | patch hostapd/.config + 16c16 + < #CONFIG_DRIVER_WIRED=y + --- + > CONFIG_DRIVER_WIRED=y + 31c31 + < #CONFIG_LIBNL32=y + --- + > CONFIG_LIBNL32=y + 114c114 + < #CONFIG_WPS=y + --- + > CONFIG_WPS=y + 164c164 + < #CONFIG_DEBUG_FILE=y + --- + > CONFIG_DEBUG_FILE=y + EOF for i in `seq 0 $((${#B[@]} - 1))` ; do - cd ${B[$i]} + cd ${B[$i]}/hostapd if [ -x configure ] ; then ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ --libdir='${exec_prefix}'/$libdir --infodir='${prefix}'/share/info \ @@ -47,9 +68,9 @@ 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 + make BINDIR=/usr/sbin fi done fi @@ -59,21 +80,108 @@ 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 + make install DESTDIR=$P BINDIR=/usr/sbin 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 + 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 + install -m 644 $B/hostapd/hostapd.accept $P/etc/hostapd.accept.new + sed -i '/^00/s/^/#/' $P/etc/hostapd.accept.new + install -m 644 $B/hostapd/hostapd.deny $P/etc/hostapd.deny.new + sed -i '/^00/s/^/#/' $P/etc/hostapd.deny.new + install -m 644 $B/hostapd/hostapd.wpa_psk $P/etc/hostapd.wpa_psk.new + sed -i '/^00/s/^/#/' $P/etc/hostapd.wpa_psk.new + 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 touch $W/i.et cd $W find $P ! -type l -newer i.st ! -newer i.et \ -exec touch -t `date '+%m%d0900'` {} \; compress setup_docdir + 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_links - 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 i 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 cleanup