global-functions: $ScriptInstallUpdate: support storing with CRLF

Adding this in `global-config-overlay` make the scripts being stored
with CRLF line breaks:

    :global ScriptUpdatesCRLF true;

Handle with care, I do not recommend it. Thus it's just a hidden
setting.
This commit is contained in:
Christian Hesse 2024-07-16 12:33:47 +02:00
parent a26f78329a
commit f2ca62aed0

View file

@ -1008,6 +1008,7 @@
:global IDonate; :global IDonate;
:global NoNewsAndChangesNotification; :global NoNewsAndChangesNotification;
:global ScriptUpdatesBaseUrl; :global ScriptUpdatesBaseUrl;
:global ScriptUpdatesCRLF;
:global ScriptUpdatesUrlSuffix; :global ScriptUpdatesUrlSuffix;
:global CertificateAvailable; :global CertificateAvailable;
@ -1081,7 +1082,8 @@
:if ([ $RequiredRouterOS $0 [ $EitherOr $Required "0.0" ] false ] = true) do={ :if ([ $RequiredRouterOS $0 [ $EitherOr $Required "0.0" ] false ] = true) do={
:if ([ $ValidateSyntax $SourceNew ] = true) do={ :if ([ $ValidateSyntax $SourceNew ] = true) do={
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name"); $LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
/system/script/set owner=($ScriptVal->"name") source=$SourceNew $Script; /system/script/set owner=($ScriptVal->"name") \
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
:if ($ScriptVal->"name" = "global-config") do={ :if ($ScriptVal->"name" = "global-config") do={
:set ReloadGlobalConfig true; :set ReloadGlobalConfig true;
} }