:global GlobalFuncReady false;
# Git commit id & info, expected configuration version
-:global CommitId "main/535/47072049";
+:global CommitId "main/536/3e6969a3";
:global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 09:35:03 04.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 09:55:03 04.05.2026.";
# The variables are received right here.
:global GlobalConfVersion 138;
}
:set FetchHuge do={
- :local ScriptName [ :tostr $1 ];
+ :local FHScript [ :tostr $1 ];
:local Url [ :tostr $2 ];
:local CheckCert [ :tostr $3 ];
:global WaitForFile;
:set CheckCert [ $IfThenElse ($CheckCert = "false") "no" "yes-without-crl" ];
- :local DirName ("tmpfs/" . [ $CleanName $ScriptName ]);
+ :local DirName ("tmpfs/" . [ $CleanName $FHScript ]);
:if ([ $MkDir $DirName ] = false) do={
:log error ($0 . " Failed creating directory!");
:return false;
:local FileName ($DirName . "/" . [ $CleanName $0 ] . "-" . [ $GetRandom20CharAlNum ]);
:onerror Err {
/tool/fetch check-certificate=$CheckCert $Url dst-path=$FileName \
- http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) as-value;
+ http-header-field=({ [ $FetchUserAgentStr $FHScript ] }) as-value;
} do={
:if ([ $WaitForFile $FileName 500ms ] = true) do={
$RmFile $FileName;
:set GlobalConfChanges;
:set GlobalConfMigration;
}
-} do={:global ExitOnError; $ExitOnError $0 $Err}
-}
+} do={
+ :global ExitOnError; $ExitOnError $0 $Err;
+} }
# Add and fix global scheduler
:put "Add or/and fix Global scheduler...";
/system/scheduler/add name="AM-ScriptInstallUpdate" comment=$Comment start-time=startup interval=1d on-event=$OnEvent;
}
-#:local Resource [ /system/resource/get ];
-#:log info ($ScriptName . " Loaded on " . $Resource->"board-name" . " with RouterOS " . $Resource->"version" . " and Architecture " .".");
-
:onerror Err {
:global GlobalConfReady;
- :retry { :if ($GlobalConfReady != true) do={ :error ("Global configs not ready."); }; } delay=100ms max=5;
+ :retry { :if ($GlobalConfReady != true) \
+ do={ :error ("Global config not ready."); }; } delay=500ms max=50;
-# signal we are ready
-:set GlobalFuncReady true;
-:set ExitOK true;
:log warning ("This script $ScriptName Loaded " . \
[ $IfThenElse ($CommitId != "unknown") ([ $CommitBrief ] . " ") ] . \
"on " . $devBoardName . "\nRouterOS: " . $devCurVersion . "\nArchitecture: " . $devCurArch . "\nIdentity: " . $Identity);
-} do={:global ExitOnError; $ExitOnError $0 $Err;}
-#} do={:global ExitError; $ExitError $ExitOK [ :jobname ] $Err}
-# log the successful load of the script, or an error if it failed
-#:if ([$GlobalFuncReady] = true && [$GlobalConfReady] = true) do={
+# signal we are ready
+:set GlobalFunctionsReady true;
+
+} do={
+ :global ExitOnError; $ExitOnError $0 $Err;
+}