Commit graph

227 commits

Author SHA1 Message Date
Christian Hesse
29bcd191ee global-functions: $ScriptInstallUpdate: support downloading certificate...
... for individual scripts. Just add it in comment with
"certificate=...". This also works on installtion:

$ScriptInstallUpdate new-script "base-url=..., certificate=...";

Closes: https://github.com/eworm-de/routeros-scripts/pull/97
2025-04-17 10:48:45 +02:00
Christian Hesse
d4b5e1f5e7 global-functions: $CertificateNameByCN: warn with no match 2025-04-10 11:08:43 +02:00
Christian Hesse
c823ff87ed global-functions: $CertificateNameByCN: return false without match...
... and return true on success.
2025-04-08 16:09:53 +02:00
Christian Hesse
44fa91f5c4 global-functions: $CertificateNameByCN: pick the first match only 2025-04-08 16:09:53 +02:00
Christian Hesse
e36613608c global-functions: $CertificateNameByCN: support matching by fingerprint and name 2025-04-08 16:09:53 +02:00
Christian Hesse
019e10e190 global-functions: $CertificateDownload: no infinite loop
We can not call $CertificateAvailable here, as that will most likely
cause an infinite loop. After all that's the certificate mkcert.org is
using. And it *is* available in this repository.
2025-04-08 16:09:53 +02:00
Christian Hesse
314ba5796d global-functions: $ScriptLock: increase interval with wait time
Inspired by: https://github.com/eworm-de/routeros-scripts/issues/95#issuecomment-2773513467
2025-04-08 16:09:53 +02:00
Ilya Kulakov
27987a0d7c global-functions: $ScriptLock: fix second parameter
This broke with 1e8918fdaa5a30393e2004d1f5e4dff458936b67...

Fixes: https://github.com/eworm-de/routeros-scripts/issues/95
2025-04-08 09:11:45 +02:00
Christian Hesse
3c30276e23 check-routeros-update: split off check-perpetual-license...
... and also add documentation, screenshot, etc.
2025-04-01 17:39:50 +02:00
Christian Hesse
7be26a0712 DEBUG: add info on $LogPrintVerbose 2025-03-06 15:59:44 +01:00
Christian Hesse
e341e1c30c global-functions: introduce $LogPrintVerbose ...
... which is a declared function, but has no code, intentionally. It can be
called as a no-op by default.

If you want this output set the function to be the same as $LogPrint:

    :set LogPrintVerbose $LogPrint;
2025-03-06 15:59:11 +01:00
Christian Hesse
1b46a5fd9b global-functions: $ScriptInstallUpdate: checksum only for same source
So ignore if script is fetched from different base or with different
suffix.
2025-03-06 10:43:13 +01:00
Christian Hesse
b13360e4b8 global-functions: $ScriptInstallUpdate: simplify check
This one should suffice...
2025-03-06 10:42:52 +01:00
Christian Hesse
c9de6d8579 global-functions: $ScriptInstallUpdate: put checksum into variable 2025-03-06 10:42:27 +01:00
Christian Hesse
10374afc18 global-functions: $ScriptInstallUpdate: support checksums for CRLF scripts 2025-03-06 10:42:00 +01:00
Christian Hesse
0c1d96f89d global-functions: $ScriptInstallUpdate: get and compare checksums
The file 'checksums.json' is generated when deploying to my web
server... This should speed up the update a lot as it reduces downloads
to a minimum. 🎉😁
2025-03-06 10:41:28 +01:00
Christian Hesse
3ccaafd1b3 global-functions: $ScriptInstallUpdate: move code into block 2025-03-05 01:15:22 +01:00
Christian Hesse
53b13b295a mod/notification-telegram: introduce $GetTelegramChatId 2025-02-25 22:37:30 +01:00
Christian Hesse
c33eb41c9c global-functions: $DeviceInfo: add license level, re-order 2025-02-25 17:55:26 +01:00
Christian Hesse
e5de9de391 notify on support for Telegram group topics 2025-02-25 17:55:26 +01:00
Christian Hesse
58da92e36a global-functions: $WaitForFile: drop the warning on file handling breakage...
... but keep the workaround for now - just to be sure.
2025-02-19 22:21:03 +01:00
Christian Hesse
2c92c78b46 global-functions: $ScriptInstallUpdate: also show commit info 2025-02-17 13:55:44 +01:00
Christian Hesse
75633872aa global-functions: $DeviceInfo: also show commit info 2025-02-17 13:55:36 +01:00
Christian Hesse
dafcc1a0cb global-functions: $RmFile: fix type safeguard
Ups... 🫣
The type is not just literal 'file' - but what ever type the file is,
like 'backup', 'package', 'script', '.conf file', ...

So let's match those types we do *not* want to remove.

Fixes: https://github.com/eworm-de/routeros-scripts/issues/90
2025-02-13 17:58:48 +01:00
Christian Hesse
0199ea8884 global-functions: $ScriptInstallUpdate: show commit id (if available) 2025-02-13 09:50:22 +01:00
Christian Hesse
584e507fd1 global-functions: $DeviceInfo: show commit id (if available) 2025-02-13 09:03:05 +01:00
Christian Hesse
df631b987d fw-addr-lists: add a collective list in default configuration 2025-02-12 17:40:27 +01:00
Christian Hesse
c8759381e9 global-functions: $WaitForFile: check that we can get properties
Looks like RouterOS 7.18beta2 brings more breakage. Having a file
available in listing is just the first step now. We also need to make
sure that the file properties are accessible... 🤪

I have seen this taking several tens of seconds at least... 🤪🤪 So
let's just try until we have properties available, or the file vanishes.

Reported as SUP-179200. 🤞
2025-02-12 10:49:38 +01:00
Christian Hesse
e1c561dd91 global-functions: $MkDir: add debug output 2025-02-11 14:56:43 +01:00
Christian Hesse
f5f00b70e3 global-functions: $MkDir: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
4760515add global-functions: $FetchHuge: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
d19b90df08 global-functions: $FetchHuge: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
ea8ec6b580 global-functions: $DownloadPackage: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
dbdf295244 global-functions: $CertificateDownload: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
82020ddd73 global-functions: $RmDir: fail on wrong type 2025-02-10 15:23:50 +01:00
Christian Hesse
a8e5b5226b global-functions: $RmFile: fail on wrong type 2025-02-10 15:23:50 +01:00
Christian Hesse
49d9fb1ffd global-functions: $RmDir: add debug output 2025-02-07 17:44:41 +01:00
Christian Hesse
7233dea5bb global-functions: $RmFile: add debug output 2025-02-07 17:44:41 +01:00
Christian Hesse
727495d9c4 global-functions: introduce $RmDir 2025-02-07 17:44:41 +01:00
Christian Hesse
4542c2b19e global-functions: introduce $RmFile 2025-02-07 17:44:41 +01:00
Christian Hesse
0fb5fd0323 global-functions: $MkDir: create directory directly...
... instead of file inside directory. This requires RouterOS 7.15, so
bumping requirement.
2025-02-07 17:44:32 +01:00
Christian Hesse
23d38927bc check-health: split off plugins...
... from 'check-health', so the script works on all devices to monitor
CPU and RAM. The supported plugins for sensors in hardware are installed
automatically.
2025-02-05 14:39:59 +01:00
Christian Hesse
414c83ef81 global-functions: $ScriptInstallUpdate: resolve more nested conditions
Just like the previous one.
2025-01-30 09:00:02 +01:00
Christian Hesse
8b19e74736 global-functions: $ScriptInstallUpdate: resolve nested conditions...
... and check one after another in a do-block. This uses `:error` as
poor man's continue. 🤪
2025-01-30 09:00:02 +01:00
Christian Hesse
b177e298d7 global-functions: $ScriptInstallUpdate: support checking for device-mode features 2025-01-30 09:00:02 +01:00
Christian Hesse
7be415d0ed global-functions: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
9e3729c279 update copyright for 2025 2025-01-02 00:04:06 +01:00
Christian Hesse
b98b245714 global-functions: $WaitForFile: drop the first workaround
This reverts commit 8231c3e833.

Truned out this workaround was not sufficient, see the follow-up in
commit 191cc1b952 for details.

But possibly the second one does it on its own? Reverting this for
a test run.
2024-12-30 20:22:51 +01:00
Christian Hesse
191cc1b952 global-functions: $FetchHuge: another workaround for complete file
Turns out the workaround in $WaitForFile (commit
8231c3e833) is not sufficient. It helps
sometimes, but not always. Possibly depends on CPU speed and bandwidth
of internet connection... Who knows!? 🤪

But! Reading the file goes beyond the known file size. That's suspicious
and indicates this exact issue. So add a delay, and keep reading until
sizes are equal.
2024-12-30 20:09:46 +01:00
Christian Hesse
ef3ce7cc6c global-functions: $ParseKeyValueStore: support JSON as input
This used to require a key=value store, separated with commas. An
example for `netwatch-notify` is:

    /tool/netwatch/add comment="notify, name=example.com" host=93.184.215.14;

Now JSON is supported as well, so you could use:

    /tool/netwatch/add comment="{\"notify\":true,\"name\":\"example.com\"}" host=93.184.215.14;

Looks more clumsy here, but may be of help in more complex setups...
2024-12-25 23:04:50 +01:00