mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-01 16:54:38 +02:00
hotspot-to-wpa: use $ExitError to indicate unintentional error
This commit is contained in:
parent
f7b96aa3e9
commit
8e12453058
3 changed files with 21 additions and 3 deletions
|
@ -13,6 +13,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
@ -25,11 +26,13 @@
|
|||
:local UserName $username;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
||||
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
@ -57,6 +60,7 @@
|
|||
|
||||
:if ($Template->"action" = "reject") do={
|
||||
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
|
||||
|
@ -95,4 +99,6 @@
|
|||
|
||||
:delay 2s;
|
||||
/caps-man/access-list/set $Entry action=accept;
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
@ -26,11 +27,13 @@
|
|||
:local UserName $username;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
||||
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
@ -64,6 +67,7 @@
|
|||
|
||||
:if ($Template->"action" = "reject") do={
|
||||
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
|
||||
|
@ -115,4 +119,6 @@
|
|||
:delay 2s;
|
||||
/caps-man/access-list/set $Entry action=accept;
|
||||
/interface/wifi/access-list/set $Entry action=accept;
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
@ -25,11 +26,13 @@
|
|||
:local UserName $username;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
|
||||
$LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
@ -57,6 +60,7 @@
|
|||
|
||||
:if ($Template->"action" = "reject") do={
|
||||
$LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
|
||||
|
@ -92,4 +96,6 @@
|
|||
|
||||
:delay 2s;
|
||||
/interface/wifi/access-list/set $Entry action=accept;
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue