mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-22 17:09:33 +00:00
hotspot-to-wpa: early exit with :exit
This commit is contained in:
parent
a78ca10197
commit
12c0ef43e1
3 changed files with 12 additions and 24 deletions
|
|
@ -11,7 +11,6 @@
|
||||||
#
|
#
|
||||||
# !! Do not edit this file, it is generated from template!
|
# !! Do not edit this file, it is generated from template!
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -27,14 +26,12 @@
|
||||||
:local UserName $username;
|
:local UserName $username;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
||||||
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Date [ /system/clock/get date ];
|
:local Date [ /system/clock/get date ];
|
||||||
|
|
@ -61,8 +58,7 @@
|
||||||
|
|
||||||
:if ($Template->"action" = "reject") do={
|
:if ($Template->"action" = "reject") do={
|
||||||
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# allow login page to load
|
# allow login page to load
|
||||||
|
|
@ -101,5 +97,5 @@
|
||||||
:delay 2s;
|
:delay 2s;
|
||||||
/caps-man/access-list/set $Entry action=accept;
|
/caps-man/access-list/set $Entry action=accept;
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
# !! This is just a template to generate the real script!
|
# !! This is just a template to generate the real script!
|
||||||
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
|
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -28,14 +27,12 @@
|
||||||
:local UserName $username;
|
:local UserName $username;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
||||||
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Date [ /system/clock/get date ];
|
:local Date [ /system/clock/get date ];
|
||||||
|
|
@ -68,8 +65,7 @@
|
||||||
|
|
||||||
:if ($Template->"action" = "reject") do={
|
:if ($Template->"action" = "reject") do={
|
||||||
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# allow login page to load
|
# allow login page to load
|
||||||
|
|
@ -121,5 +117,5 @@
|
||||||
/caps-man/access-list/set $Entry action=accept;
|
/caps-man/access-list/set $Entry action=accept;
|
||||||
/interface/wifi/access-list/set $Entry action=accept;
|
/interface/wifi/access-list/set $Entry action=accept;
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
#
|
#
|
||||||
# !! Do not edit this file, it is generated from template!
|
# !! Do not edit this file, it is generated from template!
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -27,14 +26,12 @@
|
||||||
:local UserName $username;
|
:local UserName $username;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
||||||
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Date [ /system/clock/get date ];
|
:local Date [ /system/clock/get date ];
|
||||||
|
|
@ -61,8 +58,7 @@
|
||||||
|
|
||||||
:if ($Template->"action" = "reject") do={
|
:if ($Template->"action" = "reject") do={
|
||||||
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# allow login page to load
|
# allow login page to load
|
||||||
|
|
@ -98,5 +94,5 @@
|
||||||
:delay 2s;
|
:delay 2s;
|
||||||
/interface/wifi/access-list/set $Entry action=accept;
|
/interface/wifi/access-list/set $Entry action=accept;
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue