hotspot-to-wpa-cleanup: drop main function, use :do with on-error

This commit is contained in:
Christian Hesse 2024-03-06 15:28:55 +01:00
parent 47b67af226
commit b622f47d65
3 changed files with 12 additions and 18 deletions

View file

@ -14,8 +14,8 @@
:global GlobalFunctionsReady; :global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local Main do={ :do {
:local ScriptName [ :tostr $1 ]; :local ScriptName [ :jobname ];
:global EitherOr; :global EitherOr;
:global LogPrintExit2; :global LogPrintExit2;
@ -23,7 +23,7 @@
:global ScriptLock; :global ScriptLock;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={ :if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false; :error false;
} }
:local DHCPServers ({}); :local DHCPServers ({});
@ -71,6 +71,4 @@
/ip/dhcp-server/lease/remove $Lease; /ip/dhcp-server/lease/remove $Lease;
} }
} }
} } on-error={ }
$Main [ :jobname ];

View file

@ -15,8 +15,8 @@
:global GlobalFunctionsReady; :global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local Main do={ :do {
:local ScriptName [ :tostr $1 ]; :local ScriptName [ :jobname ];
:global EitherOr; :global EitherOr;
:global LogPrintExit2; :global LogPrintExit2;
@ -24,7 +24,7 @@
:global ScriptLock; :global ScriptLock;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={ :if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false; :error false;
} }
:local DHCPServers ({}); :local DHCPServers ({});
@ -78,6 +78,4 @@
/ip/dhcp-server/lease/remove $Lease; /ip/dhcp-server/lease/remove $Lease;
} }
} }
} } on-error={ }
$Main [ :jobname ];

View file

@ -14,8 +14,8 @@
:global GlobalFunctionsReady; :global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local Main do={ :do {
:local ScriptName [ :tostr $1 ]; :local ScriptName [ :jobname ];
:global EitherOr; :global EitherOr;
:global LogPrintExit2; :global LogPrintExit2;
@ -23,7 +23,7 @@
:global ScriptLock; :global ScriptLock;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={ :if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false; :error false;
} }
:local DHCPServers ({}); :local DHCPServers ({});
@ -71,6 +71,4 @@
/ip/dhcp-server/lease/remove $Lease; /ip/dhcp-server/lease/remove $Lease;
} }
} }
} } on-error={ }
$Main [ :jobname ];