Add support for Ubiquity Unifi AC LITE

This commit is contained in:
Daniel Gröber 2018-04-13 23:57:13 +02:00
parent 985794524f
commit d39f95282b
17 changed files with 160 additions and 33 deletions

View File

@ -15,7 +15,7 @@ mkdir -p "$IMAGEDIR"
VERSION="$(basename "$(git describe --always --tags --dirty --match 'access-points/*')")"
IMAGEDIR="$IMAGEDIR"/"$VERSION"
mkdir "$IMAGEDIR"
mkdir -p "$IMAGEDIR"
imagebuilder="$(basename "$IMAGEBUILDER_URL")"
@ -28,25 +28,34 @@ tar -C "$BUILDDIR" -axf "$DLDIR"/"$imagebuilder"
IMAGEBUILDER_DIR="$BUILDDIR"/"$(tar -atf "$DLDIR"/"$imagebuilder" | head -n1)"
image="lede-ar71xx-generic-tl-wr841-v10-squashfs-sysupgrade.bin"
profile=$(. "$CONTROL"; echo "${PROFILE}")
(
IFS='
'
export PROFILE PACKAGES
. "$CONTROL"
tmp=$(mktemp --tmpdir -d files.XXXXXXXXX)
cp -aLTv "$TOPDIR/$FILES" "$tmp"
mkdir -p "$tmp"/etc
echo "$VERSION" > "$tmp"/etc/its-access-point-version
if [ -n "$COMMON_FILES" ]; then
cp -aLTv "$TOPDIR/$COMMON_FILES" "$tmp"
fi
if [ -n "$FILES" ]; then
cp -aLTv "$TOPDIR/$FILES" "$tmp"
fi
cd "$IMAGEBUILDER_DIR"
make image FILES="$tmp"
unset COMMON_FILES
make image FILES="$tmp" 1>&2
)
cp "$IMAGEBUILDER_DIR"/bin/targets/ar71xx/generic/"$image" "$IMAGEDIR"/
cp "$IMAGEBUILDER_DIR"/bin/targets/ar71xx/generic/lede*-ar71xx-generic-"${profile}"-squashfs-sysupgrade.bin "$IMAGEDIR"/
{
printf '%s\n' "Date: $(date -R)"
@ -55,6 +64,6 @@ cp "$IMAGEBUILDER_DIR"/bin/targets/ar71xx/generic/"$image" "$IMAGEDIR"/
printf 'Checksums-Sha512:\n'
{
( cd "$DLDIR" ; sha512sum "$imagebuilder" )
( cd "$IMAGEDIR"; sha512sum "$image")
( cd "$IMAGEDIR"; sha512sum lede*-ar71xx-generic-"${profile}"-squashfs-sysupgrade.bin )
} | sed 's/^/ /'
} > "$IMAGEDIR"/image-manifest

View File

@ -1,5 +1,6 @@
PROFILE=tl-wr841-v10
FILES=files/tl-wr841-v10
COMMON_FILES=files/common/its
PACKAGES='
collectd
collectd-mod-wireless

View File

@ -0,0 +1,9 @@
PROFILE=ubnt-unifiac-lite
FILES=files/ubnt-unifiac-lite
COMMON_FILES=files/common/its
PACKAGES='
collectd
collectd-mod-wireless
collectd-mod-interface
collectd-mod-load
collectd-mod-network'

View File

@ -1,5 +1,13 @@
#!/bin/sh
uci_set_forall_wifi_ifaces () {
WIFI_IFACES=$(uci show wireless | sed -nr 's/^wireless\.([^=]+)=wifi-iface*$/\1/p')
for iface in $WIFI_IFACES; do
uci set wireless.$iface."$1"
done
}
logger -t wifi-uplink hotplug "$DEVICE" "$INTERFACE" "$ACTION"
# 'lan' doesn't work for some reason
@ -9,12 +17,12 @@ logger -t wifi-uplink devchange "$DEVICE" "$INTERFACE" "$ACTION"
[ "$ACTION" = ifup ] && {
logger -t wifi-uplink up "$DEVICE" "$INTERFACE" "$ACTION"
uci set wireless.@wifi-device[0].disabled=0
uci_set_forall_wifi_ifaces disabled=0
wifi
}
[ "$ACTION" = ifdown ] && {
logger -t wifi-uplink down "$DEVICE" "$INTERFACE" "$ACTION"
wifi down
uci set wireless.@wifi-device[0].disabled=1
uci_set_forall_wifi_ifaces disabled=1
}

View File

@ -0,0 +1,61 @@
#!/bin/sh
set -e
set -u
mac=$(cat /sys/class/net/wlan0/address)
hostname=
channel_11a=
channel_11g=
if [ "$mac" = 60:e3:27:b8:16:ec ]; then
hostname=cz-ap0
channel_11g=6
elif [ "$mac" = 60:e3:27:ed:86:9a ]; then
hostname=cz-ap1
channel_11g=11
elif [ "$mac" = 78:8a:20:82:d6:bd ]; then
hostname=cz-ap2
channel_11a=108
htmode_11a=VHT80
elif [ "$mac" = 60:e3:27:ed:9b:b0 ]; then
hostname=lz-ap0
channel_11g=1
fi
# disable root password login
sed -i 's/^root.*$/root:*:0:0:99999:7:::/' /etc/shadow
uci set system.@system[0].hostname=$hostname
uci commit system
echo $(uci get system.@system[0].hostname) > /proc/sys/kernel/hostname
uci set dropbear.@dropbear[0].PasswordAuth='off'
uci set dropbear.@dropbear[0].RootPasswordAuth='off'
uci commit dropbear
/etc/init.d/dropbear restart
#WIFI_IFACES=$(uci show wireless | sed -nr 's/^wireless\.([^=]+)=wifi-iface*$/\1/p')
WIFI_DEVICES=$(uci show wireless | sed -nr 's/^wireless\.([^=]+)=wifi-device*$/\1/p')
for radio in $WIFI_DEVICES; do
disabled=1
if [ $(uci get wireless.$radio.hwmode) = '11a' ]; then
# 5 GHz
if [ -n "$channel_11a" ]; then
uci set wireless.$radio.channel=$channel_11a
uci set wireless.$radio.htmode=${htmode_11a:-HT20}
disabled=0
fi
elif [ $(uci get wireless.$radio.hwmode) = '11g' ]; then
# 2.4 GHz
if [ -n "$channel_11g" ]; then
uci set wireless.$radio.channel=$channel_11g
disabled=0
fi
fi
uci set wireless.$radio.disabled=$disabled
uci set wireless.$radio.country=AT
done
uci commit wireless

View File

@ -0,0 +1 @@
../../../../../../.git/annex/objects/Vk/8w/SHA256E-s95--196dc6eecef78da77ea459b552dc3e0690f7c8e99007105d9715020ba7c60480/SHA256E-s95--196dc6eecef78da77ea459b552dc3e0690f7c8e99007105d9715020ba7c60480

View File

@ -1,23 +0,0 @@
#!/bin/sh
set -e
mac=$(cat /sys/class/net/wlan0/address)
hostname=
channel=
if [ "$mac" = 60:e3:27:b8:16:ec ]; then
hostname=cz-ap0
channel=6
elif [ "$mac" = 60:e3:27:ed:86:9a ]; then
hostname=cz-ap1
channel=11
elif [ "$mac" = 60:e3:27:ed:9b:b0 ]; then
hostname=lz-ap0
channel=1
fi
uci set system.@system[0].hostname=$hostname
uci commit system
uci set wireless.radio0.channel=$channel
uci commit wireless
echo $(uci get system.@system[0].hostname) > /proc/sys/kernel/hostname

View File

@ -1 +0,0 @@
../../../../../.git/annex/objects/Vk/8w/SHA256E-s95--196dc6eecef78da77ea459b552dc3e0690f7c8e99007105d9715020ba7c60480/SHA256E-s95--196dc6eecef78da77ea459b552dc3e0690f7c8e99007105d9715020ba7c60480

View File

@ -0,0 +1,15 @@
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'apctl'
option ifname 'eth1.2'
option proto 'dhcp'
config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'dhcp'

View File

@ -0,0 +1,15 @@
config system
option hostname 'ITS-AP-AC-LITE-unassigned'
option timezone 'UTC'
option ttylogin '0'
option log_size '64'
option urandom_seed '0'
config timeserver 'ntp'
option enabled '1'
option enable_server '0'
list server '0.lede.pool.ntp.org'
list server '1.lede.pool.ntp.org'
list server '2.lede.pool.ntp.org'
list server '3.lede.pool.ntp.org'

View File

@ -0,0 +1,32 @@
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11a'
option path 'pci0000:00/0000:00:00.0'
option htmode 'VHT80'
option disabled '1'
option channel '108'
option country 'AT'
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option ssid 'it-syndikat 5 GHz'
option encryption 'psk2'
config wifi-device 'radio1'
option type 'mac80211'
option channel '11'
option hwmode '11g'
option path 'platform/qca956x_wmac'
option htmode 'HT20'
option disabled '1'
option country 'AT'
config wifi-iface 'default_radio1'
option device 'radio1'
option network 'lan'
option mode 'ap'
option ssid 'it-syndikat'
option encryption 'psk2'