contrib/meshwizard: Move the check if VAPs are supported in a seperate script so we can reuse it later by luci-app-meshwizard, also check if hostapd[-mini] is installed when using mac80211
This commit is contained in:
parent
baba6d3dee
commit
a951a5991d
3 changed files with 38 additions and 11 deletions
|
@ -4,7 +4,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=meshwizard
|
PKG_NAME:=meshwizard
|
||||||
PKG_RELEASE:=0.0.8-2
|
PKG_RELEASE:=0.0.8-3
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
|
|
@ -80,17 +80,9 @@ uci_commitverbose "Setup wifi interface for $netrenamed" wireless
|
||||||
## VAP
|
## VAP
|
||||||
ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
|
ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
|
||||||
|
|
||||||
|
# check if this hardware supports VAPs
|
||||||
supports_vap="0"
|
supports_vap="0"
|
||||||
if [ "$type" = "atheros" ]; then
|
$dir/helpers/supports_vap.sh $net $type && supports_vap=1
|
||||||
supports_vap="1"
|
|
||||||
elif [ "$type" = "mac80211" ]; then
|
|
||||||
# get driver in use
|
|
||||||
netindex="$(echo $net |sed 's/[a-zA-z]*//')"
|
|
||||||
driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
|
|
||||||
if [ "$driver" = "ath9k" -o "$driver" = "ath5k" ]; then
|
|
||||||
supports_vap="1"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
|
if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
|
||||||
uci batch <<- EOF
|
uci batch <<- EOF
|
||||||
|
|
35
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh
Executable file
35
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# checks if a given device can be used for a VAP interface (1 adhoc + 1 ap)
|
||||||
|
dev="$1"
|
||||||
|
type="$2"
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$dev" -o -z "$type" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$type" = "atheros" ]; then
|
||||||
|
exit 0
|
||||||
|
elif [ "$type" = "mac80211" ]; then
|
||||||
|
# not hostapd[-mini], no VAP
|
||||||
|
if [ ! -x /usr/sbin/hostapd ]; then
|
||||||
|
echo "WARNING: hostapd[-mini] is required to be able to use VAP with mac80211."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# get driver in use
|
||||||
|
netindex="$(echo $dev |sed 's/[a-zA-z]*//')"
|
||||||
|
if [ -d /sys/class/net/wlan${netindex}/device/driver/module ]; then
|
||||||
|
driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
|
||||||
|
if [ "$driver" = "ath9k" -o "$driver" = "ath5k" ]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue