From 7431ebfbe9536c5801940b8fcccb51d1cb76cb68 Mon Sep 17 00:00:00 2001 From: rubo77 <github@r.z11.de> Date: Sat, 17 Jun 2017 08:00:30 +0200 Subject: [PATCH] FIRST must be <= switch_timeframe --- README.md | 4 ++-- .../files/lib/gluon/ssid-changer/ssid-changer.sh | 14 ++++++++------ .../luasrc/lib/gluon/upgrade/500-ssid-changer | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e02b177..6008c02 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ Adapt and add this block to your site.conf: ``` ssid_changer = { - switch_timeframe = 1, -- only once every timeframe (in minutes) the SSID will change to OFFLINE + switch_timeframe = 30, -- only once every timeframe (in minutes) the SSID will change to OFFLINE -- set to 1440 to change once a day -- set to 1 minute to change every time the router gets offline - first = 5, -- the first few minutes directly after reboot within which an Offline-SSID always may be activated + first = 5, -- the first few minutes directly after reboot within which an Offline-SSID always may be activated (must be <= switch_timeframe) prefix = 'FF_OFFLINE_', -- use something short to leave space for the nodename (no '~' allowed!) suffix = 'nodename', -- generate the SSID with either 'nodename', 'mac' or to use only the prefix: 'none' diff --git a/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh b/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh index 0538237..a33bbf2 100755 --- a/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh +++ b/gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh @@ -11,17 +11,19 @@ pgrep -f autoupdater >/dev/null && safety_exit 'autoupdater running' [ $(cat /proc/uptime | sed 's/\..*//g') -gt 60 ] || safety_exit 'less than one minute' [ $(find /var/run -name hostapd-phy* | wc -l) -lt 0 ] || safety_exit 'no hostapd-phy*' -# only once every timeframe the SSID will change to OFFLINE (set to 1 minute to change every time the router gets offline) +# only once every timeframe minutes the SSID will change to OFFLINE +# (set to 1 minute to change immediately every time the router gets offline) MINUTES="$(uci -q get ssid-changer.settings.switch_timeframe)" -# the first few minutes directly after reboot within which an Offline-SSID always may be activated -: ${MINUTES:=1} +: ${MINUTES:=30} +# the first few minutes directly after reboot within which an Offline-SSID always may be activated +# (must be <= switch_timeframe) FIRST="$(uci -q get ssid-changer.settings.first)" -# use something short to leave space for the nodename (no '~' allowed!) : ${FIRST:=5} +# the Offline-SSID will start with this prefix use something short to leave space for the nodename +# (no '~' allowed!) PREFIX="$(uci -q get ssid-changer.settings.prefix)" -# the Offline-SSID will start with this prefix : ${PREFIX:='FF_OFFLINE_'} if [ "$(uci -q get ssid-changer.settings.enabled)" = '0' ]; then @@ -30,8 +32,8 @@ else DISABLED='0' fi -SETTINGS_SUFFIX="$(uci -q get ssid-changer.settings.suffix)" # generate the ssid with either 'nodename', 'mac' or to use only the prefix set to 'none' +SETTINGS_SUFFIX="$(uci -q get ssid-changer.settings.suffix)" : ${SETTINGS_SUFFIX:='nodename'} if [ $SETTINGS_SUFFIX = 'nodename' ]; then diff --git a/gluon-ssid-changer/luasrc/lib/gluon/upgrade/500-ssid-changer b/gluon-ssid-changer/luasrc/lib/gluon/upgrade/500-ssid-changer index 5de2476..8f89fd2 100755 --- a/gluon-ssid-changer/luasrc/lib/gluon/upgrade/500-ssid-changer +++ b/gluon-ssid-changer/luasrc/lib/gluon/upgrade/500-ssid-changer @@ -7,7 +7,7 @@ local uci = require('simple-uci').cursor() if not uci:get('ssid-changer', 'settings', 'enabled') then uci:section('ssid-changer', 'main', 'settings', { enabled = '1', - switch_timeframe = site.ssid_changer.switch_timeframe or '1', + switch_timeframe = site.ssid_changer.switch_timeframe or '30', first = site.ssid_changer.first or '5', prefix = site.ssid_changer.prefix or 'FF_OFFLINE_', suffix = site.ssid_changer.suffix or 'nodename', -- GitLab