Merge branch 'CommitBrief' into next

This commit is contained in:
Christian Hesse 2026-01-20 12:18:29 +01:00
commit e40a5575c4
3 changed files with 20 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

View file

@ -30,6 +30,7 @@
:global CharacterReplace; :global CharacterReplace;
:global CleanFilePath; :global CleanFilePath;
:global CleanName; :global CleanName;
:global CommitBrief;
:global DeviceInfo; :global DeviceInfo;
:global Dos2Unix; :global Dos2Unix;
:global DownloadPackage; :global DownloadPackage;
@ -320,13 +321,24 @@
:return $Return; :return $Return;
} }
# get readable device info # return a brief commit description
:set DeviceInfo do={ :set CommitBrief do={
:global CommitId; :global CommitId;
:global CommitInfo; :global CommitInfo;
:if ($CommitId = "unknown") do={
:return "unknown";
}
:return ($CommitInfo . "/" . [ :pick $CommitId 0 8 ]);
}
# get readable device info
:set DeviceInfo do={
:global ExpectedConfigVersion; :global ExpectedConfigVersion;
:global Identity; :global Identity;
:global CommitBrief;
:global IfThenElse; :global IfThenElse;
:global FormatLine; :global FormatLine;
@ -367,8 +379,7 @@
$RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \ $RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \
([ $FormatLine " Firmware" ($RouterBoard->"current-firmware") ] . "\n") ] . \ ([ $FormatLine " Firmware" ($RouterBoard->"current-firmware") ] . "\n") ] . \
"RouterOS-Scripts:\n" . \ "RouterOS-Scripts:\n" . \
[ $IfThenElse ($CommitId != "unknown") \ [ $FormatLine " Commit" [ $CommitBrief ] ] . "\n" . \
([ $FormatLine " Commit" ($CommitInfo . "/" . [ :pick $CommitId 0 8 ]) ] . "\n") ] . \
[ $FormatLine " Version" $ExpectedConfigVersion ]); [ $FormatLine " Version" $ExpectedConfigVersion ]);
} }
@ -561,16 +572,13 @@
:set FetchUserAgentStr do={ :set FetchUserAgentStr do={
:local Caller [ :tostr $1 ]; :local Caller [ :tostr $1 ];
:global CommitId; :global CommitBrief;
:global CommitInfo;
:global IfThenElse; :global IfThenElse;
:local Resource [ /system/resource/get ]; :local Resource [ /system/resource/get ];
:return ("User-Agent: Mikrotik/" . $Resource->"version" . " " . $Resource->"architecture-name" . \ :return ("User-Agent: Mikrotik/" . $Resource->"version" . " " . $Resource->"architecture-name" . \
" " . $Caller . "/Fetch (https://rsc.eworm.de/" . [ $IfThenElse ($CommitId != "unknown") \ " " . $Caller . "/Fetch (https://rsc.eworm.de/; " . [ $CommitBrief ] . ")");
("; " . $CommitInfo . "/" . [ :pick $CommitId 0 8 ]) ] . ")");
} }
# check for existence of file, optionally with type # check for existence of file, optionally with type
@ -1251,7 +1259,6 @@
:local NewComment [ :tostr $2 ]; :local NewComment [ :tostr $2 ];
:global CommitId; :global CommitId;
:global CommitInfo;
:global ExpectedConfigVersion; :global ExpectedConfigVersion;
:global GlobalConfigReady; :global GlobalConfigReady;
:global GlobalFunctionsReady; :global GlobalFunctionsReady;
@ -1427,10 +1434,6 @@
} }
} }
:if ($CommitId != "unknown" && $CommitIdBefore != $CommitId) do={
$LogPrint info $0 ("Updated to commit: " . $CommitInfo . "/" . [ :pick $CommitId 0 8 ]);
}
:if ($ExpectedConfigVersionBefore > $ExpectedConfigVersion) do={ :if ($ExpectedConfigVersionBefore > $ExpectedConfigVersion) do={
$LogPrint warning $0 ("The configuration version decreased from " . \ $LogPrint warning $0 ("The configuration version decreased from " . \
$ExpectedConfigVersionBefore . " to " . $ExpectedConfigVersion . \ $ExpectedConfigVersionBefore . " to " . $ExpectedConfigVersion . \
@ -1942,8 +1945,9 @@
# Log success # Log success
:local Resource [ /system/resource/get ]; :local Resource [ /system/resource/get ];
$LogPrintOnce info $ScriptName ("Loaded on " . $Resource->"board-name" . \ $LogPrintOnce info $ScriptName ("Loaded " . \
" with RouterOS " . $Resource->"version" . "."); [ $IfThenElse ($CommitId != "unknown") ([ $CommitBrief ] . " ") ] . \
"on " . $Resource->"board-name" . " with RouterOS " . $Resource->"version" . ".");
# signal we are ready # signal we are ready
:set GlobalFunctionsReady true; :set GlobalFunctionsReady true;