1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

global-functions: $ScriptInstallUpdate: get base url and suffix from comment

Just set 'base-url=https://example.com/...' and/or 'url-suffix=\h=branch'
in comment to overwrite settings from global configuration.
This commit is contained in:
Christian Hesse
2020-07-02 00:03:21 +02:00
parent e38f3fb022
commit ef2cb11665

View File

@ -527,9 +527,13 @@
:if ($Ignore = 0) do={
$LogPrintExit debug ("Fetching script from url: " . $ScriptVal->"name") false;
:do {
:local BaseUrl $ScriptUpdatesBaseUrl;
:local UrlSuffix $ScriptUpdatesUrlSuffix;
:if ([ :typeof ($Comment->"base-url") ] = "str") do={ :set BaseUrl ($Comment->"base-url"); }
:if ([ :typeof ($Comment->"url-suffix") ] = "str") do={ :set UrlSuffix ($Comment->"url-suffix"); }
:local Result [ / tool fetch check-certificate=yes-without-crl \
($ScriptUpdatesBaseUrl . $ScriptVal->"name" . $ScriptUpdatesUrlSuffix) \
output=user as-value ];
($BaseUrl . $ScriptVal->"name" . $UrlSuffix) output=user as-value ];
:if ($Result->"status" = "finished") do={
:set SourceNew ($Result->"data");
}