mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Automated ssid and country code updates
This commit is contained in:
parent
d0c14824e1
commit
fd1c48b710
@ -12,6 +12,7 @@ interface=uap0
|
|||||||
wpa=2
|
wpa=2
|
||||||
wpa_pairwise=CCMP
|
wpa_pairwise=CCMP
|
||||||
country_code=IT
|
country_code=IT
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
## Rapberry Pi 3 specific to on board WLAN/WiFi
|
## Rapberry Pi 3 specific to on board WLAN/WiFi
|
||||||
#ieee80211n=1 # 802.11n support (Raspberry Pi 3)
|
#ieee80211n=1 # 802.11n support (Raspberry Pi 3)
|
||||||
#wmm_enabled=1 # QoS support (Raspberry Pi 3)
|
#wmm_enabled=1 # QoS support (Raspberry Pi 3)
|
||||||
@ -22,4 +23,3 @@ country_code=IT
|
|||||||
|
|
||||||
## RaspAP bridge AP mode (disabled by default)
|
## RaspAP bridge AP mode (disabled by default)
|
||||||
#bridge=br0
|
#bridge=br0
|
||||||
ignore_broadcast_ssid=0
|
|
||||||
|
@ -10,8 +10,7 @@ DAEMONPATH="/lib/systemd/system/raspapd.service"
|
|||||||
OPENVPNENABLED=$(pidof openvpn | wc -l)
|
OPENVPNENABLED=$(pidof openvpn | wc -l)
|
||||||
|
|
||||||
positional=()
|
positional=()
|
||||||
while [[ $# -gt 0 ]]
|
while [[ $# -gt 0 ]]; do
|
||||||
do
|
|
||||||
key="$1"
|
key="$1"
|
||||||
|
|
||||||
case $key in
|
case $key in
|
||||||
@ -48,6 +47,24 @@ if [ "${action}" = "stop" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
HOSTAPD_CONF="/etc/hostapd/hostapd.conf"
|
||||||
|
|
||||||
|
old_ssid=$(grep ^ssid $HOSTAPD_CONF | cut -d "=" -f 2)
|
||||||
|
new_ssid="isobox-$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)"
|
||||||
|
|
||||||
|
if [[ "$old_ssid" != "$new_ssid" ]]; then
|
||||||
|
sed -i "s/$old_ssid/$new_ssid/" $HOSTAPD_CONF
|
||||||
|
echo "Updated ssid: $new_ssid"
|
||||||
|
fi
|
||||||
|
|
||||||
|
new_country_code=$(curl -s -H "Authorization: Bearer 9da1eb466ed052" https://ipinfo.io/json | jq -r ".country // empty")
|
||||||
|
old_country_code=$(grep ^country_code $HOSTAPD_CONF | cut -d "=" -f 2)
|
||||||
|
|
||||||
|
if [[ ! -z "$new_country_code" ]] && [[ "$old_country_code" != "$new_country_code" ]]; then
|
||||||
|
sed -i "s/$old_country_code/$new_country_code/" $HOSTAPD_CONF
|
||||||
|
echo "Updated country code: $new_country_code"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$DAEMONPATH" ] && [ ! -z "$interface" ]; then
|
if [ -f "$DAEMONPATH" ] && [ ! -z "$interface" ]; then
|
||||||
echo "Changing RaspAP Daemon --interface to $interface"
|
echo "Changing RaspAP Daemon --interface to $interface"
|
||||||
sed -i "s/\(--interface \)[[:alnum:]]*/\1$interface/" "$DAEMONPATH"
|
sed -i "s/\(--interface \)[[:alnum:]]*/\1$interface/" "$DAEMONPATH"
|
||||||
@ -127,4 +144,3 @@ if [ "${config[WifiAPEnable]}" = 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "RaspAP service start DONE"
|
echo "RaspAP service start DONE"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user