Merge branch 'device-mode' into next

This commit is contained in:
Christian Hesse 2025-01-29 22:20:51 +01:00
commit 3c8ec5169f
25 changed files with 53 additions and 10 deletions

View file

@ -34,6 +34,12 @@ Specific scripts may require even newer RouterOS version.
> **Info**: The `main` branch is now RouterOS v7 only. If you are still
> running RouterOS v6 switch to `routeros-v6` branch!
Starting with RouterOS 7.17 the
[device-mode](https://help.mikrotik.com/docs/spaces/ROS/pages/93749258/Device-mode)
has been extended to give more fine-grained control over what features are
available. You need to enable `scheduler` and `fetch` at least, specific
scripts may require additional features.
### Hardware
RouterOS packages increase in size with each release. This becomes a

View file

@ -5,6 +5,7 @@
#
# provides: backup-script, order=70
# requires RouterOS, version=7.14
# requires device-mode, scheduler
#
# save configuration to fallback partition
# https://rsc.eworm.de/doc/backup-partition.md

View file

@ -5,6 +5,7 @@
#
# provides: backup-script, order=50
# requires RouterOS, version=7.14
# requires device-mode, fetch
#
# create and upload backup and config file
# https://rsc.eworm.de/doc/backup-upload.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch
#
# check for certificate validity
# https://rsc.eworm.de/doc/check-certificates.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch, scheduler
#
# check for RouterOS update, send notification and/or install
# https://rsc.eworm.de/doc/check-routeros-update.md

View file

@ -5,6 +5,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch, scheduler
#
# global functions
# https://rsc.eworm.de/
@ -1071,6 +1072,7 @@
:local ExpectedConfigVersionBefore $ExpectedConfigVersion;
:local ReloadGlobalFunctions false;
:local ReloadGlobalConfig false;
:local DeviceMode [ /system/device-mode/get ];
:foreach Script in=[ /system/script/find where source~"^#!rsc by RouterOS\r?\n" ] do={
:local ScriptVal [ /system/script/get $Script ];
@ -1113,19 +1115,31 @@
:if ([ :pick $SourceNew 0 18 ] = "#!rsc by RouterOS\n") do={
:local Required ([ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires RouterOS, ") ] ]->"version");
:if ([ $RequiredRouterOS $0 [ $EitherOr $Required "0.0" ] false ] = true) do={
:if ([ $ValidateSyntax $SourceNew ] = true) do={
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
/system/script/set owner=($ScriptVal->"name") \
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
:if ($ScriptVal->"name" = "global-config") do={
:set ReloadGlobalConfig true;
:local RequiredDM [ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires device-mode, ") ] ];
:local MissingDM ({});
:foreach Feature,Value in=$RequiredDM do={
:if ([ :typeof ($DeviceMode->$Feature) ] = "bool" && ($DeviceMode->$Feature) = false) do={
:set MissingDM ($MissingDM, $Feature);
}
:if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={
:set ReloadGlobalFunctions true;
}
:if ([ :len $MissingDM ] = 0) do={
:if ([ $ValidateSyntax $SourceNew ] = true) do={
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
/system/script/set owner=($ScriptVal->"name") \
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
:if ($ScriptVal->"name" = "global-config") do={
:set ReloadGlobalConfig true;
}
:if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={
:set ReloadGlobalFunctions true;
}
} else={
$LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . \
"' failed! Ignoring!");
}
} else={
$LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . \
"' failed! Ignoring!");
$LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires disabled " . \
"device-mode features (" . [ :tostr $MissingDM ] . "). Ignoring!");
}
} else={
$LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires RouterOS " . \

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch
#
# track gps data by sending json data to http server
# https://rsc.eworm.de/doc/gps-track.md

View file

@ -5,6 +5,7 @@
#
# provides: lease-script, order=80
# requires RouterOS, version=7.14
# requires device-mode, hotspot
#
# manage and clean up private WPA passphrase after hotspot login
# https://rsc.eworm.de/doc/hotspot-to-wpa.md

View file

@ -5,6 +5,7 @@
#
# provides: lease-script, order=80
# requires RouterOS, version=7.14
# requires device-mode, hotspot
#
# manage and clean up private WPA passphrase after hotspot login
# https://rsc.eworm.de/doc/hotspot-to-wpa.md

View file

@ -5,6 +5,7 @@
#
# provides: lease-script, order=80
# requires RouterOS, version=7.14
# requires device-mode, hotspot
#
# manage and clean up private WPA passphrase after hotspot login
# https://rsc.eworm.de/doc/hotspot-to-wpa.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, hotspot
#
# add private WPA passphrase after hotspot login
# https://rsc.eworm.de/doc/hotspot-to-wpa.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, hotspot
#
# add private WPA passphrase after hotspot login
# https://rsc.eworm.de/doc/hotspot-to-wpa.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, hotspot
#
# add private WPA passphrase after hotspot login
# https://rsc.eworm.de/doc/hotspot-to-wpa.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, ipsec
#
# and add/remove/update DNS entries from IPSec mode-config
# https://rsc.eworm.de/doc/ipsec-to-dns.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, email, scheduler
#
# send notifications via e-mail
# https://rsc.eworm.de/doc/mod/notification-email.md

View file

@ -5,6 +5,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch, scheduler
#
# send notifications via Matrix
# https://rsc.eworm.de/doc/mod/notification-matrix.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch, scheduler
#
# send notifications via Ntfy (ntfy.sh)
# https://rsc.eworm.de/doc/mod/notification-ntfy.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch, scheduler
#
# send notifications via Telegram
# https://rsc.eworm.de/doc/mod/notification-telegram.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, fetch
#
# download script and run it once
# https://rsc.eworm.de/doc/mod/scriptrunonce.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, scheduler
#
# act on multiple mode and reset button presses
# https://rsc.eworm.de/doc/mode-button.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.16
# requires device-mode, fetch
#
# monitor and manage dns/doh with netwatch
# https://rsc.eworm.de/doc/netwatch-dns.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, scheduler
#
# download packages and reboot for installation
# https://rsc.eworm.de/doc/packages-update.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
# requires device-mode, fetch
#
# use Telegram to chat with your Router and send commands
# https://rsc.eworm.de/doc/telegram-chat.md

View file

@ -4,6 +4,7 @@
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.14
# requires device-mode, scheduler
#
# schedule unattended lte firmware upgrade
# https://rsc.eworm.de/doc/unattended-lte-firmware-upgrade.md

View file

@ -6,6 +6,7 @@
#
# provides: ppp-on-up
# requires RouterOS, version=7.14
# requires device-mode, fetch
#
# update local address of tunnelbroker interface
# https://rsc.eworm.de/doc/update-tunnelbroker.md