forked from erikkugel/SlackBuilds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cd /etc/hostapd | ||
|
||
for NEW_CONFIG_FILE in $(find . -type f -name 'hostapd\.[a-z]*\.new' -maxdepth 1); do | ||
CONFIG_FILE=$(basename ${NEW_CONFIG_FILE} .new) | ||
if ! [ -f ${CONFIG_FILE} ]; then | ||
mv ${NEW_CONFIG_FILE} ${CONFIG_FILE} | ||
fi | ||
done | ||
|
||
if [ -f wired.conf.new ] && [ ! -f wired.conf ]; then | ||
mv -v -f wired.conf.new wired.conf | ||
fi | ||
|
||
mkdir -p -v /var/run/hostapd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
# | ||
# Ernest Kugel, July 2015 | ||
|
||
PRGNAM="hostapd" | ||
VERSION="2.6" | ||
APP_URL=https://w1.fi/releases/${PRGNAM}-${VERSION}.tar.gz | ||
BUILD_DIR=/tmp/SlackBuild-${PRGNAM}-$(date +%s) | ||
TAG=1 | ||
|
||
set -e | ||
|
||
if [ "$(getconf LONG_BIT)" == "64" ]; then | ||
LIBDIRSUFFIX="64" | ||
export CFLAGS="-fPIC" | ||
export CPPFLAGS="-fPIC" | ||
else | ||
LIBDIRSUFFIX="" | ||
fi | ||
|
||
# Download | ||
mkdir -v -p ${BUILD_DIR}/install ${BUILD_DIR}/etc/rc.d ${BUILD_DIR}/src | ||
if ! [ -f ${PRGNAM}-${VERSION}.tar.gz ]; then | ||
wget ${APP_URL} | ||
fi | ||
tar -v -x -z -C ${BUILD_DIR}/src -f ./${PRGNAM}-${VERSION}.tar.gz | ||
cp -v -f ./slack-desc ${BUILD_DIR}/install/slack-desc | ||
cp -v -f ./doinst.sh ${BUILD_DIR}/install/doinst.sh | ||
cp -v -f ./rc.hostapd ${BUILD_DIR}/etc/rc.d/rc.hostapd | ||
|
||
# Build | ||
cd ${BUILD_DIR}/src/${PRGNAM}-${VERSION}/hostapd | ||
|
||
cat defconfig > .config | ||
sed -i 's/^#CONFIG_IEEE80211N=[ny]/CONFIG_IEEE80211N=y/' .config | ||
sed -i 's/^#CONFIG_ACS=[ny]/CONFIG_ACS=y/' .config | ||
|
||
make install DESTDIR=${BUILD_DIR} -j$(grep -Pc 'processor\t:[0-9]*' /proc/cpuinfo) V=99 | ||
mkdir -v -p ${BUIDL_DIR}/usr/local/bin ${BUILD_DIR}/etc/hostapd ${BUILD_DIR}/usr/local/man/man1 ${BUILD_DIR}/usr/local/man/man8 | ||
|
||
# Stage binaries that are not installed by default | ||
cp -v -f wps-ap-nfc.py ${BUILD_DIR}/usr/local/bin | ||
chmod +x ${BUILD_DIR}/usr/local/bin/wps-ap-nfc.py | ||
|
||
# Stage all sample configs as .new | ||
for CONFIG_FILE in $(find . -type f -name 'hostapd\.[a-z]*' -maxdepth 1); do | ||
cp -v -f ${CONFIG_FILE} ${BUILD_DIR}/etc/hostapd/${CONFIG_FILE}.new | ||
done | ||
cp -v -f wired.conf ${BUILD_DIR}/etc/hostapd | ||
|
||
# Stage manual pages | ||
gzip -v -c hostapd_cli.1 > ${BUILD_DIR}/usr/local/man/man1/hostapd_cli.1.gz | ||
gzip -v -c hostapd_cli.1 > ${BUILD_DIR}/usr/local/man/man1/hostapd_cli.1.gz | ||
|
||
cd ${BUILD_DIR} | ||
rm -v -r -f ${BUILD_DIR}/src | ||
|
||
# Create package | ||
/sbin/makepkg -l y -c n /tmp/${PRGNAM}-${VERSION}-$(uname -m)-${TAG}.txz | ||
rm -v -r -f ${BUILD_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
# Start/stop/restart hostapd. | ||
PID_FILE=/var/run/hostapd.pid | ||
|
||
# Start hostapd: | ||
hostapd_start() { | ||
CMDLINE="/usr/local/bin/hostapd" | ||
echo "Starting HostAP daemon..." | ||
$CMDLINE -B -P ${PID_FILE} /etc/hostapd/hostapd.conf | ||
echo | ||
} | ||
|
||
# Stop hostapd: | ||
hostapd_stop() { | ||
echo -n "Stopping HostAP daemon..." | ||
if [ -r ${PID_FILE} ]; then | ||
kill -HUP $(cat ${PID_FILE}) | ||
rm -f ${PID_FILE} | ||
else | ||
killall -HUP -q hostapd | ||
fi | ||
echo | ||
} | ||
|
||
# Restart hostapd: | ||
hostapd_restart() { | ||
hostapd_stop | ||
sleep 1 | ||
hostapd_start | ||
} | ||
|
||
# Check if hostapd is running | ||
hostapd_status() { | ||
if [ -e ${PID_FILE} ]; then | ||
echo "hostapd is running." | ||
else | ||
echo "hostapd is stopped." | ||
exit 1 | ||
fi | ||
} | ||
|
||
case "$1" in | ||
'start') | ||
hostapd_start | ||
;; | ||
'stop') | ||
hostapd_stop | ||
;; | ||
'restart') | ||
hostapd_restart | ||
;; | ||
'status') | ||
hostapd_status | ||
;; | ||
*) | ||
echo "usage $0 start|stop|restart|status" | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
hostapd: hostapd | ||
hostapd: | ||
hostapd: IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator | ||
hostapd: | ||
hostapd: | ||
hostapd: | ||
hostapd: | ||
hostapd: | ||
hostapd: | ||
hostapd: | ||
hostapd: (https://w1.fi/hostapd/) |