From 653edd9eae969665dd30fb1a7fc047e2c26d5e29 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 31 Jul 2026 12:35:56 +0200 Subject: [PATCH] hotspot-to-wpa-lease: early exit with :exit --- hotspot-to-wpa-lease.capsman.rsc | 8 +++----- hotspot-to-wpa-lease.template.rsc | 8 +++----- hotspot-to-wpa-lease.wifi.rsc | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/hotspot-to-wpa-lease.capsman.rsc b/hotspot-to-wpa-lease.capsman.rsc index e237eae6..489933de 100644 --- a/hotspot-to-wpa-lease.capsman.rsc +++ b/hotspot-to-wpa-lease.capsman.rsc @@ -4,7 +4,7 @@ # https://rsc.eworm.de/COPYING.md # # provides: dhcpv4-server-lease, order=40 -# requires RouterOS, version=7.21 +# requires RouterOS, version=7.22 # requires device-mode, hotspot # # add private WPA passphrase after hotspot login @@ -12,7 +12,6 @@ # # !! Do not edit this file, it is generated from template! -:local ExitOK false; :onerror Err { :global GlobalConfigReady; :global GlobalFunctionsReady; :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ @@ -25,8 +24,7 @@ :global ScriptLock; :if ([ $ScriptLock $ScriptName ] = false) do={ - :set ExitOK true; - :error false; + :exit; } :if ([ :len [ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={ @@ -96,5 +94,5 @@ /caps-man/access-list/set $Entry action=accept; } } do={ - :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; + :global ExitOnError; $ExitOnError [ :jobname ] $Err; } diff --git a/hotspot-to-wpa-lease.template.rsc b/hotspot-to-wpa-lease.template.rsc index b432a756..734f7b2a 100644 --- a/hotspot-to-wpa-lease.template.rsc +++ b/hotspot-to-wpa-lease.template.rsc @@ -4,7 +4,7 @@ # https://rsc.eworm.de/COPYING.md # # provides: dhcpv4-server-lease, order=40 -# requires RouterOS, version=7.21 +# requires RouterOS, version=7.22 # requires device-mode, hotspot # # add private WPA passphrase after hotspot login @@ -13,7 +13,6 @@ # !! This is just a template to generate the real script! # !! Pattern '%TEMPL%' is replaced, paths are filtered. -:local ExitOK false; :onerror Err { :global GlobalConfigReady; :global GlobalFunctionsReady; :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ @@ -26,8 +25,7 @@ :global ScriptLock; :if ([ $ScriptLock $ScriptName ] = false) do={ - :set ExitOK true; - :error false; + :exit; } :if ([ :len [ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={ @@ -116,5 +114,5 @@ /interface/wifi/access-list/set $Entry action=accept; } } do={ - :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; + :global ExitOnError; $ExitOnError [ :jobname ] $Err; } diff --git a/hotspot-to-wpa-lease.wifi.rsc b/hotspot-to-wpa-lease.wifi.rsc index 7e152863..4b91a545 100644 --- a/hotspot-to-wpa-lease.wifi.rsc +++ b/hotspot-to-wpa-lease.wifi.rsc @@ -4,7 +4,7 @@ # https://rsc.eworm.de/COPYING.md # # provides: dhcpv4-server-lease, order=40 -# requires RouterOS, version=7.21 +# requires RouterOS, version=7.22 # requires device-mode, hotspot # # add private WPA passphrase after hotspot login @@ -12,7 +12,6 @@ # # !! Do not edit this file, it is generated from template! -:local ExitOK false; :onerror Err { :global GlobalConfigReady; :global GlobalFunctionsReady; :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ @@ -25,8 +24,7 @@ :global ScriptLock; :if ([ $ScriptLock $ScriptName ] = false) do={ - :set ExitOK true; - :error false; + :exit; } :if ([ :len [ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={ @@ -93,5 +91,5 @@ /interface/wifi/access-list/set $Entry action=accept; } } do={ - :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; + :global ExitOnError; $ExitOnError [ :jobname ] $Err; }