Compare commits

..

48 commits

Author SHA1 Message Date
Christian Hesse
4db0a0d4f0 DEBUG: fix typo 2025-05-21 22:15:19 +02:00
Christian Hesse
5b5e3d47b6 telegram-chat: support debug output for updates in JSON 2025-05-21 22:15:19 +02:00
Christian Hesse
828c93bd66 telegram-chat: support trusted group chat ids
But be warned: Adding a person to a trusted group will give
her/him administrative control over the device(s) - without
changes on the device itself!

On the other hand... Removing permissions is easily done by removing
a person from a group.

Closes: https://github.com/eworm-de/routeros-scripts/issues/101
2025-05-21 22:15:19 +02:00
Christian Hesse
0576fbc532 mod/notification-telegram: fix indention 2025-05-21 22:15:19 +02:00
Christian Hesse
9d94d69677 fw-addr-lists: for IPv6 the CIDR is always expected 2025-05-21 22:15:19 +02:00
Christian Hesse
3e404027f6 mod/notification-email: add the link symbol 2025-05-21 22:15:19 +02:00
Christian Hesse
de9e726661 mod/notification-email: properly truncate the body
Truned out that the size limit for e-mail message/body is anywhere just
below 64kB... So truncate  at about 62.000 bytes.
2025-05-21 22:15:19 +02:00
Christian Hesse
68c38df755 mod/notification-email: add error handling when sending mail 2025-05-21 22:15:19 +02:00
Christian Hesse
6209f52962 mod/inspectvar: replace only when matching 2025-05-21 22:15:19 +02:00
Christian Hesse
616e9f244a mod/inspectvar: remove CR, replace LF 2025-05-21 22:15:19 +02:00
Christian Hesse
02531d5fae mod/inspectvar: print the length for strings 2025-05-21 22:15:19 +02:00
Christian Hesse
bd700b8e75 mod/inspectvar: use $CharacterMultiply 2025-05-21 22:15:19 +02:00
Christian Hesse
1a782018bb Merge branch 'onerror' into next 2025-05-21 22:15:19 +02:00
Christian Hesse
fee409f0ba update-tunnelbroker: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:15:19 +02:00
Christian Hesse
7e58ee3fdb unattended-lte-firmware-upgrade: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:15:19 +02:00
Christian Hesse
37b417369e telegram-chat: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:15:19 +02:00
Christian Hesse
70b10dd2a6 sms-forward: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:15:19 +02:00
Christian Hesse
a6f9e6c6be netwatch-notify: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:15:19 +02:00
Christian Hesse
e138cd0ab9 netwatch-dns: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:15:19 +02:00
Christian Hesse
fc1cde98f2 mod/ssh-keys-import: :do ... on-error=... -> ... well... - fix error condition 🥴 2025-05-21 22:14:22 +02:00
Christian Hesse
9cd4ed08a4 mod/ssh-keys-import: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
9ae21c00bd mod/scriptrunonce: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
314e68e4cd mode-button: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
e01873301f mod/notification-gotify: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
3f092d3477 mod/notification-matrix: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
2a7fd7ea53 mod/notification-ntfy: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
5badafe109 mod/notification-telegram: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
c1e6348bb9 lease-script: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
d5f9ecebfb gps-track: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
5c599beae1 global-functions: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
8b1b73c936 global-functions: $ValidateSyntax: add debug output 2025-05-21 22:12:25 +02:00
Christian Hesse
f5c4378676 global-functions: $ValidateSyntax: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
12926b7c42 global-functions: $ScriptInstallUpdate: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
2317013121 global-functions: $RmFile: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
86a8919ed2 global-functions: $RmDir: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
09f9826760 global-functions: $MkDir: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
7a1fef78a2 global-functions: $GetMacVendor: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
a6b36dde7b global-functions: $FetchHuge: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
5b89f3e425 global-functions: $DownloadPackage: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
a9e7bb0a05 global-config: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:12:25 +02:00
Christian Hesse
b807fc9e90 fw-addr-lists: adopt changes in wording...
... to match the changes from previous commit.
2025-05-21 22:12:10 +02:00
Christian Hesse
142b0760b0 fw-addr-lists: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:05:35 +02:00
Christian Hesse
79f681b801 check-routeros-update: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:05:35 +02:00
Christian Hesse
1925d2847c check-lte-firmware-upgrade: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:05:35 +02:00
Christian Hesse
187aeba78b check-health: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:05:35 +02:00
Christian Hesse
dc2296d500 backup-upload: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:05:35 +02:00
Christian Hesse
c3fce37066 backup-partition: :do ... on-error=... -> :onerror ... do=... 2025-05-21 22:05:35 +02:00
Christian Hesse
6691e2e765 global-functions: $DownloadPackage: reverse failure logic...
... and do not retry.
2025-05-21 21:51:16 +02:00
2 changed files with 14 additions and 17 deletions

View file

@ -35,12 +35,12 @@
:onerror Err {
/partitions/copy-to $FallbackTo;
$LogPrint info $ScriptName ("Copied RouterOS to partition '" . $FallbackToName . "'.");
:return true;
} do={
$LogPrint error $ScriptName ("Failed copying RouterOS to partition '" . \
$FallbackToName . "': " . $Err);
:return false;
}
:return true;
}
:if ([ $ScriptLock $ScriptName ] = false) do={

View file

@ -391,25 +391,22 @@
:local Url ("https://upgrade.mikrotik.com/routeros/" . $PkgVer . "/" . $PkgFile);
$LogPrint info $0 ("Downloading package file '" . $PkgName . "'...");
$LogPrint debug $0 ("... from url: " . $Url);
:local Retry 3;
:while ($Retry > 0) do={
:onerror Err {
/tool/fetch check-certificate=yes-without-crl $Url dst-path=$PkgDest;
$WaitForFile $PkgDest;
:if ([ /file/get [ find where name=$PkgDest ] type ] = "package") do={
:return true;
}
} do={
$LogPrint debug $0 ("Downloading package file failed: " . $Err);
}
$RmFile $PkgDest;
:set Retry ($Retry - 1);
:onerror Err {
/tool/fetch check-certificate=yes-without-crl $Url dst-path=$PkgDest;
$WaitForFile $PkgDest;
} do={
$LogPrint warning $0 ("Downloading package file '" . $PkgName . "' failed: " . $Err);
:return false;
}
$LogPrint warning $0 ("Downloading package file '" . $PkgName . "' failed.");
:return false;
:if ([ /file/get [ find where name=$PkgDest ] type ] != "package") do={
$LogPrint warning $0 ("Downloaded file is not a package, removing.");
$RmFile $PkgDest;
:return false;
}
:return true;
}
# return either first (if "true") or second