From 48add1caa9f82c22c88a6addff676521426ecce5 Mon Sep 17 00:00:00 2001 From: vados-dev Date: Tue, 3 Mar 2026 14:48:58 +0300 Subject: [PATCH] Backup for /var/www/ros.vados.ru/html sucessfully creatd at Mar 03 14:48:58. --- html/AM-GitBackup.rsc | 39 + html/AM-GlobalFunc.rsc | 4 + html/Makefile | 46 -- html/checkUpd.diff | 76 -- html/func-collection/rmb | 1 + html/mikro_bak_rsa.pub | 1 - html/staging_main.diff | 1504 -------------------------------------- 7 files changed, 44 insertions(+), 1627 deletions(-) create mode 100644 html/AM-GitBackup.rsc delete mode 100644 html/Makefile delete mode 100644 html/checkUpd.diff create mode 160000 html/func-collection/rmb delete mode 100644 html/mikro_bak_rsa.pub delete mode 100644 html/staging_main.diff diff --git a/html/AM-GitBackup.rsc b/html/AM-GitBackup.rsc new file mode 100644 index 000000000..368b6d4fd --- /dev/null +++ b/html/AM-GitBackup.rsc @@ -0,0 +1,39 @@ +# MikroTik Git Config Backup +# Edit the three variables below, then add this script under System > Scripts + +:local serverUrl "http://192.168.1.10:8080" +:local authToken "change-me-use-a-long-random-string" +:local routerName [/system identity get name] + +:put "git-backup: starting for $routerName" +:log info "git-backup: starting for $routerName" + +:put "git-backup: checking server..." +:do { + /tool fetch url=($serverUrl . "/health") output=none + :put "git-backup: server ok" +} on-error={ + :put "git-backup: ERROR cannot reach $serverUrl" + :log error "git-backup: cannot reach $serverUrl" + :error "unreachable" +} + +:put "git-backup: exporting config..." +/export show-sensitive file=git-backup-config +:delay 3s + +:put "git-backup: uploading .rsc..." +:do { + :local rscContent [/file get [/file find name="git-backup-config.rsc"] contents] + :local headers ("Authorization: Bearer " . $authToken . ",X-Router-Name: " . $routerName) + /tool fetch url=($serverUrl . "/backup/config") http-method=post http-header-field=$headers http-data=$rscContent output=user + :put "git-backup: .rsc done" +} on-error={ + :put "git-backup: ERROR .rsc upload failed" + :log error "git-backup: .rsc upload failed" +} + +:do { /file remove [find name="git-backup-config.rsc"] } on-error={} + +:put "git-backup: done" +:log info "git-backup: done" diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index 9db0d6839..d0e2c159f 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -15,6 +15,10 @@ #} :global GlobalFuncReady false; +# Git commit id & info, expected configuration version +:global CommitId "unknown"; +:global CommitInfo "unknown"; + # The variables are received right here. :global GlobalConfVersion 138; diff --git a/html/Makefile b/html/Makefile deleted file mode 100644 index 308ef4520..000000000 --- a/html/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# Makefile to generate data: -# template scripts -> final scripts -# markdown files -> html files - -ALL_RSC := $(wildcard *.rsc */*.rsc) -GEN_RSC := $(wildcard *.capsman.rsc *.local.rsc *.wifi.rsc) - -MARKDOWN := $(wildcard *.md doc/*.md doc/mod/*.md) -HTML := $(MARKDOWN:.md=.html) - -DATE ?= $(shell date --rfc-email) -VERSION ?= $(shell git symbolic-ref --short HEAD 2>/dev/null)/$(shell git rev-list --count HEAD 2>/dev/null)/$(shell git rev-parse --short=8 HEAD 2>/dev/null) -export DATE VERSION - -.PHONY: all checksums commitinfo docs rsc clean - -all: checksums docs rsc - -checksums: checksums.json - -checksums.json: .bin/checksums.sh $(ALL_RSC) - .bin/checksums.sh > $@ - -commitinfo: Amster-GlobalFunctions.rsc - .bin/commitinfo.sh $< > $<~ - mv $<~ $< - -docs: $(HTML) - -%.html: %.md .include/css/style.css .bin/html.sh .tmpl/head.html .tmpl/foot.html - .bin/html.sh $< > $@ - -rsc: $(GEN_RSC) - -caps/%.capsman.rsc: tmpl/caps/%.template.rsc .bin/template-capsman.sh - .bin/template-capsman.sh $< > $@ - -local/%.local.rsc: tmpl/local/%.template.rsc .bin/template-local.sh - .bin/template-local.sh $< > $@ - -wifi/%.wifi.rsc: tmpl/wifi/%.template.rsc .bin/template-wifi.sh - .bin/template-wifi.sh $< > $@ - -clean: - rm -f $(HTML) checksums.json - make -C tmpl/ clean diff --git a/html/checkUpd.diff b/html/checkUpd.diff deleted file mode 100644 index e5fbdfc46..000000000 --- a/html/checkUpd.diff +++ /dev/null @@ -1,76 +0,0 @@ -12d11 -< :local ExitOK false; -50,51c49 -< :set ExitOK true; -< :error false; ---- -> :exit; -56,57c54 -< :set ExitOK true; -< :error false; ---- -> :exit; -68,69c65 -< :set ExitOK true; -< :error false; ---- -> :exit; -81,82c77 -< :set ExitOK true; -< :error true; ---- -> :exit; -87,88c82 -< :set ExitOK true; -< :error false; ---- -> :exit; -100,101c94 -< :set ExitOK true; -< :error false; ---- -> :exit; -113,114c106 -< :set ExitOK true; -< :error true; ---- -> :exit; -124,125c116 -< :set ExitOK true; -< :error true; ---- -> :exit; -140,141c131 -< :set ExitOK true; -< :error true; ---- -> :exit; -162,163c152 -< :set ExitOK true; -< :error true; ---- -> :exit; -173,174c162 -< :set ExitOK true; -< :error true; ---- -> :exit; -181,182c169 -< :set ExitOK true; -< :error true; ---- -> :exit; -191,192c178 -< :set ExitOK true; -< :error true; ---- -> :exit; -207,208c193 -< :set ExitOK true; -< :error true; ---- -> :exit; -221c206 -< :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; ---- -> :global ExitOnError; $ExitOnError [ :jobname ] $Err; diff --git a/html/func-collection/rmb b/html/func-collection/rmb new file mode 160000 index 000000000..425d141e4 --- /dev/null +++ b/html/func-collection/rmb @@ -0,0 +1 @@ +Subproject commit 425d141e4476db189a1b14ec9a11ddf1f30eae45 diff --git a/html/mikro_bak_rsa.pub b/html/mikro_bak_rsa.pub deleted file mode 100644 index 2f63755e5..000000000 --- a/html/mikro_bak_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC77aronyggZEHIwk6bcZM32aLGsqqub95bUjO/r0u3ahRN4KN+ayo+TwISJGOTIJov9qBe4igOCEYUVAZ7FqfJVck1iVIWAZrVa4KfMkESWkNCjmwfIoHa29wVyNC/VIsndyLXUYMgiEsCqVDi94034IWSNdaAuhxNNxw+cLr6uCcwuQkr+jB6NYSMsWX+2LnR2pM+fL45P1Or16L1xjV+olTivnoarkbkZiP0LMp8llfkXnCRnTqcIIkZFZNeCty2gQUHiv6+fauXU/JqoLPYBdaZbKMdwZnaCnxfDlt57Mnx7k3gcE5mT+ewXxvWcw2kDbSI313e6AjVflKCNh2B mikro_bak@amster diff --git a/html/staging_main.diff b/html/staging_main.diff deleted file mode 100644 index 30070c351..000000000 --- a/html/staging_main.diff +++ /dev/null @@ -1,1504 +0,0 @@ -Only in main: .gitignore -Common subdirectories: staging/CERTIFICATES.d and main/CERTIFICATES.d -diff staging/INITIAL-COMMANDS.md main/INITIAL-COMMANDS.md -7c7 -< [![required RouterOS version](https://img.shields.io/badge/RouterOS-7.21-yellow?style=flat)](https://mikrotik.com/download/changelogs/) ---- -> [![required RouterOS version](https://img.shields.io/badge/RouterOS-7.19-yellow?style=flat)](https://mikrotik.com/download/changelogs/) -26c26,27 -< :if (!((($CertSettings->"builtin-trust-store") ~ "fetch" || \ ---- -> :if (!((($CertSettings->"builtin-trust-anchors") = "trusted" || \ -> ($CertSettings->"builtin-trust-store") ~ "fetch" || \ -Common subdirectories: staging/README.d and main/README.d -diff staging/README.md main/README.md -7c7 -< [![required RouterOS version](https://img.shields.io/badge/RouterOS-7.21-yellow?style=flat)](https://mikrotik.com/download/changelogs/) ---- -> [![required RouterOS version](https://img.shields.io/badge/RouterOS-7.19-yellow?style=flat)](https://mikrotik.com/download/changelogs/) -53c53 -< > ![required RouterOS version](https://img.shields.io/badge/RouterOS-7.21-yellow?style=flat) ---- -> > ![required RouterOS version](https://img.shields.io/badge/RouterOS-7.19-yellow?style=flat) -114a115,118 -> -> > 💡️ **Hint**: With RouterOS 7.20.x and before the functionality was -> > different. Set the trust for the builtin trust anchors: -> > `/certificate/settings/set builtin-trust-anchors=trusted;` -diff staging/backup-cloud.rsc main/backup-cloud.rsc -11a12 -> :local ExitOK false; -38c39,40 -< :exit; ---- -> :set ExitOK true; -> :error false; -44c46,47 -< :exit; ---- -> :set ExitOK true; -> :error false; -55c58,59 -< :exit; ---- -> :set ExitOK true; -> :error false; -99c103 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/backup-email.rsc main/backup-email.rsc -11a12 -> :local ExitOK false; -43c44,45 -< :exit; ---- -> :set ExitOK true; -> :error false; -49c51,52 -< :exit; ---- -> :set ExitOK true; -> :error false; -54c57,58 -< :exit; ---- -> :set ExitOK true; -> :error false; -60c64,65 -< :exit; ---- -> :set ExitOK true; -> :error false; -80c85,86 -< :exit; ---- -> :set ExitOK true; -> :error false; -136c142 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/backup-partition.rsc main/backup-partition.rsc -12a13 -> :local ExitOK false; -47c48,49 -< :exit; ---- -> :set ExitOK true; -> :error false; -53c55,56 -< :exit; ---- -> :set ExitOK true; -> :error false; -59c62,63 -< :exit; ---- -> :set ExitOK true; -> :error false; -67c71,72 -< :exit; ---- -> :set ExitOK true; -> :error false; -76c81,82 -< :exit; ---- -> :set ExitOK true; -> :error false; -85c91,92 -< :exit; ---- -> :set ExitOK true; -> :error false; -97c104,105 -< :exit; ---- -> :set ExitOK true; -> :error false; -115c123,124 -< :exit; ---- -> :set ExitOK true; -> :error false; -118c127 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/backup-upload.rsc main/backup-upload.rsc -12a13 -> :local ExitOK false; -49c50,51 -< :exit; ---- -> :set ExitOK true; -> :error false; -54c56,57 -< :exit; ---- -> :set ExitOK true; -> :error false; -60c63,64 -< :exit; ---- -> :set ExitOK true; -> :error false; -80c84,85 -< :exit; ---- -> :set ExitOK true; -> :error false; -172c177 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/capsman-download-packages.capsman.rsc main/capsman-download-packages.capsman.rsc -13a14 -> :local ExitOK false; -30c31,32 -< :exit; ---- -> :set ExitOK true; -> :error false; -40c42,43 -< :exit; ---- -> :set ExitOK true; -> :error false; -47c50,51 -< :exit; ---- -> :set ExitOK true; -> :error false; -88c92 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/capsman-download-packages.template.rsc main/capsman-download-packages.template.rsc -14a15 -> :local ExitOK false; -31c32,33 -< :exit; ---- -> :set ExitOK true; -> :error false; -42c44,45 -< :exit; ---- -> :set ExitOK true; -> :error false; -49c52,53 -< :exit; ---- -> :set ExitOK true; -> :error false; -99c103 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/capsman-download-packages.wifi.rsc main/capsman-download-packages.wifi.rsc -13a14 -> :local ExitOK false; -30c31,32 -< :exit; ---- -> :set ExitOK true; -> :error false; -40c42,43 -< :exit; ---- -> :set ExitOK true; -> :error false; -47c50,51 -< :exit; ---- -> :set ExitOK true; -> :error false; -90c94 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/capsman-rolling-upgrade.capsman.rsc main/capsman-rolling-upgrade.capsman.rsc -14a15 -> :local ExitOK false; -25c26,27 -< :exit; ---- -> :set ExitOK true; -> :error false; -47c49 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/capsman-rolling-upgrade.template.rsc main/capsman-rolling-upgrade.template.rsc -15a16 -> :local ExitOK false; -26c27,28 -< :exit; ---- -> :set ExitOK true; -> :error false; -55c57 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/capsman-rolling-upgrade.wifi.rsc main/capsman-rolling-upgrade.wifi.rsc -14a15 -> :local ExitOK false; -25c26,27 -< :exit; ---- -> :set ExitOK true; -> :error false; -48c50 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/certificate-renew-issued.rsc main/certificate-renew-issued.rsc -10a11 -> :local ExitOK false; -24c25,26 -< :exit; ---- -> :set ExitOK true; -> :error false; -49c51 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/certs and main/certs -diff staging/check-certificates.rsc main/check-certificates.rsc -11a12 -> :local ExitOK false; -154d154 -< [ $FormatLine " days" ($CertVal->"days-valid") ] . "\n" . \ -157c157 -< [ $FormatLine " time left" [ $IfThenElse (($CertVal->"expired") = true) "expired" [ $FormatExpire ($CertVal->"expires-after") ] ] ]); ---- -> [ $FormatLine "Expires in" [ $IfThenElse (($CertVal->"expired") = true) "expired" [ $FormatExpire ($CertVal->"expires-after") ] ] ]); -161c161,162 -< :exit; ---- -> :set ExitOK true; -> :error false; -173c174 -< :continue; ---- -> :error false; -260c261 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/check-health.d and main/check-health.d -diff staging/check-health.rsc main/check-health.rsc -10a11 -> :local ExitOK false; -39c40,41 -< :exit; ---- -> :set ExitOK true; -> :error false; -78c80,81 -< :exit; ---- -> :set ExitOK true; -> :error true; -106c109 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/check-lte-firmware-upgrade.rsc main/check-lte-firmware-upgrade.rsc -10a11 -> :local ExitOK false; -22c23,24 -< :exit; ---- -> :set ExitOK true; -> :error false; -104c106 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/check-perpetual-license.rsc main/check-perpetual-license.rsc -10a11 -> :local ExitOK false; -27c28,29 -< :exit; ---- -> :set ExitOK true; -> :error false; -35c37,38 -< :exit; ---- -> :set ExitOK true; -> :error true; -47c50,51 -< :exit; ---- -> :set ExitOK true; -> :error true; -59c63,64 -< :exit; ---- -> :set ExitOK true; -> :error true; -72c77 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/check-routeros-update.rsc main/check-routeros-update.rsc -11a12 -> :local ExitOK false; -49c50,51 -< :exit; ---- -> :set ExitOK true; -> :error false; -54c56,57 -< :exit; ---- -> :set ExitOK true; -> :error false; -65c68,69 -< :exit; ---- -> :set ExitOK true; -> :error false; -77c81,82 -< :exit; ---- -> :set ExitOK true; -> :error true; -82c87,88 -< :exit; ---- -> :set ExitOK true; -> :error false; -94c100,101 -< :exit; ---- -> :set ExitOK true; -> :error false; -106c113,114 -< :exit; ---- -> :set ExitOK true; -> :error true; -116c124,125 -< :exit; ---- -> :set ExitOK true; -> :error true; -131c140,141 -< :exit; ---- -> :set ExitOK true; -> :error true; -152c162,163 -< :exit; ---- -> :set ExitOK true; -> :error true; -162c173,174 -< :exit; ---- -> :set ExitOK true; -> :error true; -169c181,182 -< :exit; ---- -> :set ExitOK true; -> :error true; -178c191,192 -< :exit; ---- -> :set ExitOK true; -> :error true; -193c207,208 -< :exit; ---- -> :set ExitOK true; -> :error true; -206c221 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/collect-wireless-mac.capsman.rsc main/collect-wireless-mac.capsman.rsc -13a14 -> :local ExitOK false; -32c33,34 -< :exit; ---- -> :set ExitOK true; -> :error false; -97c99 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/collect-wireless-mac.local.rsc main/collect-wireless-mac.local.rsc -13a14 -> :local ExitOK false; -32c33,34 -< :exit; ---- -> :set ExitOK true; -> :error false; -98c100 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/collect-wireless-mac.template.rsc main/collect-wireless-mac.template.rsc -14a15 -> :local ExitOK false; -33c34,35 -< :exit; ---- -> :set ExitOK true; -> :error false; -115c117 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/collect-wireless-mac.wifi.rsc main/collect-wireless-mac.wifi.rsc -13a14 -> :local ExitOK false; -32c33,34 -< :exit; ---- -> :set ExitOK true; -> :error false; -97c99 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/contrib and main/contrib -diff staging/daily-psk.capsman.rsc main/daily-psk.capsman.rsc -13a14 -> :local ExitOK false; -34c35,36 -< :exit; ---- -> :set ExitOK true; -> :error false; -93c95 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/daily-psk.local.rsc main/daily-psk.local.rsc -13a14 -> :local ExitOK false; -34c35,36 -< :exit; ---- -> :set ExitOK true; -> :error false; -92c94 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/daily-psk.template.rsc main/daily-psk.template.rsc -14a15 -> :local ExitOK false; -35c36,37 -< :exit; ---- -> :set ExitOK true; -> :error false; -108c110 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/daily-psk.wifi.rsc main/daily-psk.wifi.rsc -13a14 -> :local ExitOK false; -34c35,36 -< :exit; ---- -> :set ExitOK true; -> :error false; -93c95 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/dhcp-lease-comment.capsman.rsc main/dhcp-lease-comment.capsman.rsc -13a14 -> :local ExitOK false; -24c25,26 -< :exit; ---- -> :set ExitOK true; -> :error false; -40c42 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/dhcp-lease-comment.local.rsc main/dhcp-lease-comment.local.rsc -13a14 -> :local ExitOK false; -24c25,26 -< :exit; ---- -> :set ExitOK true; -> :error false; -40c42 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/dhcp-lease-comment.template.rsc main/dhcp-lease-comment.template.rsc -14a15 -> :local ExitOK false; -25c26,27 -< :exit; ---- -> :set ExitOK true; -> :error false; -45c47 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/dhcp-lease-comment.wifi.rsc main/dhcp-lease-comment.wifi.rsc -13a14 -> :local ExitOK false; -24c25,26 -< :exit; ---- -> :set ExitOK true; -> :error false; -40c42 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/dhcp-to-dns.rsc main/dhcp-to-dns.rsc -11a12 -> :local ExitOK false; -30c31,32 -< :exit; ---- -> :set ExitOK true; -> :error false; -127c129 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/doc and main/doc -diff staging/firmware-upgrade-reboot.rsc main/firmware-upgrade-reboot.rsc -10a11 -> :local ExitOK false; -22c23,24 -< :exit; ---- -> :set ExitOK true; -> :error false; -29c31,32 -< :exit; ---- -> :set ExitOK true; -> :error true; -33c36,37 -< :exit; ---- -> :set ExitOK true; -> :error true; -55c59 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/fw-addr-lists.d and main/fw-addr-lists.d -diff staging/fw-addr-lists.rsc main/fw-addr-lists.rsc -10a11 -> :local ExitOK false; -48c49,50 -< :exit; ---- -> :set ExitOK true; -> :error false; -114,123c116,129 -< -< :local Branch; -< :if ($Address ~ "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?\$") do={ -< :local Net $Address; -< :local CIDR 32; -< :local Slash [ :find $Address "/" ]; -< :if ([ :typeof $Slash ] = "num") do={ -< :set Net [ :toip [ :pick $Address 0 $Slash ] ] -< :set CIDR [ :pick $Address ($Slash + 1) [ :len $Address ] ]; -< :set Address [ :tostr (([ :toip $Net ] & [ $NetMask4 $CIDR ]) . [ $IfThenElse ($CIDR < 32) ("/" . $CIDR) ]) ]; ---- -> :do { -> :local Branch; -> :if ($Address ~ "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?\$") do={ -> :local Net $Address; -> :local CIDR 32; -> :local Slash [ :find $Address "/" ]; -> :if ([ :typeof $Slash ] = "num") do={ -> :set Net [ :toip [ :pick $Address 0 $Slash ] ] -> :set CIDR [ :pick $Address ($Slash + 1) [ :len $Address ] ]; -> :set Address [ :tostr (([ :toip $Net ] & [ $NetMask4 $CIDR ]) . [ $IfThenElse ($CIDR < 32) ("/" . $CIDR) ]) ]; -> } -> :set Branch [ $GetBranch $Address ]; -> :set ($IPv4Addresses->$Branch->$Address) $TimeOut; -> :error true; -125,135c131,142 -< :set Branch [ $GetBranch $Address ]; -< :set ($IPv4Addresses->$Branch->$Address) $TimeOut; -< :continue; -< } -< :if ($Address ~ "^[0-9a-zA-Z]*:[0-9a-zA-Z:\\.]+(/[0-9]{1,3})?\$") do={ -< :local Net $Address; -< :local CIDR 128; -< :local Slash [ :find $Address "/" ]; -< :if ([ :typeof $Slash ] = "num") do={ -< :set Net [ :toip6 [ :pick $Address 0 $Slash ] ] -< :set CIDR [ :pick $Address ($Slash + 1) [ :len $Address ] ]; ---- -> :if ($Address ~ "^[0-9a-zA-Z]*:[0-9a-zA-Z:\\.]+(/[0-9]{1,3})?\$") do={ -> :local Net $Address; -> :local CIDR 128; -> :local Slash [ :find $Address "/" ]; -> :if ([ :typeof $Slash ] = "num") do={ -> :set Net [ :toip6 [ :pick $Address 0 $Slash ] ] -> :set CIDR [ :pick $Address ($Slash + 1) [ :len $Address ] ]; -> } -> :set Address (([ :toip6 $Net ] & [ $NetMask6 $CIDR ]) . "/" . $CIDR); -> :set Branch [ $GetBranch $Address ]; -> :set ($IPv6Addresses->$Branch->$Address) $TimeOut; -> :error true; -137,147c144,150 -< :set Address (([ :toip6 $Net ] & [ $NetMask6 $CIDR ]) . "/" . $CIDR); -< :set Branch [ $GetBranch $Address ]; -< :set ($IPv6Addresses->$Branch->$Address) $TimeOut; -< :continue; -< } -< :if ($Address ~ "^[\\.a-zA-Z0-9-]+\\.[a-zA-Z]{2,}\$") do={ -< :set Branch [ $GetBranch $Address ]; -< :set ($IPv4Addresses->$Branch->$Address) $TimeOut; -< :set ($IPv6Addresses->$Branch->$Address) $TimeOut; -< :continue; -< } ---- -> :if ($Address ~ "^[\\.a-zA-Z0-9-]+\\.[a-zA-Z]{2,}\$") do={ -> :set Branch [ $GetBranch $Address ]; -> :set ($IPv4Addresses->$Branch->$Address) $TimeOut; -> :set ($IPv6Addresses->$Branch->$Address) $TimeOut; -> :error true; -> } -> } on-error={ } -232c235 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/general and main/general -Common subdirectories: staging/global-functions.d and main/global-functions.d -diff staging/global-functions.rsc main/global-functions.rsc -7c7 -< # requires RouterOS, version=7.21 ---- -> # requires RouterOS, version=7.19 -38a39 -> :global ExitError; -50a52 -> :global HexToNum; -131c133,134 -< :if ((($CertSettings->"builtin-trust-store") ~ $UseFor || \ ---- -> :if ((($CertSettings->"builtin-trust-anchors") = "trusted" || \ -> ($CertSettings->"builtin-trust-store") ~ $UseFor || \ -484a488,500 -> # wrapper for $ExitOnError with additional parameter -> :set ExitError do={ -> :local ExitOK [ :tostr $1 ]; -> :local Name [ :tostr $2 ]; -> :local Error [ :tostr $3 ]; -> -> :global ExitOnError; -> -> :if ($ExitOK = "false") do={ -> $ExitOnError $Name $Error; -> } -> } -> -722a739,751 -> # convert from hex (string) to num -> :set HexToNum do={ -> :local Input [ :tostr $1 ]; -> -> :global HexToNum; -> -> :if ([ :pick $Input 0 ] = "*") do={ -> :return [ $HexToNum [ :pick $Input 1 [ :len $Input ] ] ]; -> } -> -> :return [ :tonum ("0x" . $Input) ]; -> } -> -1017c1046,1050 -< :local CIDR [ :tonum $1 ]; ---- -> :local CIDR [ :tostr $1 ]; -> -> :global IfThenElse; -> :global MAX; -> :global MIN; -1019c1052,1070 -< :return (((~::) << (128 - $CIDR)) & (~::)); ---- -> :global NetMask6Cache; -> -> :if ([ :typeof ($NetMask6Cache->$CIDR) ] = "ip6") do={ -> :return ($NetMask6Cache->$CIDR); -> } -> -> :if ([ :typeof $NetMask6Cache ] = "nothing") do={ -> :set NetMask6Cache ({}); -> } -> -> :local Mask ""; -> :for I from=0 to=7 do={ -> :set Mask ($Mask . \ -> [ :convert from=num to=hex (0xffff - (0xffff >> [ :tonum [ $MIN [ $MAX ($CIDR - (16 * $I)) 0 ] 16 ] ])) ] . \ -> [ $IfThenElse ($I < 7) ":" ]); -> } -> :set Mask [ :toip6 $Mask ]; -> :set ($NetMask6Cache->$CIDR) $Mask; -> :return $Mask; -1271,1281c1322,1326 -< :if ($ScriptInfo->"ignore" = true) do={ -< $LogPrint debug $0 ("Ignoring script '" . $ScriptVal->"name" . "', as requested."); -< :continue; -< } -< -< :local CheckSum ($CheckSums->($ScriptVal->"name")); -< :if ([ :len ($ScriptInfo->"base-url") ] = 0 && [ :len ($ScriptInfo->"url-suffix") ] = 0 && \ -< [ :convert transform=md5 to=hex [ :tolf ($ScriptVal->"source") ] ] = $CheckSum) do={ -< $LogPrint debug $0 ("Checksum for script '" . $ScriptVal->"name" . "' matches, ignoring."); -< :continue; -< } ---- -> :do { -> :if ($ScriptInfo->"ignore" = true) do={ -> $LogPrint debug $0 ("Ignoring script '" . $ScriptVal->"name" . "', as requested."); -> :error true; -> } -1283,1285c1328,1332 -< :if ([ :len ($ScriptInfo->"certificate") ] > 0) do={ -< :if ([ $CertificateAvailable ($ScriptInfo->"certificate") "fetch" ] = false) do={ -< $LogPrint warning $0 ("Downloading certificate failed, trying without."); ---- -> :local CheckSum ($CheckSums->($ScriptVal->"name")); -> :if ([ :len ($ScriptInfo->"base-url") ] = 0 && [ :len ($ScriptInfo->"url-suffix") ] = 0 && \ -> [ :convert transform=md5 to=hex [ :tolf ($ScriptVal->"source") ] ] = $CheckSum) do={ -> $LogPrint debug $0 ("Checksum for script '" . $ScriptVal->"name" . "' matches, ignoring."); -> :error true; -1287d1333 -< } -1289,1297c1335,1338 -< :onerror Err { -< :local BaseUrl [ $EitherOr ($ScriptInfo->"base-url") $ScriptUpdatesBaseUrl ]; -< :local UrlSuffix [ $EitherOr ($ScriptInfo->"url-suffix") $ScriptUpdatesUrlSuffix ]; -< :local Url ($BaseUrl . $ScriptVal->"name" . ".rsc" . $UrlSuffix); -< $LogPrint debug $0 ("Fetching script '" . $ScriptVal->"name" . "' from url: " . $Url); -< :local Result [ /tool/fetch check-certificate=yes-without-crl \ -< http-header-field=({ [ $FetchUserAgentStr $0 ] }) $Url output=user as-value ]; -< :if ($Result->"status" = "finished") do={ -< :set SourceNew [ :tolf ($Result->"data") ]; ---- -> :if ([ :len ($ScriptInfo->"certificate") ] > 0) do={ -> :if ([ $CertificateAvailable ($ScriptInfo->"certificate") "fetch" ] = false) do={ -> $LogPrint warning $0 ("Downloading certificate failed, trying without."); -> } -1299,1302c1340,1367 -< } do={ -< $LogPrint warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "': " . $Err); -< :if ($Err != "Fetch failed with status 404") do={ -< :continue; ---- -> -> :onerror Err { -> :local BaseUrl [ $EitherOr ($ScriptInfo->"base-url") $ScriptUpdatesBaseUrl ]; -> :local UrlSuffix [ $EitherOr ($ScriptInfo->"url-suffix") $ScriptUpdatesUrlSuffix ]; -> :local Url ($BaseUrl . $ScriptVal->"name" . ".rsc" . $UrlSuffix); -> $LogPrint debug $0 ("Fetching script '" . $ScriptVal->"name" . "' from url: " . $Url); -> :local Result [ /tool/fetch check-certificate=yes-without-crl \ -> http-header-field=({ [ $FetchUserAgentStr $0 ] }) $Url output=user as-value ]; -> :if ($Result->"status" = "finished") do={ -> :set SourceNew [ :tolf ($Result->"data") ]; -> } -> } do={ -> $LogPrint warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "': " . $Err); -> :if ($Err != "Fetch failed with status 404") do={ -> :error false; -> } -> -> :if ($ScriptVal->"source" = "#!rsc by RouterOS\n") do={ -> $LogPrint warning $0 ("Removing dummy. Typo on installation?"); -> /system/script/remove $Script; -> :error false; -> } -> :if ([ :len ($ScriptInfo->"base-url") ] = 0 && [ :len ($ScriptInfo->"url-suffix") ] = 0 && \ -> [ :len $CheckSum ] = 0) do={ -> $LogPrintOnce warning $0 \ -> ("Added the script manually? Skip updates with 'ignore=true' in comment."); -> } -> :error false; -1305,1308c1370,1372 -< :if ($ScriptVal->"source" = "#!rsc by RouterOS\n") do={ -< $LogPrint warning $0 ("Removing dummy. Typo on installation?"); -< /system/script/remove $Script; -< :continue; ---- -> :if ([ :len $SourceNew ] = 0) do={ -> $LogPrint debug $0 ("No update for script '" . $ScriptVal->"name" . "'."); -> :error false; -1310,1313c1374,1378 -< :if ([ :len ($ScriptInfo->"base-url") ] = 0 && [ :len ($ScriptInfo->"url-suffix") ] = 0 && \ -< [ :len $CheckSum ] = 0) do={ -< $LogPrintOnce warning $0 \ -< ("Added the script manually? Skip updates with 'ignore=true' in comment."); ---- -> -> :local SourceCRLF [ :tocrlf $SourceNew ]; -> :if ($SourceNew = $ScriptVal->"source" || $SourceCRLF = $ScriptVal->"source") do={ -> $LogPrint debug $0 ("Script '" . $ScriptVal->"name" . "' did not change."); -> :error false; -1315,1316d1379 -< :continue; -< } -1318,1321c1381,1385 -< :if ([ :len $SourceNew ] = 0) do={ -< $LogPrint debug $0 ("No update for script '" . $ScriptVal->"name" . "'."); -< :continue; -< } ---- -> :if ([ :pick $SourceNew 0 18 ] != "#!rsc by RouterOS\n") do={ -> $LogPrint warning $0 ("Looks like new script '" . $ScriptVal->"name" . \ -> "' is not valid (missing shebang). Ignoring!"); -> :error false; -> } -1323,1327c1387,1392 -< :local SourceCRLF [ :tocrlf $SourceNew ]; -< :if ($SourceNew = $ScriptVal->"source" || $SourceCRLF = $ScriptVal->"source") do={ -< $LogPrint debug $0 ("Script '" . $ScriptVal->"name" . "' did not change."); -< :continue; -< } ---- -> :local RequiredROS ([ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires RouterOS, ") ] ]->"version"); -> :if ([ $RequiredRouterOS $0 [ $EitherOr $RequiredROS "0.0" ] false ] = false) do={ -> $LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires RouterOS " . \ -> $RequiredROS . ", which is not met by your installation. Ignoring!"); -> :error false; -> } -1329,1333c1394,1405 -< :if ([ :pick $SourceNew 0 18 ] != "#!rsc by RouterOS\n") do={ -< $LogPrint warning $0 ("Looks like new script '" . $ScriptVal->"name" . \ -< "' is not valid (missing shebang). Ignoring!"); -< :continue; -< } ---- -> :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 ([ :len $MissingDM ] > 0) do={ -> $LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires disabled " . \ -> "device-mode features (" . [ :tostr $MissingDM ] . "). Ignoring!"); -> :error false; -> } -1335,1340c1407,1410 -< :local RequiredROS ([ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires RouterOS, ") ] ]->"version"); -< :if ([ $RequiredRouterOS $0 [ $EitherOr $RequiredROS "0.0" ] false ] = false) do={ -< $LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires RouterOS " . \ -< $RequiredROS . ", which is not met by your installation. Ignoring!"); -< :continue; -< } ---- -> :if ([ $ValidateSyntax $SourceNew ] = false) do={ -> $LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . "' failed! Ignoring!"); -> :error false; -> } -1342,1346c1412,1418 -< :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); ---- -> $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" || \ -> $ScriptVal->"name" = "global-functions" || \ -> $ScriptVal->"name" ~ ("^(global-functions\\.d|mod)/.")) do={ -> :set ReloadGlobal true; -1348,1367c1420 -< } -< :if ([ :len $MissingDM ] > 0) do={ -< $LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires disabled " . \ -< "device-mode features (" . [ :tostr $MissingDM ] . "). Ignoring!"); -< :continue; -< } -< -< :if ([ $ValidateSyntax $SourceNew ] = false) do={ -< $LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . "' failed! Ignoring!"); -< :continue; -< } -< -< $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" || \ -< $ScriptVal->"name" = "global-functions" || \ -< $ScriptVal->"name" ~ ("^(global-functions\\.d|mod)/.")) do={ -< :set ReloadGlobal true; -< } ---- -> } on-error={ } -diff staging/gps-track.rsc main/gps-track.rsc -11a12 -> :local ExitOK false; -27c28,29 -< :exit; ---- -> :set ExitOK true; -> :error false; -50c52 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/hotspot-to-wpa-cleanup.capsman.rsc main/hotspot-to-wpa-cleanup.capsman.rsc -14a15 -> :local ExitOK false; -27c28,29 -< :exit; ---- -> :set ExitOK true; -> :error false; -77c79 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/hotspot-to-wpa-cleanup.template.rsc main/hotspot-to-wpa-cleanup.template.rsc -15a16 -> :local ExitOK false; -28c29,30 -< :exit; ---- -> :set ExitOK true; -> :error false; -84c86 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/hotspot-to-wpa-cleanup.wifi.rsc main/hotspot-to-wpa-cleanup.wifi.rsc -14a15 -> :local ExitOK false; -27c28,29 -< :exit; ---- -> :set ExitOK true; -> :error false; -77c79 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/hotspot-to-wpa.capsman.rsc main/hotspot-to-wpa.capsman.rsc -13a14 -> :local ExitOK false; -29c30,31 -< :exit; ---- -> :set ExitOK true; -> :error false; -34c36,37 -< :exit; ---- -> :set ExitOK true; -> :error false; -61c64,65 -< :exit; ---- -> :set ExitOK true; -> :error true; -100c104 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/hotspot-to-wpa.template.rsc main/hotspot-to-wpa.template.rsc -14a15 -> :local ExitOK false; -30c31,32 -< :exit; ---- -> :set ExitOK true; -> :error false; -35c37,38 -< :exit; ---- -> :set ExitOK true; -> :error false; -68c71,72 -< :exit; ---- -> :set ExitOK true; -> :error true; -120c124 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/hotspot-to-wpa.wifi.rsc main/hotspot-to-wpa.wifi.rsc -13a14 -> :local ExitOK false; -29c30,31 -< :exit; ---- -> :set ExitOK true; -> :error false; -34c36,37 -< :exit; ---- -> :set ExitOK true; -> :error false; -61c64,65 -< :exit; ---- -> :set ExitOK true; -> :error true; -97c101 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/ipsec-to-dns.rsc main/ipsec-to-dns.rsc -11a12 -> :local ExitOK false; -30c31,32 -< :exit; ---- -> :set ExitOK true; -> :error false; -81c83 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/ipv6-update.rsc main/ipv6-update.rsc -10a11 -> :local ExitOK false; -27c28,29 -< :exit; ---- -> :set ExitOK true; -> :error false; -32c34,35 -< :exit; ---- -> :set ExitOK true; -> :error false; -37c40,41 -< :exit; ---- -> :set ExitOK true; -> :error false; -42c46,47 -< :exit; ---- -> :set ExitOK true; -> :error false; -101c106 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/lease-script.rsc main/lease-script.rsc -10a11 -> :local ExitOK false; -28c29,30 -< :exit; ---- -> :set ExitOK true; -> :error false; -35c37,38 -< :exit; ---- -> :set ExitOK true; -> :error false; -40c43,44 -< :exit; ---- -> :set ExitOK true; -> :error true; -60c64 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/log-forward.rsc main/log-forward.rsc -6c6 -< # requires RouterOS, version=7.22beta1 ---- -> # requires RouterOS, version=7.19 -10a11 -> :local ExitOK false; -25a27 -> :global HexToNum; -35,39c37,38 -< :exit; -< } -< -< :if ([ :typeof $LogForwardLast ] = "nothing") do={ -< :set LogForwardLast false; ---- -> :set ExitOK true; -> :error false; -49c48,49 -< :exit; ---- -> :set ExitOK true; -> :error false; -53a54 -> :local Last [ $IfThenElse ([ :len $LogForwardLast ] > 0) [ $HexToNum $LogForwardLast ] -1 ]; -65c66,67 -< :local Max ($LogAll->([ :len $LogAll ] - 1)); ---- -> :local MaxId ($LogAll->([ :len $LogAll ] - 1)); -> :local MaxNum [ $HexToNum $MaxId ]; -68,71c70,73 -< :foreach Message in=[ /log/find where .id>$LogForwardLast and .id<=$Max and \ -< ((!(message="") and !(message~$LogForwardFilterLogForwardingCached) and \ -< !(topics~$LogForwardFilter) and !(message~$LogForwardFilterMessage)) or \ -< topics~$LogForwardInclude or message~$LogForwardIncludeMessage) ] do={ ---- -> :foreach Message in=[ /log/find where (!(message="") and \ -> !(message~$LogForwardFilterLogForwardingCached) and \ -> !(topics~$LogForwardFilter) and !(message~$LogForwardFilterMessage)) or \ -> topics~$LogForwardInclude or message~$LogForwardIncludeMessage ] do={ -75,88c77,95 -< :local DupCount ($MessageDups->($MessageVal->"message")); -< :if ($MessageVal->"topics" ~ "(warning)") do={ -< :set Warning true; -< :set Bullet "large-orange-circle"; -< } -< :if ($MessageVal->"topics" ~ "(emergency|alert|critical|error)") do={ -< :set Warning true; -< :set Bullet "large-red-circle"; -< } -< :if ($DupCount < 3) do={ -< :set Messages ($Messages . "\n" . [ $SymbolForNotification $Bullet ] . \ -< $MessageVal->"time" . " " . [ :tostr ($MessageVal->"topics") ] . " " . $MessageVal->"message"); -< } else={ -< :set Duplicates true; ---- -> :local Current [ $HexToNum ($MessageVal->".id") ]; -> :if ($Last < $Current && $Current <= $MaxNum) do={ -> :local DupCount ($MessageDups->($MessageVal->"message")); -> :if ($MessageVal->"topics" ~ "(warning)") do={ -> :set Warning true; -> :set Bullet "large-orange-circle"; -> } -> :if ($MessageVal->"topics" ~ "(emergency|alert|critical|error)") do={ -> :set Warning true; -> :set Bullet "large-red-circle"; -> } -> :if ($DupCount < 3) do={ -> :set Messages ($Messages . "\n" . [ $SymbolForNotification $Bullet ] . \ -> $MessageVal->"time" . " " . [ :tostr ($MessageVal->"topics") ] . " " . $MessageVal->"message"); -> } else={ -> :set Duplicates true; -> } -> :set ($MessageDups->($MessageVal->"message")) ($DupCount + 1); -> :set Count ($Count + 1); -90,91d96 -< :set ($MessageDups->($MessageVal->"message")) ($DupCount + 1); -< :set Count ($Count + 1); -109c114 -< :set LogForwardLast $Max; ---- -> :set LogForwardLast $MaxId; -111c116 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -Common subdirectories: staging/mod and main/mod -diff staging/netwatch-dns.rsc main/netwatch-dns.rsc -11a12 -> :local ExitOK false; -28c29,30 -< :exit; ---- -> :set ExitOK true; -> :error false; -34c36,37 -< :exit; ---- -> :set ExitOK true; -> :error true; -89c92,93 -< :exit; ---- -> :set ExitOK true; -> :error true; -124d127 -< :continue; -127,128c130,141 -< :if ([ :typeof [ :find $Data "doh-check-OK" ] ] != "num") do={ -< $LogPrint warning $ScriptName ("Received unexpected response from DoH server: " . \ ---- -> :if ($Data != false) do={ -> :if ([ :typeof [ :find $Data "doh-check-OK" ] ] = "num") do={ -> /ip/dns/set use-doh-server=($DohServer->"doh-url") verify-doh-cert=yes; -> :if ([ /certificate/settings/get crl-use ] = true) do={ -> $LogPrintOnce warning $ScriptName ("Configured to use CRL, that can cause severe issue!"); -> } -> /ip/dns/cache/flush; -> $LogPrint info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url")); -> :set ExitOK true; -> :error true; -> } else={ -> $LogPrint warning $ScriptName ("Received unexpected response from DoH server: " . \ -130,135c143 -< :continue; -< } -< -< /ip/dns/set use-doh-server=($DohServer->"doh-url") verify-doh-cert=yes; -< :if ([ /certificate/settings/get crl-use ] = true) do={ -< $LogPrintOnce warning $ScriptName ("Configured to use CRL, that can cause severe issue!"); ---- -> } -137,139d144 -< /ip/dns/cache/flush; -< $LogPrint info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url")); -< :exit; -142c147 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/netwatch-notify.rsc main/netwatch-notify.rsc -10a11 -> :local ExitOK false; -82c83,84 -< :exit; ---- -> :set ExitOK true; -> :error false; -226c228 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/ospf-to-leds.rsc main/ospf-to-leds.rsc -10a11 -> :local ExitOK false; -22c23,24 -< :exit; ---- -> :set ExitOK true; -> :error false; -46c48 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/packages-update.rsc main/packages-update.rsc -11a12 -> :local ExitOK false; -61c62,63 -< :exit; ---- -> :set ExitOK true; -> :error false; -66c68,69 -< :exit; ---- -> :set ExitOK true; -> :error false; -73c76,77 -< :exit; ---- -> :set ExitOK true; -> :error false; -78c82,83 -< :exit; ---- -> :set ExitOK true; -> :error true; -109c114,115 -< :exit; ---- -> :set ExitOK true; -> :error false; -113c119,120 -< :exit; ---- -> :set ExitOK true; -> :error false; -132c139,140 -< :exit; ---- -> :set ExitOK true; -> :error false; -140c148,149 -< :exit; ---- -> :set ExitOK true; -> :error false; -154c163,164 -< :exit; ---- -> :set ExitOK true; -> :error true; -159c169,170 -< :exit; ---- -> :set ExitOK true; -> :error true; -167c178 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/ppp-on-up.rsc main/ppp-on-up.rsc -10a11 -> :local ExitOK false; -23c24,25 -< :exit; ---- -> :set ExitOK true; -> :error false; -41c43 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/sms-action.rsc main/sms-action.rsc -10a11 -> :local ExitOK false; -26c27,28 -< :exit; ---- -> :set ExitOK true; -> :error false; -38c40 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/sms-forward.rsc main/sms-forward.rsc -11a12 -> :local ExitOK false; -31c32,33 -< :exit; ---- -> :set ExitOK true; -> :error false; -36c38,39 -< :exit; ---- -> :set ExitOK true; -> :error false; -45c48,49 -< :exit; ---- -> :set ExitOK true; -> :error true; -106c110 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/telegram-chat.rsc main/telegram-chat.rsc -11a12 -> :local ExitOK false; -50c51,52 -< :exit; ---- -> :set ExitOK true; -> :error false; -64c66,67 -< :exit; ---- -> :set ExitOK true; -> :error false; -71,81c74,85 -< :onerror Err { -< :set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \ -< ("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \ -< $TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data"); -< :set TelegramRandomDelay [ $MAX 0 ($TelegramRandomDelay - 1) ]; -< :break; -< } do={ -< :if ($I < 4) do={ -< $LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try: " . $Err); -< :set TelegramRandomDelay [ $MIN 15 ($TelegramRandomDelay + 5) ]; -< :delay (($I * $I) . "s"); ---- -> :if ($Data = false) do={ -> :onerror Err { -> :set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \ -> ("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \ -> $TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data"); -> :set TelegramRandomDelay [ $MAX 0 ($TelegramRandomDelay - 1) ]; -> } do={ -> :if ($I < 4) do={ -> $LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try: " . $Err); -> :set TelegramRandomDelay [ $MIN 15 ($TelegramRandomDelay + 5) ]; -> :delay (($I * $I) . "s"); -> } -88c92,93 -< :exit; ---- -> :set ExitOK true; -> :error false; -116a122 -> :local Done false; -124c130 -< :continue; ---- -> :set Done true; -126c132 -< :if ([ :pick $Command 0 1 ] = "!") do={ ---- -> :if ($Done = false && [ :pick $Command 0 1 ] = "!") do={ -134c140 -< :continue; ---- -> :set Done true; -136c142 -< :if (($IsMyReply = 1 || ($IsAnyReply = false && \ ---- -> :if ($Done = false && ($IsMyReply = 1 || ($IsAnyReply = false && \ -143c149,150 -< :exit; ---- -> :set ExitOK true; -> :error false; -193c200 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/update-gre-address.rsc main/update-gre-address.rsc -11a12 -> :local ExitOK false; -23c24,25 -< :exit; ---- -> :set ExitOK true; -> :error false; -43c45 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -diff staging/update-tunnelbroker.rsc main/update-tunnelbroker.rsc -13a14 -> :local ExitOK false; -26c27,28 -< :exit; ---- -> :set ExitOK true; -> :error false; -31c33,34 -< :exit; ---- -> :set ExitOK true; -> :error false; -54c57,58 -< :exit; ---- -> :set ExitOK true; -> :error false; -69c73 -< :global ExitOnError; $ExitOnError [ :jobname ] $Err; ---- -> :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; -- 2.52.0