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={ :if ($Ignore = 0) do={
$LogPrintExit debug ("Fetching script from url: " . $ScriptVal->"name") false; $LogPrintExit debug ("Fetching script from url: " . $ScriptVal->"name") false;
:do { :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 \ :local Result [ / tool fetch check-certificate=yes-without-crl \
($ScriptUpdatesBaseUrl . $ScriptVal->"name" . $ScriptUpdatesUrlSuffix) \ ($BaseUrl . $ScriptVal->"name" . $UrlSuffix) output=user as-value ];
output=user as-value ];
:if ($Result->"status" = "finished") do={ :if ($Result->"status" = "finished") do={
:set SourceNew ($Result->"data"); :set SourceNew ($Result->"data");
} }