mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-22 17:09:33 +00:00
Merge branch 'CommitBrief' into next
This commit is contained in:
commit
228ac39486
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 |
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.8 KiB |
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue