aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--global-functions.rsc13
1 files changed, 8 insertions, 5 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 204f824..f5fa5cb 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -12,8 +12,9 @@
:local ScriptName [ :jobname ];
-# expected configuration version
+# Git commit id & info, expected configuration version
:global CommitId "unknown";
+:global CommitInfo "unknown";
:global ExpectedConfigVersion 133;
# global variables not to be changed by user
@@ -286,6 +287,7 @@
# get readable device info
:set DeviceInfo do={
:global CommitId;
+ :global CommitInfo;
:global ExpectedConfigVersion;
:global Identity;
@@ -327,7 +329,7 @@
([ $FormatLine " Firmware" ($RouterBoard->"current-firmware") ] . "\n") ] . \
"RouterOS-Scripts:\n" . \
[ $IfThenElse ($CommitId != "unknown") \
- ([ $FormatLine " Commit" [ :pick $CommitId 0 8 ] ] . "\n") ] . \
+ ([ $FormatLine " Commit" ($CommitInfo . "/" . [ :pick $CommitId 0 8 ]) ] . "\n") ] . \
[ $FormatLine " Version" $ExpectedConfigVersion ]);
}
@@ -1054,12 +1056,12 @@
$LogPrint debug $0 ("Removing file: ". $FileName);
- :if ([ :len [ /file/find where name=$FileName type!=file ] ] > 0) do={
+ :if ([ :len [ /file/find where name=$FileName (type=directory or type=disk) ] ] > 0) do={
$LogPrint error $0 ("File '" . $FileName . "' is not a file.");
:return false;
}
- :local File [ /file/find where name=$FileName type=file ];
+ :local File [ /file/find where name=$FileName !(type=directory or type=disk) ];
:if ([ :len $File ] = 0) do={
$LogPrint debug $0 ("... which does not exist.");
:return true;
@@ -1106,6 +1108,7 @@
:local NewComment [ :tostr $2 ];
:global CommitId;
+ :global CommitInfo;
:global ExpectedConfigVersion;
:global Identity;
:global IDonate;
@@ -1254,7 +1257,7 @@
}
:if ($CommitId != "unknown" && $CommitIdBefore != $CommitId) do={
- $LogPrint info $0 ("Updated to commit id: " . [ :pick $CommitId 0 8 ]);
+ $LogPrint info $0 ("Updated to commit: " . $CommitInfo . "/" . [ :pick $CommitId 0 8 ]);
}
:if ($ExpectedConfigVersionBefore > $ExpectedConfigVersion) do={