diff --git a/ipv6-dhcp-client-script.rsc b/ipv6-dhcp-client-script.rsc deleted file mode 100644 index c1b2ede1..00000000 --- a/ipv6-dhcp-client-script.rsc +++ /dev/null @@ -1,59 +0,0 @@ -#!rsc by RouterOS -# RouterOS script: ipv6-dhcp-client-script -# Copyright (c) 2026 Christian Hesse -# https://rsc.eworm.de/COPYING.md -# -# requires RouterOS, version=7.22 -# -# TODO -# https://rsc.eworm.de/doc/ipv6-dhcp-client-script.md - -:onerror Err { - :global GlobalConfigReady; :global GlobalFunctionsReady; - :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ - do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50; - :local ScriptName [ :jobname ]; - - :global Grep; - :global LogPrint; - :global ParseKeyValueStore; - :global ScriptLock; - - :if ([ $ScriptLock $ScriptName ] = false) do={ - :exit; - } - - :if (([ :typeof $"na-address" ] = "nothing" || [ :typeof $"na-valid" ] = "nothing") && \ - ([ :typeof $"pd-prefix" ] = "nothing" || [ :typeof $"pd-valid" ] = "nothing")) do={ - $LogPrint error $ScriptName ("This script is supposed to run from ipv6 dhcp-client."); - :exit; - } - - :global IPv6DHCPClientEnvVars { - "na-address"=$"na-address"; - "na-valid"=$"na-valid"; - "pd-prefix"=$"pd-prefix"; - "pd-valid"=$"pd-valid" }; - - :local RunOrder ({}); - :foreach Script in=[ /system/script/find where source~("\n# provides: ipv6-dhcp-client-script\\b") ] do={ - :local ScriptVal [ /system/script/get $Script ]; - :local Store [ $ParseKeyValueStore [ $Grep ($ScriptVal->"source") ("\23 provides: ipv6-dhcp-client-script, ") ] ]; - - :set ($RunOrder->($Store->"order" . "-" . $ScriptVal->"name")) ($ScriptVal->"name"); - } - - :foreach Order,Script in=$RunOrder do={ - :onerror Err { - $LogPrint debug $ScriptName ("Running script with order " . $Order . ": " . $Script); - /system/script/run $Script; - } do={ - $LogPrint warning $ScriptName ("Running script '" . $Script . "' failed: " . $Err); - } - } - - :set IPv6DHCPClientEnvVars; -} do={ - :global IPv6DHCPClientEnvVars; :set IPv6DHCPClientEnvVars; - :global ExitOnError; $ExitOnError [ :jobname ] $Err; -} diff --git a/ipv6-update.rsc b/ipv6-update.rsc index 8d7081f3..7b4e1c3f 100644 --- a/ipv6-update.rsc +++ b/ipv6-update.rsc @@ -4,7 +4,6 @@ # https://rsc.eworm.de/COPYING.md # # requires RouterOS, version=7.22 -# provides: ipv6-dhcp-client-script, order=40 # # update firewall and dns settings on IPv6 prefix change # https://rsc.eworm.de/doc/ipv6-update.md @@ -15,17 +14,14 @@ do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50; :local ScriptName [ :jobname ]; - :global EitherOr; :global LogPrint; :global ParseKeyValueStore; :global ScriptLock; - :global IPv6DHCPClientEnvVars; - - :local NaAddress [ $EitherOr $"na-address" ($IPv6DHCPClientEnvVars->"na-address") ]; - :local NaValid [ $EitherOr $"na-valid" ($IPv6DHCPClientEnvVars->"na-valid") ]; - :local PdPrefix [ $EitherOr $"pd-prefix" ($IPv6DHCPClientEnvVars->"pd-prefix") ]; - :local PdValid [ $EitherOr $"pd-valid" ($IPv6DHCPClientEnvVars->"pd-valid") ]; + :local NaAddress $"na-address"; + :local NaValid $"na-valid"; + :local PdPrefix $"pd-prefix"; + :local PdValid $"pd-valid"; :if ([ $ScriptLock $ScriptName ] = false) do={ :exit;