You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
1.5 KiB
Bash
95 lines
1.5 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Copyright (C) 2017 devolo AG
|
|
#
|
|
|
|
[ -f /etc/customization.sh ] && . /etc/customization.sh
|
|
|
|
. /lib/functions.sh
|
|
. /lib/delos-functions.sh
|
|
|
|
check_guest_wifi_set() {
|
|
local config="$1"
|
|
config_get_bool dvl_guest "$config" dvl_guest 0
|
|
[ "$dvl_guest" == "1" ] && exit 0
|
|
}
|
|
|
|
board=
|
|
if [ -e /lib/ar71xx.sh ]; then
|
|
. /lib/ar71xx.sh
|
|
board=$(ar71xx_board_name)
|
|
elif [ -e /lib/ipq806x.sh ];then
|
|
. /lib/ipq806x.sh
|
|
board=$(ipq806x_board_name)
|
|
fi
|
|
|
|
# Check if guest wifi already set
|
|
config_load wireless
|
|
config_foreach check_guest_wifi_set wifi-iface
|
|
|
|
SSID=$(dvl_make_default_ssid guest)
|
|
DPWD=$(uci_get_state delos-private baptization DlanSecurityID)
|
|
KEY=${DPWD//-}
|
|
|
|
|
|
add_guest_wifi () {
|
|
uci add
|
|
}
|
|
|
|
WIFI0=$(cat <<EOF
|
|
config wifi-iface
|
|
option device 'wifi0'
|
|
option network 'lan'
|
|
option mode 'ap'
|
|
option ssid '${SSID}'
|
|
option encryption 'psk2'
|
|
option key '${KEY:0:8}'
|
|
option dvl_guest '1'
|
|
option disabled '1'
|
|
option rrm '1'
|
|
option wnm '1'
|
|
option ieee80211r '0'
|
|
EOF
|
|
)
|
|
|
|
WIFI1=$(cat <<EOF
|
|
config wifi-iface
|
|
option device 'wifi1'
|
|
option network 'lan'
|
|
option mode 'ap'
|
|
option ssid '${SSID}'
|
|
option encryption 'psk2'
|
|
option key '${KEY:0:8}'
|
|
option dvl_guest '1'
|
|
option disabled '1'
|
|
option rrm '1'
|
|
option wnm '1'
|
|
option ieee80211r '0'
|
|
EOF
|
|
)
|
|
|
|
case "$board" in
|
|
dvl-1750c |\
|
|
dlan-1000-ac |\
|
|
dlan2-2400-ac |\
|
|
dlan-pro-1200-ac |\
|
|
ew7479cap | \
|
|
ap-dk07.1-c1 | \
|
|
ap151)
|
|
cat >>/etc/config/wireless <<EOF
|
|
$WIFI0
|
|
|
|
$WIFI1
|
|
EOF
|
|
;;
|
|
|
|
dlan-550-wifi |\
|
|
dlan-pro-1200-n)
|
|
cat >>/etc/config/wireless <<EOF
|
|
$WIFI0
|
|
EOF
|
|
;;
|
|
esac
|
|
|
|
exit 0
|