include $(TOPDIR)/rules.mk
PKG_NAME:=sudo
-PKG_VERSION:=1.9.14p1
+PKG_VERSION:=1.9.14p3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.sudo.ws/dist
-PKG_HASH:=e91bf5ef2e09d857ee901c3465cf7ddb37e43c763b65d19fa0862d1dec128faf
+PKG_HASH:=a08318b1c4bc8582c004d4cd9ae2903abc549e7e46ba815e41fe81d1c0782b62
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_VERSION:=4.2.0
PKG_RELEASE:=1
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING LGPL.txt GPL.txt
PKG_CPE_ID:=cpe:/a:balabit:syslog-ng
include $(TOPDIR)/rules.mk
PKG_NAME:=lua-eco
-PKG_VERSION:=2.5.0
+PKG_VERSION:=2.5.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL=https://github.com/zhaojh329/lua-eco/releases/download/v$(PKG_VERSION)
-PKG_HASH:=d41668d137780f2655ebfec88276249bb9cd5c53f758c3e2103eb001ed9b5d02
+PKG_HASH:=436c09dd7dbc88ab651ae7696f2102b5635628ab420cc550bc237ecb04cade5d
PKG_MAINTAINER:=Jianhui Zhao <zhaojh329@gmail.com>
PKG_LICENSE:=MIT
include $(TOPDIR)/rules.mk
PKG_NAME:=php
-PKG_VERSION:=8.2.9
+PKG_VERSION:=8.2.10
PKG_RELEASE:=1
PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://www.php.net/distributions/
-PKG_HASH:=1e6cb77f997613864ab3127fbfc6a8c7fdaa89a95e8ed6167617b913b4de4765
+PKG_HASH:=561dc4acd5386e47f25be76f2c8df6ae854756469159248313bcf276e282fbb3
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16
--- a/configure.ac
+++ b/configure.ac
-@@ -1453,7 +1453,7 @@ PHP_REMOVE_USR_LIB(LDFLAGS)
+@@ -1455,7 +1455,7 @@ PHP_REMOVE_USR_LIB(LDFLAGS)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
--- a/configure.ac
+++ b/configure.ac
-@@ -1636,13 +1636,13 @@ CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
+@@ -1638,13 +1638,13 @@ CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_BUILD_DEPENDS:=python-poetry-core/host
PYPI_NAME:=awesomeversion
PKG_HASH:=a505558316010d2d10d487226f79c1157204af00fa462fdcf948e347011dd491
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENCE.md
PYPI_NAME:=Babel
PKG_HASH:=cc2d99999cd01d44420ae725a21c9e3711b3aadc7976d6147f622d8581963455
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=python-ble2mqtt
-PKG_VERSION:=0.1.9
+PKG_VERSION:=0.2.0
PKG_RELEASE:=1
PYPI_NAME:=ble2mqtt
-PKG_HASH:=4b7c9ea747d04687a7e57d47a7d847870e4d9f474967906e9e1e06b7bce5a5b9
+PKG_HASH:=cd45b5fb382a71d441470899e01be50482d26e2d86e3012e1f5a9ab633248383
PKG_MAINTAINER:=Quintin Hill <stuff@quintin.me.uk>
PKG_LICENSE:=MIT
include $(TOPDIR)/rules.mk
PKG_NAME:=python-build
-PKG_VERSION:=0.10.0
-PKG_RELEASE:=2
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
PYPI_NAME:=build
-PKG_HASH:=d5b71264afdb5951d6704482aac78de887c80691c52b88a9ad195983ca2c9269
+PKG_HASH:=49a60f212df4d9925727c2118e1cbe3abf30b393eff7d0e7287d2170eb36844d
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=cachetools
PKG_HASH:=dce83f2d9b4e1f732a8cd44af8e8fab2dbe46201467fc98b3ef8f269092bf62b
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=python-cryptodome
-PKG_VERSION:=3.9.7
-PKG_RELEASE:=4
+PKG_VERSION:=3.18.0
+PKG_RELEASE:=1
PYPI_NAME:=pycryptodome
-PKG_HASH:=f1add21b6d179179b3c177c33d18a2186a09cc0d3af41ff5ed3f377360b869f2
+PKG_HASH:=c9adee653fc882d98956e33ca2c1fb582e23a8af7ac82fee75bd6113c55a0413
-PKG_LICENSE:=BSD-2-Clause
+PKG_LICENSE:=Public-Domain BSD-2-Clause
PKG_LICENSE_FILES:=LICENSE.rst
PKG_MAINTAINER:=Richard Yu <yurichard3839@gmail.com>
PKG_CPE_ID:=cpe:/a:pycryptodome:pycryptodome
CONFIG_BIG_ENDIAN="$(CONFIG_BIG_ENDIAN)"
define Package/python3-cryptodome
- SECTION:=lang-python
+ SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
- TITLE:=A self-contained cryptographic library for Python
+ TITLE:=Self-contained cryptographic library
URL:=https://www.pycryptodome.org/
- DEPENDS:=+libgmp +python3
+ DEPENDS:=+libgmp +python3-light +python3-cffi
PROVIDES:=python3-crypto
endef
--- a/lib/Crypto/Math/_IntegerGMP.py
+++ b/lib/Crypto/Math/_IntegerGMP.py
-@@ -92,7 +92,7 @@ gmp_defs = """typedef unsigned long UNIX
- int __gmpz_divisible_ui_p (const mpz_t n, UNIX_ULONG d);
- """
+@@ -97,7 +97,7 @@ gmp_defs = """typedef unsigned long UNIX
+ if sys.platform == "win32":
+ raise ImportError("Not using GMP on Windows")
-lib = load_lib("gmp", gmp_defs)
+lib = load_lib("libgmp.so.10", gmp_defs)
--- a/setup.py
+++ b/setup.py
-@@ -301,6 +301,9 @@ package_data = {
- ],
+@@ -276,6 +276,9 @@ package_data = {
+ "Crypto.Util" : [ "*.pyi" ],
}
+packages = [i for i in packages if not i.startswith('Crypto.SelfTest')]
include $(TOPDIR)/rules.mk
PKG_NAME:=python-cryptodomex
-PKG_VERSION:=3.10.1
-PKG_RELEASE:=2
+PKG_VERSION:=3.18.0
+PKG_RELEASE:=1
PYPI_NAME:=pycryptodomex
-PKG_HASH:=541cd3e3e252fb19a7b48f420b798b53483302b7fe4d9954c947605d0a263d62
+PKG_HASH:=3e3ecb5fe979e7c1bb0027e518340acf7ee60415d79295e5251d13c68dde576e
-PKG_LICENSE:=BSD-2-Clause
+PKG_LICENSE:=Public-Domain BSD-2-Clause
PKG_LICENSE_FILES:=LICENSE.rst
PKG_MAINTAINER:=Richard Yu <yurichard3839@gmail.com>
CONFIG_BIG_ENDIAN="$(CONFIG_BIG_ENDIAN)"
define Package/python3-cryptodomex
- SECTION:=lang-python
+ SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
- TITLE:=A self-contained cryptographic library for Python
+ TITLE:=Self-contained cryptographic library
URL:=https://www.pycryptodome.org/
- DEPENDS:=+libgmp +python3
+ DEPENDS:=+libgmp +python3-light +python3-cffi
endef
define Package/python3-cryptodomex/description
--- a/lib/Cryptodome/Math/_IntegerGMP.py
+++ b/lib/Cryptodome/Math/_IntegerGMP.py
-@@ -95,7 +95,7 @@ gmp_defs = """typedef unsigned long UNIX
+@@ -97,7 +97,7 @@ gmp_defs = """typedef unsigned long UNIX
if sys.platform == "win32":
raise ImportError("Not using GMP on Windows")
--- a/setup.py
+++ b/setup.py
-@@ -275,6 +275,9 @@ package_data = {
+@@ -276,6 +276,9 @@ package_data = {
"Crypto.Util" : [ "*.pyi" ],
}
include $(TOPDIR)/rules.mk
PKG_NAME:=python-dbus-fast
-PKG_VERSION:=1.93.0
+PKG_VERSION:=1.94.1
PKG_RELEASE:=1
PYPI_NAME:=dbus-fast
PYPI_SOURCE_NAME:=dbus_fast
-PKG_HASH:=4a86346d2fd26b589cf8f98a5467ecb363fce3b8b0d9cef3b5127c9408129428
+PKG_HASH:=9514e4abf586c656fb70cf9dab323a019131a032765997972045059717b7537c
PKG_MAINTAINER:=Quintin Hill <stuff@quintin.me.uk>
PKG_LICENSE:=MIT
PYPI_SOURCE_NAME:=flask_babel
PKG_HASH:=be015772c5d7f046f3b99c508dcf618636eb93d21b713b356db79f3e79f69f39
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=Flask-SeaSurf
PKG_HASH:=54537008c769ac0ada8237877327c3e7ed74dcd8b01e74a9120ee0232c5951a9
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=Flask-Session
PKG_HASH:=0768e2bbf06f963ec1aa711bde7aa32dc39ff70f89b495d6db687d899eae4423
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=Markdown
PKG_HASH:=225c6123522495d4119a90b3a3ba31a1e87a70369e03f14799ea9c0d7183a3d6
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE.md
PKG_VERSION:=1.6.1
PKG_RELEASE:=2
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>, Alexandru Ardelean <ardeleanalex@gmail.com>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>, Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_LICENSE:=EPL-1.0 Eclipse Distribution License v1.0
PKG_LICENSE_FILES:=epl-v10 edl-v10
PYPI_NAME:=pyotp
PKG_HASH:=346b6642e0dbdde3b4ff5a930b664ca82abfa116356ed48cc42c7d6590d36f63
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=pyrsistent
PKG_HASH:=1a2994773706bbb4995c31a97bc94f1418314923bd1048c6d964837040376440
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.mit
include $(TOPDIR)/rules.mk
PKG_NAME:=python-pyserial
-PKG_VERSION:=3.4
-PKG_RELEASE:=2
+PKG_VERSION:=3.5
+PKG_RELEASE:=1
PYPI_NAME:=pyserial
-PKG_HASH:=6e2d401fdee0eab996cf734e67773a0143b932772ca8b42451440cfed942c627
+PKG_HASH:=3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb
-PKG_LICENSE:=BSD
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=LICENSE.txt
PKG_MAINTAINER:=Micke Prag <micke.prag@telldus.se>
include ../pypi.mk
include ../python3-package.mk
define Package/python3-pyserial
- SECTION:=lang-python
+ SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
- TITLE:=python3-pyserial
+ TITLE:=Serial Port Extension
URL:=https://github.com/pyserial/pyserial
- DEPENDS:=+python3-light
+ DEPENDS:=+python3-light +python3-logging +python3-urllib
endef
define Package/python3-pyserial/description
-This module encapsulates the access for the serial port. It provides backends
-for Python running on Windows, OSX, Linux, BSD (possibly any POSIX compliant
-system) and IronPython. The module named "serial" automatically selects the
-appropriate backend.
+This module encapsulates the access for the serial port. It provides
+backends for Python running on Windows, OSX, Linux, BSD (possibly any
+POSIX compliant system) and IronPython. The module named "serial"
+automatically selects the appropriate backend.
endef
$(eval $(call Py3Package,python3-pyserial))
PKG_VERSION:=2.31.0
PKG_RELEASE:=1
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>, Alexandru Ardelean <ardeleanalex@gmail.com>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>, Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:python-requests:requests
--- /dev/null
+#
+# Copyright (C) 2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-ruamel-yaml
+PKG_VERSION:=0.17.32
+PKG_RELEASE:=1
+
+PYPI_NAME:=ruamel.yaml
+PKG_HASH:=ec939063761914e14542972a5cba6d33c23b0859ab6342f61cf070cfc600efc2
+
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+
+include ../pypi.mk
+include $(INCLUDE_DIR)/package.mk
+include ../python3-package.mk
+
+define Package/python3-ruamel-yaml
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ TITLE:=YAML 1.2 loader/dumper
+ URL:=https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree
+ DEPENDS:= \
+ +python3-light
+endef
+
+define Package/python3-ruamel-yaml/description
+ruamel-yaml is a YAML parser/emitter that supports roundtrip
+preservation of comments, seq/map flow style, and map key order
+endef
+
+$(eval $(call Py3Package,python3-ruamel-yaml))
+$(eval $(call BuildPackage,python3-ruamel-yaml))
+$(eval $(call BuildPackage,python3-ruamel-yaml-src))
PYPI_NAME:=schedule
PKG_HASH:=b4ad697aafba7184c9eb6a1e2ebc41f781547242acde8ceae9a0a25b04c0922d
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt
PYPI_NAME:=sentry-sdk
PKG_HASH:=a99ee105384788c3f228726a88baf515fe7b5f1d2d0f215a03d194369f158df7
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=$(PKG_NAME)
PKG_HASH:=ce0d46ddb668b3be82f4ed5e503dbc33dd815d83e2eb6824211310d3fb172a27
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=SQLAlchemy
PKG_HASH:=ca8a5ff2aa7f3ade6c498aaafce25b1eaeabe4e42b73e25519183e4566a16fc6
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:sqlalchemy:sqlalchemy
PYPI_NAME:=tornado
PKG_HASH:=e7d8db41c0181c80d76c982aacc442c0783a2c54d6400fe028954201a2e032fe
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=python-ubus
-PKG_VERSION:=0.1.1
-PKG_RELEASE:=2
+PKG_VERSION:=0.1.2
+PKG_RELEASE:=1
PYPI_NAME:=ubus
-PKG_HASH:=7e57bda989bc35b48c7075d03ec2818226e722bbf1bde138d7e7ea26d462682a
+PKG_HASH:=4dc4ef0fbcc8abb7a2354691475a58ff3eb015f1bab3150750729f7f657dd440
PKG_MAINTAINER:=Erik Larsson <who+openwrt@cnackers.org>
PKG_LICENSE:=LGPL-2.1-or-later
SUBMENU:=Python
SECTION:=lang
CATEGORY:=Languages
- TITLE:=Python3 ubus
+ TITLE:=libubus bindings
URL:=https://gitlab.nic.cz/turris/python-ubus/
DEPENDS:=+libubus +libblobmsg-json +python3-light
endef
PYPI_NAME:=pyuci
PKG_HASH:=865a45d48fb5d363f1230e94fa2c5b01ae6487f02f2180b0a6f78193a70166e2
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE
PYPI_NAME:=Unidecode
PKG_HASH:=fed09cf0be8cf415b391642c2a5addfc72194407caee4f98719e40ec2a72b830
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=python-urllib3
-PKG_VERSION:=1.25.11
+PKG_VERSION:=2.0.4
PKG_RELEASE:=1
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_CPE_ID:=cpe:/a:urllib3_project:urllib3
PYPI_NAME:=urllib3
-PKG_HASH:=8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2
+PKG_HASH:=8d22f86aae8ef5e410d4f539fde9ce6b2113a001bb4d189e0aed70642d602b11
+
+PKG_BUILD_DEPENDS:=python-hatchling/host
include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/rules.mk
-PKG_NAME:=voluptuous-serialize
-PKG_VERSION:=2.5.0
+PKG_NAME:=python-voluptuous-serialize
+PKG_VERSION:=2.6.0
PKG_RELEASE:=1
-PYPI_NAME:=$(PKG_NAME)
-PKG_HASH:=5359f2e0a4f972ae03066e0777b4f0755c9226b2af099ca4fc55432efd1a447b
+PYPI_NAME:=voluptuous-serialize
+PKG_HASH:=79acdc58239582a393144402d827fa8efd6df0f5350cdc606d9242f6f9bca7c4
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=Apache-2.0
-PKG_LICENSE_FILES:=COPYING
+PKG_LICENSE_FILES:=LICENSE
include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/rules.mk
PKG_NAME:=python-voluptuous
-PKG_VERSION:=0.12.1
+PKG_VERSION:=0.13.1
PKG_RELEASE:=1
PYPI_NAME:=voluptuous
-PKG_HASH:=663572419281ddfaf4b4197fd4942d181630120fb39b333e3adad70aeb56444b
+PKG_HASH:=e8d31c20601d6773cb14d4c0f42aee29c6821bbd1018039aac7ac5605b489723
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=COPYING
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
SUBMENU:=Python
TITLE:=Data validation library
URL:=https://github.com/alecthomas/voluptuous
- DEPENDS:= \
- +python3-light
+ DEPENDS:=+python3-light +python3-decimal +python3-urllib
endef
define Package/python3-voluptuous/description
-It is primarily intended for validating data coming into Python as JSON, YAML, etc.
+It is primarily intended for validating data coming into Python as JSON,
+YAML, etc.
endef
$(eval $(call Py3Package,python3-voluptuous))
include $(TOPDIR)/rules.mk
PKG_NAME:=python-wcwidth
-PKG_VERSION:=0.2.5
+PKG_VERSION:=0.2.6
PKG_RELEASE:=1
PYPI_NAME:=wcwidth
-PKG_HASH:=c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83
+PKG_HASH:=a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0
PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec1@gmail.com>
PKG_LICENSE:=MIT
-PKG_LICENSE_FILES:=LICENSE.txt
+PKG_LICENSE_FILES:=LICENSE
include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
endef
define Package/python3-wcwidth/description
- Python library that measures the width of unicode strings rendered to a terminal
+Python library that measures the width of unicode strings rendered to a
+terminal
endef
$(eval $(call Py3Package,python3-wcwidth))
include $(TOPDIR)/rules.mk
PKG_NAME:=python-websocket-client
-PKG_VERSION:=1.6.1
+PKG_VERSION:=1.6.2
PKG_RELEASE:=1
PYPI_NAME:=websocket-client
-PKG_HASH:=c951af98631d24f8df89ab1019fc365f2227c0892f12fd150e935607c79dd0dd
+PKG_HASH:=53e95c826bf800c4c465f50093a8c4ff091c7327023b10bfaff40cf1ef170eaa
PKG_MAINTAINER:=Javier Marcet <javier@marcet.info>
PKG_LICENSE:=Apache-2.0
include $(TOPDIR)/rules.mk
PKG_NAME:=python-websockets
-PKG_VERSION:=10.3
+PKG_VERSION:=11.0.3
PKG_RELEASE:=1
PYPI_NAME:=websockets
-PKG_HASH:=fc06cc8073c8e87072138ba1e431300e2d408f054b27047d047b549455066ff4
+PKG_HASH:=88fc51d9a26b10fc331be344f1781224a375b78488fc343620184e95a4b27016
PKG_MAINTAINER:=Michal Vasilek <michal.vasilek@nic.cz>
PKG_LICENSE:=BSD-3-Clause
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
- TITLE:=Library for developing WebSocket servers and clients
- URL:=https://websockets.readthedocs.io/
- DEPENDS:=+python3-light +python3-asyncio +python3-ctypes +python3-email \
- +python3-logging +python3-urllib
+ TITLE:=Implementation of the WebSocket Protocol
+ URL:=https://github.com/aaugustin/websockets
+ DEPENDS:=+python3
endef
define Package/python3-websockets/description
- websockets is a library for building WebSocket servers and clients
- in Python with a focus on correctness and simplicity.
+websockets is a library for building WebSocket servers and clients in
+Python with a focus on correctness, simplicity, robustness, and
+performance.
- Built on top of asyncio, Python’s standard asynchronous I/O framework.
- It provides an elegant coroutine-based API.
+Built on top of asyncio, Python's standard asynchronous I/O framework,
+the default implementation provides an elegant coroutine-based API.
endef
$(eval $(call Py3Package,python3-websockets))
--- /dev/null
+#
+# Copyright (C) 2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-xmltodict
+PKG_VERSION:=0.13.0
+PKG_RELEASE:=1
+
+PYPI_NAME:=xmltodict
+PKG_HASH:=341595a488e3e01a85a9d8911d8912fd922ede5fecc4dce437eb4b6c8d037e56
+
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+
+include ../pypi.mk
+include $(INCLUDE_DIR)/package.mk
+include ../python3-package.mk
+
+define Package/python3-xmltodict
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ TITLE:=Work with XML like JSON
+ URL:=https://github.com/martinblech/xmltodict
+ DEPENDS:=+python3-light +python3-xml
+endef
+
+define Package/python3-xmltodict/description
+xmltodict is a Python module that makes working with XML feel like you
+are working with JSON.
+endef
+
+$(eval $(call Py3Package,python3-xmltodict))
+$(eval $(call BuildPackage,python3-xmltodict))
+$(eval $(call BuildPackage,python3-xmltodict-src))
include $(TOPDIR)/rules.mk
PKG_NAME:=python-yaml
-PKG_VERSION:=6.0
-PKG_RELEASE:=4
+PKG_VERSION:=6.0.1
+PKG_RELEASE:=1
PYPI_NAME:=PyYAML
-PKG_HASH:=68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2
+PKG_HASH:=bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:pyyaml_project:pyyaml
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
- TITLE:=YAML parser and emitter for Python
+ TITLE:=YAML parser and emitter
URL:=https://github.com/yaml/pyyaml
DEPENDS:=+libyaml +python3-light
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=python-zeroconf
-PKG_VERSION:=0.38.1
+PKG_VERSION:=0.97.0
PKG_RELEASE:=1
PYPI_NAME:=zeroconf
-PKG_HASH:=10c501b25d8881b656e56c34674d98fe6bc752240a572e74f918bc849c93ba9c
+PKG_HASH:=9a06cd21182250100df6c4f4e9de2a47a0ea927c7d5a0446035bb3dfcc17a647
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
-PKG_LICENSE:=Apache-2.0
+PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING
+PKG_BUILD_DEPENDS:=python-cython/host python-poetry-core/host
+
include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk
SECTION:=lang
CATEGORY:=Languages
TITLE:=Multicast DNS Service Discovery Library
- URL:=https://github.com/jstasiak/python-zeroconf
+ URL:=https://github.com/python-zeroconf/python-zeroconf
DEPENDS:= \
+python3-light \
+ +python3-asyncio \
+python3-logging \
+python3-ifaddr
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=python-zipp
-PKG_VERSION:=3.4.1
-PKG_RELEASE:=2
+PKG_VERSION:=3.16.2
+PKG_RELEASE:=1
PYPI_NAME:=zipp
-PKG_HASH:=3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76
+PKG_HASH:=ebc15946aa78bd63458992fc81ec3b6f7b1e92d51c35e6de1c3804e73b799147
PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec1@gmail.com>
PKG_LICENSE:=MIT
SUBMENU:=Python
TITLE:=Zipfile object wrapper
URL:=https://github.com/jaraco/zipp
- DEPENDS:=+python3-light
+ DEPENDS:=+python3-light +python3-urllib
endef
define Package/python3-zipp/description
PYPI_NAME:=bottle
PKG_HASH:=e1a9c94970ae6d710b3fb4526294dfeb86f2cb4a81eff3a4b98dc40fb0e5e021
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:bottlepy:bottle
# Note: keep in sync with setuptools & pip
PYTHON3_VERSION_MAJOR:=3
PYTHON3_VERSION_MINOR:=11
-PYTHON3_VERSION_MICRO:=4
+PYTHON3_VERSION_MICRO:=5
PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR)
PYTHON3_PIP_PKG_RELEASE:=1
PYTHON3_SETUPTOOLS_VERSION:=65.5.0
-PYTHON3_PIP_VERSION:=23.1.2
+PYTHON3_PIP_VERSION:=23.2.1
include ../python3-version.mk
PKG_NAME:=python3
-PKG_RELEASE:=3
+PKG_RELEASE:=1
PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO)
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
-PKG_HASH:=2f0e409df2ab57aa9fc4cbddfb976af44e4e55bf6f619eee6bc5c2297264a7f6
+PKG_HASH:=85cd12e9cf1d6d5a45f17f7afe1cebe7ee628d3282281c492e86adf636defa3f
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
-PKG_LICENSE:=PSF-2.0
+PKG_LICENSE:=Python-2.0.1 0BSD
PKG_LICENSE_FILES:=LICENSE Doc/copyright.rst Doc/license.rst Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi_osx/LICENSE Modules/expat/COPYING
PKG_CPE_ID:=cpe:/a:python:python
ac_cv_file__dev_ptc=no \
ac_cv_file__dev_ptmx=yes
-# Do not link with libbsd for flock
-# https://github.com/openwrt/packages/issues/21161
-CONFIGURE_VARS += \
- ac_cv_lib_bsd_flock=no
-
# Disable stdlib modules
# Check for a better way in the future: https://github.com/python/cpython/issues/98558
CONFIGURE_VARS += \
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
-@@ -2118,6 +2118,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
+@@ -2123,6 +2123,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-j0 -d $(LIBDEST) -f \
-@@ -2145,6 +2146,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
+@@ -2150,6 +2151,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
$(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
-j0 -d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
-@@ -2163,7 +2163,7 @@ python-config: $(srcdir)/Misc/python-con
+@@ -2168,7 +2168,7 @@ python-config: $(srcdir)/Misc/python-con
@ # On Darwin, always use the python version of the script, the shell
@ # version doesn't use the compiler customizations that are provided
@ # in python (_osx_support.py).
PY_HASH_ENTRY(NULL, NULL, NULL, 0),
};
-@@ -873,11 +889,15 @@ py_evp_fromname(PyObject *module, const
+@@ -874,11 +890,15 @@ py_evp_fromname(PyObject *module, const
goto exit;
}
+++ /dev/null
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1839,7 +1839,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
- $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
- fi
-
--bininstall: altbininstall
-+bininstall: commoninstall altbininstall
- if test ! -d $(DESTDIR)$(LIBPC); then \
- echo "Creating directory $(LIBPC)"; \
- $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \
--- /dev/null
+#!/bin/sh
+
+case "$1" in
+python3|python3-base|python3-light)
+ python3 --version | grep -Fx "Python $2"
+ ;;
+esac
+++ /dev/null
-#
-# Copyright (C) 2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=ruamel-yaml
-PKG_VERSION:=0.17.17
-PKG_RELEASE:=1
-
-PYPI_NAME:=ruamel.yaml
-PKG_HASH:=9751de4cbb57d4bfbf8fc394e125ed4a2f170fbff3dc3d78abf50be85924f8be
-
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
-PKG_LICENSE:=MIT
-PKG_LICENSE_FILES:=LICENSE
-
-include ../pypi.mk
-include $(INCLUDE_DIR)/package.mk
-include ../python3-package.mk
-
-define Package/python3-ruamel-yaml
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=YAML 1.2 loader/dumper package for Python
- URL:=https://bitbucket.org/ruamel/yaml
- DEPENDS:= \
- +python3-light
-endef
-
-define Package/python3-ruamel-yaml/description
-ruamel-yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order
-endef
-
-$(eval $(call Py3Package,python3-ruamel-yaml))
-$(eval $(call BuildPackage,python3-ruamel-yaml))
-$(eval $(call BuildPackage,python3-ruamel-yaml-src))
PKG_LICENSE:=Artistic-1.0-cl8
PKG_LICENSE_FILES:=LICENSE
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
+++ /dev/null
-#
-# Copyright (C) 2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=python-xmltodict
-PKG_VERSION:=0.12.0
-PKG_RELEASE:=2
-
-PYPI_NAME:=xmltodict
-PKG_HASH:=50d8c638ed7ecb88d90561beedbf720c9b4e851a9fa6c47ebd64e99d166d8a21
-
-PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
-PKG_LICENSE:=MIT
-PKG_LICENSE_FILES:=LICENSE
-
-include ../pypi.mk
-include $(INCLUDE_DIR)/package.mk
-include ../python3-package.mk
-
-define Package/python3-xmltodict
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=Work with XML like JSON
- URL:=https://github.com/martinblech/xmltodict
- DEPENDS:= \
- +python3-light \
- +python3-xml \
- +python3-urllib
-endef
-
-define Package/python3-xmltodict/description
- xmltodict is a Python module that makes working with XML feel like you are working with JSON.
-endef
-
-$(eval $(call Py3Package,python3-xmltodict))
-$(eval $(call BuildPackage,python3-xmltodict))
-$(eval $(call BuildPackage,python3-xmltodict-src))
+From eeecf40c3eb3dbdf1981c508080ab3aa61e105e2 Mon Sep 17 00:00:00 2001
+From: Erwin Rol <erwin@erwinrol.com>
+Date: Fri, 13 Jan 2023 17:57:36 +0100
+Subject: [PATCH] Fix format warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix the following warning
+
+warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’}
+
+Signed-off-by: Erwin Rol <erwin@erwinrol.com>
+---
+ dmx_usb.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
--- a/dmx_usb.c
+++ b/dmx_usb.c
-@@ -406,7 +406,7 @@ static ssize_t dmx_usb_write (struct file *file, const char *buffer, size_t coun
+@@ -406,7 +406,7 @@ static ssize_t dmx_usb_write (struct fil
dev = (struct dmx_usb_device *)file->private_data;
/* lock this object */
down (&dev->sem);
+@@ -500,7 +500,7 @@ static long dmx_usb_ioctl (struct file *
+ return -ENODEV;
+ }
+
+- dbg("%s - minor %d, cmd 0x%.4x, arg %ld", __FUNCTION__,
++ dbg("%s - minor %d, cmd 0x%.4x, arg %lu", __FUNCTION__,
+ dev->minor, cmd, arg);
+
+ /* fill in your device specific stuff here */
include $(TOPDIR)/rules.mk
PKG_NAME:=libedit
-PKG_VERSION:=20221030-3.1
+PKG_VERSION:=20230828-3.1
PKG_RELEASE:=1
PKG_MAINTAINER:=Daniel Salzman <daniel.salzman@nic.cz>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://thrysoee.dk/editline/
-PKG_HASH:=f0925a5adf4b1bf116ee19766b7daa766917aec198747943b1c4edf67a4be2bb
+PKG_HASH:=4ee8182b6e569290e7d1f44f0f78dac8716b35f656b76528f699c69c98814dad
PKG_INSTALL:=1
--- /dev/null
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libucontext
+PKG_VERSION:=1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/kaniini/libucontext/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=2657e087c493263e7bbbde152a5bc08ce22dc5a7970887ac4fd251b90b58401f
+
+PKG_MAINTAINER:=Volker Christian <me@vchrist.at>
+PKG_LICENSE:=ISC
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_FLAGS:=no-mips16
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/meson.mk
+
+define Package/libucontext
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=libucontext is a library which provides the ucontext.h C API
+ URL:=https://github.com/kaniini/libucontext
+ DEPENDS:=@USE_MUSL
+endef
+
+define Package/libucontext-tests
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=Test applications for libucontext
+ URL:=https://github.com/kaniini/libucontext
+ DEPENDS:=libucontext
+endef
+
+define Package/libucontext/description
+ Thie package is a development package aimed to be linked to
+ libraries/applications which need the SYS-V ucontext API.
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/libucontext $(1)/usr/include/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucontext* $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libucontext.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libucontext/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucontext*.so.* $(1)/usr/lib/
+endef
+
+define Package/libucontext-tests/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(MESON_BUILD_DIR)/test_libucontext_posix $(1)/usr/bin/
+ $(INSTALL_BIN) $(MESON_BUILD_DIR)/test_libucontext $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libucontext))
+$(eval $(call BuildPackage,libucontext-tests))
--- /dev/null
+--- a/arch/arm/swapcontext.S
++++ b/arch/arm/swapcontext.S
+@@ -17,10 +17,12 @@ ALIAS(__swapcontext, libucontext_swapcon
+
+ FUNC(libucontext_swapcontext)
+ /* copy all of the current registers into the ucontext structure */
+- add r2, r0, #REG_OFFSET(0)
+- stmia r2, {r0-r12}
+ str r13, [r0,#REG_OFFSET(13)]
+ str r14, [r0,#REG_OFFSET(15)]
++ add r2, r0, #REG_OFFSET(0)
++ /* copy r0 with value 0 to indicate success (return value 0) */
++ mov r0, #0
++ stmia r2, {r0-r12}
+
+ /* load new registers from the second ucontext structure */
+ add r14, r1, #REG_OFFSET(0)
--- /dev/null
+--- a/test_libucontext.c
++++ b/test_libucontext.c
+@@ -9,6 +9,9 @@
+ #include <string.h>
+ #include <libucontext/libucontext.h>
+
++#define handle_error(msg) \
++ do { perror(msg); exit(EXIT_FAILURE); } while (0)
++
+ static libucontext_ucontext_t ctx[3];
+
+
+@@ -36,7 +39,8 @@ static void f1 (int a, int b, int c, int
+ printf("looks like all arguments are passed correctly\n");
+
+ printf("swap back to f2\n");
+- libucontext_swapcontext(&ctx[1], &ctx[2]);
++ if (libucontext_swapcontext(&ctx[1], &ctx[2]) != 0)
++ handle_error("libucontext_swapcontext");
+ printf("finish f1\n");
+ }
+
+@@ -44,7 +48,8 @@ static void f1 (int a, int b, int c, int
+ static void f2 (void) {
+ printf("start f2\n");
+ printf("swap to f1\n");
+- libucontext_swapcontext(&ctx[2], &ctx[1]);
++ if (libucontext_swapcontext(&ctx[2], &ctx[1]) != 0)
++ handle_error("libucontext_swapcontext");
+ printf("finish f2, should swap to f1\n");
+ }
+
+@@ -63,7 +68,8 @@ int main (int argc, const char *argv[])
+ printf("setting up context 1\n");
+
+
+- libucontext_getcontext(&ctx[1]);
++ if (libucontext_getcontext(&ctx[1]) != 0)
++ handle_error("libucontext_getcontext");
+ ctx[1].uc_stack.ss_sp = st1;
+ ctx[1].uc_stack.ss_size = sizeof st1;
+ ctx[1].uc_link = &ctx[0];
+@@ -83,16 +89,20 @@ int main (int argc, const char *argv[])
+ printf("doing initial swapcontext\n");
+
+
+- libucontext_swapcontext(&ctx[0], &ctx[2]);
++ if (libucontext_swapcontext(&ctx[0], &ctx[2]) != 0)
++ handle_error("libucontext_swapcontext");
+
+
+ printf("returned from initial swapcontext\n");
+
+
+ /* test ability to use getcontext/setcontext without makecontext */
+- libucontext_getcontext(&ctx[1]);
++ if (libucontext_getcontext(&ctx[1]) != 0)
++ handle_error("libucontext_getcontext");
+ printf("done = %d\n", done);
+- if (done++ == 0) libucontext_setcontext(&ctx[1]);
++ if (done++ == 0)
++ if (libucontext_setcontext(&ctx[1]) != 0)
++ handle_error("libucontext_setcontext");
+ if (done != 2) {
+ fprintf(stderr, "wrong value for done. got %d, expected 2\n", done);
+ abort();
+--- a/test_libucontext_posix.c
++++ b/test_libucontext_posix.c
+@@ -9,6 +9,9 @@
+ #include <string.h>
+ #include <ucontext.h>
+
++#define handle_error(msg) \
++ do { perror(msg); exit(EXIT_FAILURE); } while (0)
++
+ static ucontext_t ctx[3];
+
+
+@@ -36,7 +39,8 @@ static void f1 (int a, int b, int c, int
+ printf("looks like all arguments are passed correctly\n");
+
+ printf("swap back to f2\n");
+- swapcontext(&ctx[1], &ctx[2]);
++ if (swapcontext(&ctx[1], &ctx[2]) != 0)
++ handle_error("swapcontext");
+ printf("finish f1\n");
+ }
+
+@@ -44,7 +48,8 @@ static void f1 (int a, int b, int c, int
+ static void f2 (void) {
+ printf("start f2\n");
+ printf("swap to f1\n");
+- swapcontext(&ctx[2], &ctx[1]);
++ if (swapcontext(&ctx[2], &ctx[1]) != 0)
++ handle_error("swapcontext");
+ printf("finish f2, should swap to f1\n");
+ }
+
+@@ -83,16 +88,19 @@ int main (int argc, const char *argv[])
+ printf("doing initial swapcontext\n");
+
+
+- swapcontext(&ctx[0], &ctx[2]);
+-
++ if (swapcontext(&ctx[0], &ctx[2]) != 0)
++ handle_error("swapcontext");
+
+ printf("returned from initial swapcontext\n");
+
+
+ /* test ability to use getcontext/setcontext without makecontext */
+- getcontext(&ctx[1]);
++ if (getcontext(&ctx[1]) != 0)
++ handle_error("getcontext");
+ printf("done = %d\n", done);
+- if (done++ == 0) setcontext(&ctx[1]);
++ if (done++ == 0)
++ if (setcontext(&ctx[1]) != 0)
++ handle_error("setcontext");
+ if (done != 2) {
+ fprintf(stderr, "wrong value for done. got %d, expected 2\n", done);
+ abort();
PKG_NAME:=slang
PKG_VERSION:=2.3.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://www.jedsoft.org/releases/slang \
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
PKG_BUILD_PARALLEL:=0
-PKG_CONFIG_DEPENDS:=CONFIG_BUILD_NLS
+PKG_CONFIG_DEPENDS:= \
+ CONFIG_BUILD_NLS \
+ CONFIG_PACKAGE_libslang2-mod-onig \
+ CONFIG_PACKAGE_libslang2-mod-png \
+ CONFIG_PACKAGE_libslang2-mod-zlib
-SLANG_MODULES:= base64 chksum csv fcntl fork histogram iconv json onig pcre \
+SLANG_MODULES:= base64 chksum csv fcntl fork histogram iconv json onig \
png rand select slsmg socket stats sysconf termios varray zlib
include $(INCLUDE_DIR)/package.mk
endef
define Package/libslang2/Default/description
- Multi-platform programmer's library providing facilities for interactive
- applications. Includes such things as display/screen management,
- keyboard input, keymaps, etc. Includes the embeddable S-Lang interpreter.
+Multi-platform programmer's library providing facilities for interactive
+applications. Includes such things as display/screen management,
+keyboard input, keymaps, etc. Includes the embeddable S-Lang
+interpreter.
endef
define Package/libslang2
define Package/libslang2-modules
$(call Package/libslang2/Default)
TITLE+= (all modules)
- DEPENDS:=$(foreach mod,$(SLANG_MODULES),+libslang2-mod-$(mod))
+ DEPENDS:=@PACKAGE_libslang2 $(foreach mod,$(SLANG_MODULES),+libslang2-mod-$(mod))
endef
define Package/libslang2-modules/description
$(call Package/libslang2/Default/description)
- This installs all of S-Lang's bundled modules.
+This package installs all of S-Lang's bundled modules.
endef
-define Package/libslang2-mod-iconv
+define Package/libslang2-mod/Default
$(call Package/libslang2/Default)
+ DEPENDS:=@PACKAGE_libslang2
+endef
+
+define Package/libslang2-mod-iconv
+$(call Package/libslang2-mod/Default)
TITLE+= (iconv module)
- DEPENDS:=$(ICONV_DEPENDS)
+ DEPENDS+=$(ICONV_DEPENDS)
endef
define Package/libslang2-mod-onig
-$(call Package/libslang2/Default)
+$(call Package/libslang2-mod/Default)
TITLE+= (onig module)
- DEPENDS:=+oniguruma
-endef
-
-define Package/libslang2-mod-pcre
-$(call Package/libslang2/Default)
- TITLE+= (pcre module)
- DEPENDS:=+libpcre
+ DEPENDS+=+PACKAGE_libslang2-mod-onig:oniguruma
endef
define Package/libslang2-mod-png
-$(call Package/libslang2/Default)
+$(call Package/libslang2-mod/Default)
TITLE+= (png module)
- DEPENDS:=+libpng
+ DEPENDS+=+PACKAGE_libslang2-mod-png:libpng
endef
define Package/libslang2-mod-zlib
-$(call Package/libslang2/Default)
+$(call Package/libslang2-mod/Default)
TITLE+= (zlib module)
- DEPENDS:=+zlib
+ DEPENDS+=+PACKAGE_libslang2-mod-zlib:zlib
endef
define Package/slsh
endef
define Package/slsh/description
- This is a shell which is mostly just a wrapper around the S-Lang Interpreter,
- which is part of the S-Lang Library.
+This is a shell which is mostly just a wrapper around the S-Lang
+Interpreter, which is part of the S-Lang Library.
endef
TARGET_CFLAGS+= $(FPIC)
CONFIGURE_ARGS+= \
--enable-largefile \
--enable-warnings \
- --with-terminfo=default \
--with-readline=slang \
- $(if $(CONFIG_BUILD_NLS),--with-iconv=$(ICONV_PREFIX)) \
- --with-onig="$(STAGING_DIR)/usr" \
- --with-pcre="$(STAGING_DIR)/usr" \
- --with-png="$(STAGING_DIR)/usr" \
- --with-z="$(STAGING_DIR)/usr" \
- --without-x
+ --with-terminfo=default \
+ --without-pcre \
+ --without-x \
+ $(if $(CONFIG_BUILD_NLS),--with-iconv="$(ICONV_PREFIX)",--without-iconv) \
+ $(if $(CONFIG_PACKAGE_libslang2-mod-onig),--with-onig="$(STAGING_DIR)/usr",--without-onig) \
+ $(if $(CONFIG_PACKAGE_libslang2-mod-png),--with-png="$(STAGING_DIR)/usr",--without-png) \
+ $(if $(CONFIG_PACKAGE_libslang2-mod-zlib),--with-z="$(STAGING_DIR)/usr",--without-z)
define Build/Compile
$(call Build/Compile/Default,)
define BuildModule
ifndef Package/libslang2-mod-$(1)
define Package/libslang2-mod-$(1)
- $$(call Package/libslang2/Default)
+ $$(call Package/libslang2-mod/Default)
TITLE+= ($(1) module)
endef
endif
define Package/libslang2-mod-$(1)/description
- $$(call Package/libslang2/Default/description)
+$$(call Package/libslang2/Default/description)
- This contains the $(1) module.
+This package contains the $(1) module.
endef
define Package/libslang2-mod-$(1)/install
--- /dev/null
+# Copyright 2023 Stan Grishin (stangri@melmac.ca)
+# TLD optimization written by Dirk Brenken (dev@brenken.org)
+# This is free software, licensed under the GNU General Public License v3.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=adblock-fast
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
+PKG_LICENSE:=GPL-3.0-or-later
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/adblock-fast
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=AdBlock Fast Service
+ URL:=https://docs.openwrt.melmac.net/adblock-fast/
+ DEPENDS:=+jshn +curl
+ CONFLICTS:=simple-adblock
+ PROVIDES:=simple-adblock
+ PKGARCH:=all
+endef
+
+define Package/adblock-fast/description
+Fast AdBlocking script to block ad or abuse/malware domains with DNSMASQ or Unbound.
+Script supports local/remote list of domains and hosts-files for both block-listing and allow-listing.
+Please see https://docs.openwrt.melmac.net/adblock-fast/ for more information.
+endef
+
+define Package/adblock-fast/conffiles
+/etc/config/adblock-fast
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/adblock-fast/install
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/etc/init.d/adblock-fast $(1)/etc/init.d/adblock-fast
+ $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/adblock-fast
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_CONF) ./files/etc/config/adblock-fast $(1)/etc/config/adblock-fast
+ $(INSTALL_DIR) $(1)/tmp
+ $(INSTALL_DATA) ./files/adblock-fast.config.update $(1)/tmp/adblock-fast.config.update
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_BIN) ./files/etc/uci-defaults/90-adblock-fast $(1)/etc/uci-defaults/90-adblock-fast
+endef
+
+define Package/adblock-fast/postinst
+ #!/bin/sh
+ # check if we are on real system
+ if [ -z "$${IPKG_INSTROOT}" ]; then
+ sed -f /tmp/adblock-fast.config.update -i /etc/config/adblock-fast || true
+ /etc/init.d/adblock-fast enable
+ fi
+ exit 0
+endef
+
+define Package/adblock-fast/prerm
+ #!/bin/sh
+ # check if we are on real system
+ if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo "Stopping service and removing rc.d symlink for adblock-fast"
+ /etc/init.d/adblock-fast stop || true
+ /etc/init.d/adblock-fast killcache || true
+ /etc/init.d/adblock-fast disable || true
+ fi
+ exit 0
+endef
+
+$(eval $(call BuildPackage,adblock-fast))
--- /dev/null
+# README
+
+README has been moved to [https://docs.openwrt.melmac.net/adblock-fast/](https://docs.openwrt.melmac.net/adblock-fast/).
--- /dev/null
+s|http://winhelp2002.mvps.org/hosts.txt|https://winhelp2002.mvps.org/hosts.txt|g
+s|list blocked_domains_url 'https://dbl.oisd.nl/basic'|list blocked_adblockplus_url 'https://small.oisd.nl/'|g
+s|list blocked_domains_url 'https://dbl.oisd.nl/nsfw'|list blocked_adblockplus_url 'https://nsfw.oisd.nl/'|g
+s|list blocked_domains_url 'https://dbl.oisd.nl/'|list blocked_adblockplus_url 'https://big.oisd.nl/'|g
+s|list blocked_hosts_url 'https://hosts.oisd.nl/basic'|list blocked_adblockplus_url 'https://small.oisd.nl/'|g
+s|list blocked_hosts_url 'https://hosts.oisd.nl/nsfw'|list blocked_adblockplus_url 'https://nsfw.oisd.nl/'|g
+s|list blocked_hosts_url 'https://hosts.oisd.nl/'|list blocked_adblockplus_url 'https://big.oisd.nl/'|g
+\|dshield.org|d
+\|www.malwaredomainlist.com/hostslist/hosts.txt|d
+\|https://mirror1.malwaredomains.com/files/justdomains|d
+\|lists.disconnect.me|d
+\|https://cdn.jsdelivr.net/gh/paulgb/BarbBlock/blacklists/domain-list.txt|d
+\|dnsmasq.oisd.nl|d
+\|dnsmasq2.oisd.nl|d
+\|https://cdn.jsdelivr.net/gh/AdguardTeam/cname-trackers@master/combined_disguised_trackers_justdomains.txt|d
--- /dev/null
+config adblock-fast 'config'
+ option enabled '0'
+ list allowed_domain 'cdn.jsdelivr.net'
+ option allow_non_ascii '0'
+ option canary_domains_icloud '0'
+ option canary_domains_mozilla '0'
+ option compressed_cache '0'
+ option compressed_cache_dir '/etc'
+ option config_update_enabled '0'
+ option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.conf.update'
+ option curl_additional_param ''
+ option curl_max_file_size '30000000'
+ option curl_retry '3'
+ option debug '0'
+ option dns 'dnsmasq.servers'
+ option dnsmasq_instance '*'
+# option dnsmasq_config_file_url 'https://big.oisd.nl/dnsmasq2'
+ option download_timeout '10'
+ option force_dns '1'
+ list force_dns_port '53'
+ list force_dns_port '853'
+# ports listed below are used by some
+# of the dnscrypt-proxy v1 resolvers
+# list force_dns_port '553'
+# list force_dns_port '1443'
+# list force_dns_port '4343'
+# list force_dns_port '4434'
+# list force_dns_port '5443'
+# list force_dns_port '8443'
+ option led 'none'
+ option parallel_downloads '1'
+ option procd_trigger_wan6 '0'
+ option procd_boot_wan_timeout '60'
+ option verbosity '2'
+
+config file_url
+ option url 'https://cdn.jsdelivr.net/gh/StevenBlack/hosts/hosts'
+ option size '6770929'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_trackers_justdomains.txt'
+ option size '6241707'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://big.oisd.nl/'
+ option size '6163363'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://cdn.jsdelivr.net/gh/bongochong/CombinedPrivacyBlockLists/NoFormatting/cpbl-ctld.txt'
+ option size '2608152'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'http://sysctl.org/cameleon/hosts'
+ option size '638545'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://cdn.jsdelivr.net/gh/kboghdady/youTube_ads_4_pi-hole/black.list'
+ option size '553006'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_clickthroughs_justdomains.txt'
+ option size '362170'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://someonewhocares.org/hosts/hosts'
+ option size '347410'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://winhelp2002.mvps.org/hosts.txt'
+ option size '334861'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://adaway.org/hosts.txt'
+ option size '243454'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_ads_justdomains.txt'
+ option size '222595'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_microsites_justdomains.txt'
+ option size '123275'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'
+ option size '99588'
+ option action 'block'
+ option enabled '0'
+
+config file_url
+ option url 'https://cdn.jsdelivr.net/gh/hoshsadiq/adblock-nocoin-list/hosts.txt'
+ option size '11149'
+ option action 'block'
+ option enabled '0'
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright 2023 MOSSDeF, Stan Grishin (stangri@melmac.ca)
+# shellcheck disable=SC1091,SC2015,SC2016,SC3037,SC3043,SC3045,SC3057,SC3060
+
+# shellcheck disable=SC2034
+START=94
+# shellcheck disable=SC2034
+USE_PROCD=1
+LC_ALL=C
+
+if type extra_command 1>/dev/null 2>&1; then
+ extra_command 'allow' 'Allows domain in current block-list and config'
+ extra_command 'check' 'Checks if specified domain is found in current block-list'
+ extra_command 'dl' 'Force-downloads all enabled block-list'
+ extra_command 'killcache' 'Delete all cached files'
+ extra_command 'pause' 'Pauses AdBlocking for specified number of seconds (default: 60)'
+ extra_command 'sizes' 'Displays the file-sizes of enabled block-lists'
+ extra_command 'version' 'Show version information'
+else
+# shellcheck disable=SC2034
+ EXTRA_COMMANDS='allow check dl killcache pause sizes status_service version'
+# shellcheck disable=SC2034
+ EXTRA_HELP=' allow Allows domain(s) in current block-list and config
+ check Checks if specified domain is found in current block-list
+ dl Force-downloads all enabled block-list
+ pause Pauses AdBlocking for specified number of seconds (default: 60)
+ sizes Displays the file-sizes of enabled block-lists'
+fi
+
+readonly PKG_VERSION='dev-test'
+readonly packageName='adblock-fast'
+readonly serviceName="$packageName $PKG_VERSION"
+readonly packageConfigFile="/etc/config/${packageName}"
+readonly dnsmasqAddnhostsFile="/var/run/${packageName}/dnsmasq.addnhosts"
+readonly dnsmasqAddnhostsCache="/var/run/${packageName}/dnsmasq.addnhosts.cache"
+readonly dnsmasqAddnhostsGzip="${packageName}.dnsmasq.addnhosts.gz"
+readonly dnsmasqAddnhostsFilter='s|^|127.0.0.1 |;s|$||'
+readonly dnsmasqAddnhostsFilterIPv6='s|^|:: |;s|$||'
+readonly dnsmasqConfFile="/tmp/dnsmasq.d/${packageName}"
+readonly dnsmasqConfCache="/var/run/${packageName}/dnsmasq.conf.cache"
+readonly dnsmasqConfGzip="${packageName}.dnsmasq.conf.gz"
+readonly dnsmasqConfFilter='s|^|local=/|;s|$|/|'
+readonly dnsmasqIpsetFile="/tmp/dnsmasq.d/${packageName}.ipset"
+readonly dnsmasqIpsetCache="/var/run/${packageName}/dnsmasq.ipset.cache"
+readonly dnsmasqIpsetGzip="${packageName}.dnsmasq.ipset.gz"
+readonly dnsmasqIpsetFilter='s|^|ipset=/|;s|$|/adb|'
+readonly dnsmasqNftsetFile="/tmp/dnsmasq.d/${packageName}.nftset"
+readonly dnsmasqNftsetCache="/var/run/${packageName}/dnsmasq.nftset.cache"
+readonly dnsmasqNftsetGzip="${packageName}.dnsmasq.nftset.gz"
+readonly dnsmasqNftsetFilter='s|^|nftset=/|;s|$|/4#inet#fw4#adb4|'
+readonly dnsmasqNftsetFilterIPv6='s|^|nftset=/|;s|$|/4#inet#fw4#adb4,6#inet#fw4#adb6|'
+readonly dnsmasqServersFile="/var/run/${packageName}/dnsmasq.servers"
+readonly dnsmasqServersCache="/var/run/${packageName}/dnsmasq.servers.cache"
+readonly dnsmasqServersGzip="${packageName}.dnsmasq.servers.gz"
+readonly dnsmasqServersFilter='s|^|server=/|;s|$|/|'
+readonly unboundFile="/var/lib/unbound/adb_list.${packageName}"
+readonly unboundCache="/var/run/${packageName}/unbound.cache"
+readonly unboundGzip="${packageName}.unbound.gz"
+readonly unboundFilter='s|^|local-zone: "|;s|$|" static|'
+readonly A_TMP="/var/${packageName}.hosts.a.tmp"
+readonly B_TMP="/var/${packageName}.hosts.b.tmp"
+readonly jsonFile="/dev/shm/$packageName-status.json"
+readonly sharedMemoryError="/dev/shm/$packageName-error"
+readonly hostsFilter='/localhost/d;/^#/d;/^[^0-9]/d;s/^0\.0\.0\.0.//;s/^127\.0\.0\.1.//;s/[[:space:]]*#.*$//;s/[[:cntrl:]]$//;s/[[:space:]]//g;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;/[^[:alnum:]_.-]/d;'
+readonly domainsFilter='/^#/d;s/[[:space:]]*#.*$//;s/[[:space:]]*$//;s/[[:cntrl:]]$//;/[[:space:]]/d;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;/[^[:alnum:]_.-]/d;'
+readonly adBlockPlusFilter='/^#/d;/^!/d;s/[[:space:]]*#.*$//;s/^||//;s/\^$//;s/[[:space:]]*$//;s/[[:cntrl:]]$//;/[[:space:]]/d;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;/[^[:alnum:]_.-]/d;'
+readonly dnsmasqFileFilter='\|^server=/[[:alnum:]_.-].*/|!d'
+readonly dnsmasq2FileFilter='\|^local=/[[:alnum:]_.-].*/|!d'
+readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
+readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
+readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
+readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
+readonly _ERROR_='\033[0;31mERROR\033[0m'
+readonly _WARNING_='\033[0;33mWARNING\033[0m'
+# shellcheck disable=SC2155
+readonly ipset="$(command -v ipset)"
+# shellcheck disable=SC2155
+readonly nft="$(command -v nft)"
+readonly canaryDomainsMozilla='use-application-dns.net'
+readonly canaryDomainsiCloud='mask.icloud.com mask-h2.icloud.com'
+
+dl_command=
+dl_flag=
+isSSLSupported=
+outputFilter=
+outputFilterIPv6=
+outputFile=
+outputGzip=
+outputCache=
+awk='awk'
+load_environment_flag=
+allowed_url=
+blocked_url=
+
+debug() { local i j; for i in "$@"; do eval "j=\$$i"; echo "${i}: ${j} "; done; }
+
+uci_add_list_if_new() {
+ local PACKAGE="$1"
+ local CONFIG="$2"
+ local OPTION="$3"
+ local VALUE="$4"
+ local i
+ [ -n "$PACKAGE" ] && [ -n "$CONFIG" ] && [ -n "$OPTION" ] && [ -n "$VALUE" ] || return 1
+ for i in $(uci_get "$PACKAGE" "$CONFIG" "$OPTION"); do
+ [ "$i" = "$VALUE" ] && return 0
+ done
+ uci_add_list "$PACKAGE" "$CONFIG" "$OPTION" "$VALUE"
+}
+uci_changes() {
+ local PACKAGE="$1"
+ local CONFIG="$2"
+ local OPTION="$3"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
+}
+
+ipset() { "$ipset" "$@" >/dev/null 2>&1; }
+nft() { "$nft" "$@" >/dev/null 2>&1; }
+
+get_text() {
+ local r
+ case "$1" in
+ errorConfigValidationFail) r="$packageName config validation failed";;
+ errorServiceDisabled) r="$packageName is currently disabled";;
+ errorNoDnsmasqIpset)
+ r="dnsmasq ipset support is enabled in $packageName, but dnsmasq is either not installed or installed dnsmasq does not support ipset";;
+ errorNoIpset)
+ r="dnsmasq ipset support is enabled in $packageName, but ipset is either not installed or installed ipset does not support 'hash:net' type";;
+ errorNoDnsmasqNftset)
+ r="dnsmasq nft set support is enabled in $packageName, but dnsmasq is either not installed or installed dnsmasq does not support nft set";;
+ errorNoNft) r="dnsmasq nft sets support is enabled in $packageName, but nft is not installed";;
+ errorNoWanGateway) r="The ${serviceName} failed to discover WAN gateway";;
+ errorOutputDirCreate) r="failed to create directory for %s file";;
+ errorOutputFileCreate) r="failed to create $outputFile file";;
+ errorFailDNSReload) r="failed to restart/reload DNS resolver";;
+ errorSharedMemory) r="failed to access shared memory";;
+ errorSorting) r="failed to sort data file";;
+ errorOptimization) r="failed to optimize data file";;
+ errorAllowListProcessing) r="failed to process allow-list";;
+ errorDataFileFormatting) r="failed to format data file";;
+ errorMovingDataFile) r="failed to move data file '${A_TMP}' to '${outputFile}'";;
+ errorCreatingCompressedCache) r="failed to create compressed cache";;
+ errorRemovingTempFiles) r="failed to remove temporary files";;
+ errorRestoreCompressedCache) r="failed to unpack compressed cache";;
+ errorRestoreCache) r="failed to move '$outputCache' to '$outputFile'";;
+ errorOhSnap) r="failed to create block-list or restart DNS resolver";;
+ errorStopping) r="failed to stop $serviceName";;
+ errorDNSReload) r="failed to reload/restart DNS resolver";;
+ errorDownloadingConfigUpdate) r="failed to download Config Update file";;
+ errorDownloadingList) r="failed to download";;
+ errorParsingConfigUpdate) r="failed to parse Config Update file";;
+ errorParsingList) r="failed to parse";;
+ errorNoSSLSupport) r="no HTTPS/SSL support on device";;
+ errorCreatingDirectory) r="failed to create output/cache/gzip file directory";;
+
+ statusNoInstall) r="$serviceName is not installed or not found";;
+ statusStopped) r="Stopped";;
+ statusStarting) r="Starting";;
+ statusRestarting) r="Restarting";;
+ statusForceReloading) r="Force Reloading";;
+ statusDownloading) r="Downloading";;
+ statusProcessing) r="Processing";;
+ statusError) r="Error";;
+ statusWarning) r="Warning";;
+ statusFail) r="Fail";;
+ statusSuccess) r="Success";;
+
+ warningExternalDnsmasqConfig)
+ r="use of external dnsmasq config file detected, please set 'dns' option to 'dnsmasq.conf'";;
+ warningMissingRecommendedPackages) r="Some recommended packages are missing";;
+ warningInvalidCompressedCacheDir) r="invalid compressed cache directory '%s'";;
+ esac
+ echo "$r"
+}
+
+output_ok() { output 1 "$_OK_"; output 2 "$__OK__\\n"; }
+output_okn() { output 1 "$_OK_\\n"; output 2 "$__OK__\\n"; }
+output_fail() { output 1 "$_FAIL_"; output 2 "$__FAIL__\\n"; }
+output_failn() { output 1 "$_FAIL_\\n"; output 2 "$__FAIL__\\n"; }
+str_replace() { printf "%b" "$1" | sed -e "s/$(printf "%b" "$2")/$(printf "%b" "$3")/g"; }
+str_contains() { test "$1" != "$(str_replace "$1" "$2" '')"; }
+is_greater() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
+is_greater_or_equal() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$2"; }
+is_chaos_calmer() { ubus -S call system board | grep -q 'Chaos Calmer'; }
+led_on(){ if [ -n "${1}" ] && [ -e "${1}/trigger" ]; then echo 'default-on' > "${1}/trigger" 2>&1; fi; }
+led_off(){ if [ -n "${1}" ] && [ -e "${1}/trigger" ]; then echo 'none' > "${1}/trigger" 2>&1; fi; }
+dnsmasq_hup() { killall -q -s HUP dnsmasq; }
+dnsmasq_kill() { killall -q -s KILL dnsmasq; }
+dnsmasq_restart() { /etc/init.d/dnsmasq restart >/dev/null 2>&1; }
+unbound_restart() { /etc/init.d/unbound restart >/dev/null 2>&1; }
+is_present() { command -v "$1" >/dev/null 2>&1; }
+sanitize_dir() { [ -d "$(readlink -fn "$1")" ] && readlink -fn "$1"; }
+
+output() {
+# Can take a single parameter (text) to be output at any verbosity
+# Or target verbosity level and text to be output at specifc verbosity
+ local msg memmsg logmsg
+ local sharedMemoryOutput="/dev/shm/$packageName-output"
+ verbosity="${verbosity:-2}"
+ if [ $# -ne 1 ]; then
+ if [ $((verbosity & $1)) -gt 0 ] || [ "$verbosity" = "$1" ]; then shift; else return 0; fi
+ fi
+ [ -t 1 ] && printf "%b" "$1"
+ msg="${1//$serviceName /service }";
+ if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
+ [ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
+ logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
+ logger -t "${packageName:-service} [$$]" "$(printf "%b" "$logmsg")"
+ rm -f "$sharedMemoryOutput"
+ else
+ printf "%b" "$msg" >> "$sharedMemoryOutput"
+ fi
+}
+
+load_network() {
+ local param="$1"
+ local i j wan_if wan_gw wan_proto
+ local counter wan_if_timeout="$procd_boot_wan_timeout" wan_gw_timeout='5'
+ counter=0
+ while [ -z "$wan_if" ]; do
+ network_flush_cache
+ network_find_wan wan_if
+ if [ -n "$wan_if" ]; then
+ output "WAN interface found: '${wan_if}'.\\n"
+ break
+ fi
+ if [ "$counter" -gt "$wan_if_timeout" ]; then
+ output "WAN interface timeout, assuming 'wan'.\\n"
+ wan_if='wan'
+ break
+ fi
+ counter=$((counter+1))
+ output "Waiting to discover WAN Interface...\\n"
+ sleep 1
+ done
+
+ counter=0
+ wan_proto="$(uci -q get "network.${wan_if}.proto")"
+ if [ "$wan_proto" = 'pppoe' ]; then
+ wan_gw_timeout=$((wan_gw_timeout+10))
+ fi
+ while [ "$counter" -le "$wan_gw_timeout" ]; do
+ network_flush_cache
+ network_get_gateway wan_gw "$wan_if"
+ if [ -n "$wan_gw" ]; then
+ output "WAN gateway found: '${wan_gw}.'\\n"
+ return 0
+ fi
+ counter=$((counter+1))
+ output "Waiting to discover $wan_if gateway...\\n"
+ sleep 1
+ done
+ json add error "errorNoWanGateway"
+ output "${_ERROR_}: $(get_text 'errorNoWanGateway')!\\n"; return 1;
+}
+
+append_url() {
+ local cfg="$1" var="$2"
+ local en action url
+ config_get en "$cfg" enabled '1'
+ config_get action "$cfg" action 'block'
+ config_get url "$cfg" url
+ if [ "$en" = '1' ]; then
+ if [ "$action" = 'allow' ]; then
+ allowed_url="${allowed_url:+$allowed_url }${url}"
+ else
+ blocked_url="${blocked_url:+$blocked_url }${url}"
+ fi
+ fi
+}
+
+detect_file_type() {
+ local file="$1"
+ if [ "$(head -1 "$file")" = '[Adblock Plus]' ]; then
+ echo 'adBlockPlus'
+ elif grep -q '^server=' "$file"; then
+ echo 'dnsmasqFile'
+ elif grep -q '^local=' "$file"; then
+ echo 'dnsmasq2File'
+ elif grep -q '^0.0.0.0' "$file" || grep -q '^127.0.0.1' "$file"; then
+ echo 'hosts'
+ else
+ echo 'domains'
+ fi
+}
+
+load_environment() {
+ local i j
+ local validation_result="$1" param="$2"
+
+ [ -z "$load_environment_flag" ] || return 0
+
+ if [ "$validation_result" != '0' ]; then
+ json add error "errorConfigValidationFail"
+ output "${_ERROR_}: $(get_text 'errorConfigValidationFail')!\\n"
+ output "Please check if the '$packageConfigFile' contains correct values for config options.\\n"
+ return 1
+ fi
+
+ if [ "$enabled" -eq 0 ]; then
+ json add error "errorServiceDisabled"
+ output "${_ERROR_}: $(get_text 'errorServiceDisabled')!\\n"
+ output "Run the following commands before starting service again:\\n"
+ output "uci set ${packageName}.config.enabled='1'; uci commit $packageName;\\n"
+ return 1
+ fi
+
+ if [ "$debug" -ne 0 ]; then
+ exec 1>>"/tmp/$packageName.log"
+ exec 2>&1
+ set -x
+ fi
+
+ if [ -n "$dnsmasq_config_file_url" ]; then
+ case "$dns" in
+ dnsmasq.conf) :;;
+ *)
+ if [ "$param" != 'quiet' ]; then
+ json add warning "warningExternalDnsmasqConfig"
+ output "${_WARNING_}: $(get_text 'warningExternalDnsmasqConfig')!\\n"
+ fi
+ ;;
+ esac
+ fi
+
+ case "$dns" in
+ dnsmasq.addnhosts|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|dnsmasq.servers)
+ if dnsmasq -v 2>/dev/null | grep -q 'no-IDN' || ! dnsmasq -v 2>/dev/null | grep -q -w 'IDN'; then
+ allow_non_ascii=0
+ fi
+ ;;
+ unbound.adb_list)
+ allow_non_ascii=1;;
+ esac
+
+ case "$dns" in
+ dnsmasq.ipset)
+ if dnsmasq -v 2>/dev/null | grep -q 'no-ipset' || ! dnsmasq -v 2>/dev/null | grep -q -w 'ipset'; then
+ if [ "$param" != 'quiet' ]; then
+ json add error "errorNoDnsmasqIpset"
+ output "${_ERROR_}: $(get_text 'errorNoDnsmasqIpset')!\\n"
+ fi
+ dns='dnsmasq.servers'
+ fi
+ if ! ipset help hash:net; then
+ if [ "$param" != 'quiet' ]; then
+ json add error "errorNoIpset"
+ output "${_ERROR_}: $(get_text 'errorNoIpset')!\\n"
+ fi
+ dns='dnsmasq.servers'
+ fi
+ ;;
+ dnsmasq.nftset)
+ if dnsmasq -v 2>/dev/null | grep -q 'no-nftset' || ! dnsmasq -v 2>/dev/null | grep -q -w 'nftset'; then
+ if [ "$param" != 'quiet' ]; then
+ json add error "errorNoDnsmasqNftset"
+ output "${_ERROR_}: $(get_text 'errorNoDnsmasqNftset')!\\n"
+ fi
+ dns='dnsmasq.servers'
+ fi
+ if [ -z "$nft" ]; then
+ if [ "$param" != 'quiet' ]; then
+ json add error "errorNoNft"
+ output "${_ERROR_}: $(get_text 'errorNoNft')!\\n"
+ fi
+ dns='dnsmasq.servers'
+ fi
+ ;;
+ esac
+
+ if [ "$(sanitize_dir "$compressed_cache_dir")" = '/' ]; then
+ compressed_cache_dir=''
+ elif [ -n "$(sanitize_dir "$compressed_cache_dir")" ]; then
+ compressed_cache_dir="$(sanitize_dir "$compressed_cache_dir")"
+ else
+ json add warning 'warningInvalidCompressedCacheDir' "$compressed_cache_dir"
+ compressed_cache_dir="/etc"
+ fi
+
+ case "$dns" in
+ dnsmasq.addnhosts)
+ outputFilter="$dnsmasqAddnhostsFilter"
+ outputFile="$dnsmasqAddnhostsFile"
+ outputCache="$dnsmasqAddnhostsCache"
+ outputGzip="${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ if [ "$ipv6_enabled" -ne 0 ]; then
+ outputFilterIPv6="$dnsmasqAddnhostsFilterIPv6"
+ fi
+ rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
+ rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
+ ;;
+ dnsmasq.conf)
+ outputFilter="$dnsmasqConfFilter"
+ outputFile="$dnsmasqConfFile"
+ outputCache="$dnsmasqConfCache"
+ outputGzip="${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
+ rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
+ ;;
+ dnsmasq.ipset)
+ outputFilter="$dnsmasqIpsetFilter"
+ outputFile="$dnsmasqIpsetFile"
+ outputCache="$dnsmasqIpsetCache"
+ outputGzip="${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
+ rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
+ ;;
+ dnsmasq.nftset)
+ if [ "$ipv6_enabled" -ne 0 ]; then
+ outputFilter="$dnsmasqNftsetFilterIPv6"
+ else
+ outputFilter="$dnsmasqNftsetFilter"
+ fi
+ outputFile="$dnsmasqNftsetFile"
+ outputCache="$dnsmasqNftsetCache"
+ outputGzip="${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
+ rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
+ ;;
+ dnsmasq.servers)
+ outputFilter="$dnsmasqServersFilter"
+ outputFile="$dnsmasqServersFile"
+ outputCache="$dnsmasqServersCache"
+ outputGzip="${compressed_cache_dir}/${dnsmasqServersGzip}"
+ rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
+ ;;
+ unbound.adb_list)
+ outputFilter="$unboundFilter"
+ outputFile="$unboundFile"
+ outputCache="$unboundCache"
+ outputGzip="$unboundGzip"
+ rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
+ ;;
+ esac
+
+ for i in "$jsonFile" "$outputFile" "$outputCache" "$outputGzip"; do
+ if ! mkdir -p "$(dirname "$i")"; then
+ if [ "$param" != 'quiet' ]; then
+ json add error "errorOutputDirCreate" "$i"
+ output "${_ERROR_}: $(get_text 'errorOutputDirCreate' "$i")!\\n"
+ fi
+ fi
+ done
+
+ is_present 'gawk' && awk='gawk'
+ if ! is_present '/usr/libexec/grep-gnu' || ! is_present '/usr/libexec/sed-gnu' || \
+ ! is_present '/usr/libexec/sort-coreutils' || ! is_present 'gawk'; then
+ local s="opkg update; opkg --force-overwrite install"
+ is_present 'gawk' || s="$s gawk"
+ is_present '/usr/libexec/grep-gnu' || s="$s grep"
+ is_present '/usr/libexec/sed-gnu' || s="$s sed"
+ is_present '/usr/libexec/sort-coreutils' || s="$s coreutils-sort"
+ if [ "$param" != 'quiet' ]; then
+ json add warning "warningMissingRecommendedPackages" "${i}"
+ output "${_WARNING_}: $(get_text 'warningMissingRecommendedPackages'), install them by running:\\n"
+ output "$s;\\n"
+ fi
+ fi
+ # Prefer curl because it supports the file:// scheme.
+ if is_present 'curl'; then
+ dl_command='curl --silent --insecure'
+ dl_command="${dl_command}${curl_additional_param:+ $curl_additional_param}"
+ dl_command="${dl_command}${curl_max_file_size:+ --max-filesize $curl_max_file_size}"
+ dl_command="${dl_command}${curl_retry:+ --retry $curl_retry}"
+ dl_command="${dl_command}${download_timeout:+ --connect-timeout $download_timeout}"
+ dl_flag='-o'
+ elif is_present '/usr/libexec/wget-ssl'; then
+ dl_command='/usr/libexec/wget-ssl --no-check-certificate -q'
+ dl_command="${dl_command}${download_timeout:+ --timeout $download_timeout}"
+ dl_flag="-O"
+ size_command='/usr/libexec/wget-ssl --no-check-certificate -q -O /dev/null --server-response'
+ size_command="${size_command}${download_timeout:+ --timeout $download_timeout}"
+ elif is_present wget && wget --version 2>/dev/null | grep -q "+https"; then
+ dl_command="wget --no-check-certificate -q"
+ dl_command="${dl_command}${download_timeout:+ --timeout $download_timeout}"
+ dl_flag="-O"
+ size_command='wget --no-check-certificate -q -O /dev/null --server-response'
+ size_command="${size_command}${download_timeout:+ --timeout $download_timeout}"
+ else
+ dl_command="uclient-fetch --no-check-certificate -q"
+ dl_command="${dl_command}${download_timeout:+ --timeout $download_timeout}"
+ dl_flag="-O"
+ fi
+ led="${led:+/sys/class/leds/$led}"
+ if curl --version 2>/dev/null | grep -q "https" \
+ || wget --version 2>/dev/null | grep -q "+https" \
+ || grep -q "libustream-mbedtls" /usr/lib/opkg/status \
+ || grep -q "libustream-openssl" /usr/lib/opkg/status \
+ || grep -q "libustream-wolfssl" /usr/lib/opkg/status; then
+ isSSLSupported=1
+ else
+ unset isSSLSupported
+ fi
+ config_load "$packageName"
+ config_foreach append_url 'file_url'
+ load_environment_flag=1
+ cache 'test' && return 0
+ cache 'test_gzip' && return 0
+ if [ "$param" = 'on_boot' ]; then
+ load_network "$param"
+ return "$?"
+ else
+ return 0
+ fi
+}
+
+get_url_filesize() {
+ local url="$1" size size_command
+ [ -n "$url" ] || return 0
+ is_present 'curl' || return 0
+ size_command='curl --silent --insecure --fail --head --request GET'
+ size="$($size_command "$url" | grep -Po '^[cC]ontent-[lL]ength: \K\w+')"
+ echo -en "$size"
+}
+
+get_local_filesize() {
+ local file="$1" size
+ [ -f "$file" ] || return 0
+ if is_present stat; then
+ size="$(stat -c%s "$file")"
+ elif is_present wc; then
+ size="$(wc -c < "$file")"
+ fi
+ echo -en "$size"
+}
+
+resolver() {
+ local cfg="$1" param="$2"
+ case "$param" in
+ dnsmasq.addnhosts)
+ if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then
+ uci_remove 'dhcp' "$cfg" 'serversfile'
+ fi
+ uci_add_list_if_new 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile"
+ ;;
+ cleanup|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|unbound.adb_list)
+ uci_remove_list 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile"
+ if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then
+ uci_remove 'dhcp' "$cfg" 'serversfile'
+ fi
+ ;;
+ dnsmasq.servers)
+ uci_remove_list 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile"
+ if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" != "$dnsmasqServersFile" ]; then
+ uci_set 'dhcp' "$cfg" 'serversfile' "$dnsmasqServersFile"
+ fi
+ ;;
+ esac
+}
+
+dns() {
+ local param output_text i
+ case $1 in
+ on_start)
+ if [ ! -s "$outputFile" ]; then
+ json set status "statusFail"
+ json add error "errorOutputFileCreate"
+ output "${_ERROR_}: $(get_text 'errorOutputFileCreate')!\\n"
+ return 1
+ fi
+
+ config_load 'dhcp'
+ if [ "$dnsmasq_instance" = "*" ]; then
+ config_foreach resolver 'dnsmasq' "$dns"
+ elif [ -n "$dnsmasq_instance" ]; then
+ for i in $dnsmasq_instance; do
+ resolver "@dnsmasq[$i]" "$dns" || resolver "$i" "$dns"
+ done
+ fi
+
+ case "$dns" in
+ dnsmasq.addnhosts|dnsmasq.servers)
+ chmod 660 "$outputFile"
+ chown root:dnsmasq "$outputFile"
+ param=dnsmasq_restart
+ output_text='Reloading dnsmasq'
+ ;;
+ dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset)
+ chmod 660 "$outputFile"
+ chown root:dnsmasq "$outputFile"
+ param=dnsmasq_restart
+ output_text='Restarting dnsmasq'
+ ;;
+ unbound.adb_list)
+ param=unbound_restart
+ output_text='Restarting Unbound'
+ ;;
+ esac
+
+ if [ -n "$(uci_changes dhcp)" ]; then
+ uci_commit dhcp
+ if [ "$param" = 'unbound_restart' ]; then
+ param='dnsmasq_restart; unbound_restart;'
+ output_text='Restarting Unbound/dnsmasq'
+ else
+ param=dnsmasq_restart
+ output_text='Restarting dnsmasq'
+ fi
+ fi
+ output 1 "$output_text "
+ output 2 "$output_text "
+ json set message "$output_text"
+ if eval "$param"; then
+ json set status "statusSuccess"
+ led_on "$led"
+ output_okn
+ else
+ output_fail
+ json set status "statusFail"
+ json add error "errorDNSReload"
+ output "${_ERROR_}: $(get_text 'errorDNSReload')!\\n"
+ return 1
+ fi
+ ;;
+ on_stop)
+ case "$dns" in
+ dnsmasq.addnhosts|dnsmasq.servers)
+ param=dnsmasq_restart
+ ;;
+ dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset)
+ param=dnsmasq_restart
+ ;;
+ unbound.adb_list)
+ param=unbound_restart
+ ;;
+ esac
+ if [ -n "$(uci_changes dhcp)" ]; then
+ uci_commit dhcp
+ if [ "$param" = 'unbound_restart' ]; then
+ param='dnsmasq_restart; unbound_restart;'
+ else
+ param=dnsmasq_restart
+ fi
+ fi
+ eval "$param"
+ return $?
+ ;;
+ quiet)
+ case "$dns" in
+ dnsmasq.addnhosts|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|dnsmasq.servers)
+ param=dnsmasq_restart
+ ;;
+ unbound.adb_list)
+ param=unbound_restart
+ ;;
+ esac
+ eval "$param"
+ return $?
+ ;;
+ esac
+}
+
+json() {
+# shellcheck disable=SC2034
+ local action="$1" param="$2" value="$3"
+ shift 3
+# shellcheck disable=SC2124
+ local extras="$@" line
+ local status message error stats
+ local reload restart curReload curRestart ret i
+ if [ -s "$jsonFile" ]; then
+ json_load_file "$jsonFile" 2>/dev/null
+ json_select 'data' 2>/dev/null
+ for i in status message error stats reload restart; do
+ json_get_var "$i" "$i" 2>/dev/null
+ done
+ fi
+ case "$action" in
+ get)
+ case "$param" in
+ triggers)
+ curReload="$parallel_downloads $debug $download_timeout \
+ $allowed_domain $blocked_domain $allowed_url $blocked_url $dns \
+ $config_update_enabled $config_update_url $dnsmasq_config_file_url \
+ $curl_additional_param $curl_max_file_size $curl_retry"
+ curRestart="$compressed_cache $compressed_cache_dir $force_dns $led \
+ $force_dns_port"
+ if [ ! -s "$jsonFile" ]; then
+ ret='on_boot'
+ elif [ "$curReload" != "$reload" ]; then
+ ret='download'
+ elif [ "$curRestart" != "$restart" ]; then
+ ret='restart'
+ fi
+ printf "%b" "$ret"
+ return;;
+ *)
+ printf "%b" "$(eval echo "\$$param")"; return;;
+ esac
+ ;;
+ add)
+ line="$(eval echo "\$$param")"
+ eval "$param"='${line:+$line }${value}${extras:+|$extras}'
+ ;;
+ del)
+ case "$param" in
+ all)
+ unset status message error stats;;
+ triggers)
+ unset reload restart;;
+ *)
+ unset "$param";;
+ esac
+ ;;
+ set)
+ case "$param" in
+ triggers)
+ reload="$parallel_downloads $debug $download_timeout \
+ $allowed_domain $blocked_domain $allowed_url $blocked_url $dns \
+ $config_update_enabled $config_update_url $dnsmasq_config_file_url \
+ $curl_additional_param $curl_max_file_size $curl_retry"
+ restart="$compressed_cache $compressed_cache_dir $force_dns $led \
+ $force_dns_port"
+ ;;
+ *)
+ eval "$param"='${value}${extras:+|$extras}';;
+ esac
+ ;;
+ esac
+ json_init
+ json_add_object 'data'
+ json_add_string version "$PKG_VERSION"
+ json_add_string status "$status"
+ json_add_string message "$message"
+ json_add_string error "$error"
+ json_add_string stats "$stats"
+ json_add_string reload "$reload"
+ json_add_string restart "$restart"
+ json_close_object
+ mkdir -p "$(dirname "$jsonFile")"
+ json_dump > "$jsonFile"
+ sync
+}
+
+cache() {
+ local R_TMP
+ case "$1" in
+ create|backup)
+ [ -s "$outputFile" ] && { mv -f "$outputFile" "$outputCache"; } >/dev/null 2>/dev/null
+ return $?
+ ;;
+ restore|use)
+ [ -s "$outputCache" ] && mv "$outputCache" "$outputFile" >/dev/null 2>/dev/null
+ return $?
+ ;;
+ test)
+ [ -s "$outputCache" ]
+ return $?
+ ;;
+ test_gzip)
+ [ -s "$outputGzip" ] && gzip -t -c "$outputGzip"
+ return $?
+ ;;
+ create_gzip)
+ rm -f "$outputGzip" >/dev/null 2>/dev/null
+ R_TMP="$(mktemp -u -q -t ${packageName}_tmp.XXXXXXXX)"
+ if gzip < "$outputFile" > "$R_TMP"; then
+ if mv "$R_TMP" "$outputGzip"; then
+ rm -f "$R_TMP"
+ return 0
+ else
+ rm -f "$R_TMP"
+ return 1
+ fi
+ else
+ return 1
+ fi
+ ;;
+ expand|unpack|unpack_gzip)
+ [ -s "$outputGzip" ] && gzip -dc < "$outputGzip" > "$outputCache"
+ return $?
+ ;;
+ esac
+}
+
+_process_file_url() {
+ if [ "$2" != '0' ]; then
+ json add error "errorConfigValidationFail"
+ output "${_ERROR_}: $(get_text 'errorConfigValidationFail')!\\n"
+ output "Please check if the '$packageConfigFile' contains correct values for config options.\\n"
+ fi
+ if [ "$parallel_downloads" -gt 0 ]; then
+ process_file_url "$1" &
+ else
+ process_file_url "$1"
+ fi
+}
+
+process_file_url() {
+ local cfg="$1" new_size
+ local label type D_TMP R_TMP filter
+ if [ -z "$cfg" ] || [ -n "${2}${3}" ]; then
+ url="$2"
+ action="$3"
+ fi
+
+ [ "$enabled" = '1' ] || return 0
+ [ -n "$url" ] || return 1
+
+ label="${url##*//}"
+ label="${label%%/*}"
+ label="File: $label"
+ case "$action" in
+ allow) type='Allowed'; D_TMP="$A_TMP"
+ ;;
+ block) type='Blocked'; D_TMP="$B_TMP"
+ ;;
+ file) type='File'; D_TMP="$B_TMP"
+ ;;
+ esac
+ if [ "${1:0:5}" = "https" ] && [ -z "$isSSLSupported" ]; then
+ output 1 "$_FAIL_"
+ output 2 "[DL] $type $label $__FAIL__\\n"
+ echo "errorNoSSLSupport|${1}" >> "$sharedMemoryError"
+ return 0
+ fi
+ while [ -z "$R_TMP" ] || [ -e "$R_TMP" ]; do
+ R_TMP="$(mktemp -u -q -t ${packageName}_tmp.XXXXXXXX)"
+ done
+ if [ -z "$url" ] || ! $dl_command "$url" "$dl_flag" "$R_TMP" 2>/dev/null || \
+ [ ! -s "$R_TMP" ]; then
+ output 1 "$_FAIL_"
+ output 2 "[DL] $type $label $__FAIL__\\n"
+ echo "errorDownloadingList|${url}" >> "$sharedMemoryError"
+ else
+ [ -n "$cfg" ] && new_size="$(get_local_filesize "$R_TMP")"
+ if [ -n "$new_size" ] && [ "$size" != "$new_size" ]; then
+ uci set "${packageName}.${cfg}.size=$size"
+ fi
+ format="$(detect_file_type "$R_TMP")"
+ case "$format" in
+ adBlockPlus) filter="$adBlockPlusFilter";;
+# dnsmasqFile) filter="$dnsmasqFileFilter";;
+# dnsmasq2File) filter="$dnsmasq2FileFilter";;
+ domains) filter="$domainsFilter";;
+ hosts) filter="$hostsFilter";;
+ esac
+ [ -n "$filter" ] && sed -i "$filter" "$R_TMP"
+ if [ ! -s "$R_TMP" ]; then
+ output 1 "$_FAIL_"
+ output 2 "[DL] $type $label ($format) $__FAIL__\\n"
+ echo "errorParsingList|${1}" >> "$sharedMemoryError"
+ else
+ cat "${R_TMP}" >> "$D_TMP"
+ output 1 "$_OK_"
+ output 2 "[DL] $type $label ($format) $__OK__\\n"
+ fi
+ fi
+ rm -f "$R_TMP"
+ return 0
+}
+
+download_dnsmasq_file() {
+ local hf allow_filter j=0 R_TMP
+
+ json set message "$(get_text "statusDownloading")..."
+ json set status "statusDownloading"
+
+ rm -f "$A_TMP" "$B_TMP" "$outputFile" "$outputCache" "$outputGzip"
+ if [ "$($awk '/^MemFree/ {print int($2/1000)}' "/proc/meminfo")" -lt 32 ]; then
+ output 3 'Low free memory, restarting resolver '
+ if dns 'quiet'; then
+ output_okn
+ else
+ output_failn
+ fi
+ fi
+ touch $A_TMP; touch $B_TMP;
+ output 1 'Downloading dnsmasq file '
+ rm -f "$sharedMemoryError"
+ process_file_url '' "$dnsmasq_config_file_url" 'file'
+ if [ -s "$sharedMemoryError" ]; then
+ while IFS= read -r line; do
+ json add error "$line"
+ done < "$sharedMemoryError"
+ rm -f "$sharedMemoryError"
+ fi
+ output 2 'Moving dnsmasq file '
+ if mv "$B_TMP" "$outputFile"; then
+ output 2 "$__OK__\\n"
+ else
+ output 2 "$__FAIL__\\n"
+ json add error "errorMovingDataFile"
+ fi
+ output 1 '\n'
+}
+
+download_lists() {
+ local hf allow_filter j=0 R_TMP
+
+ json set message "$(get_text "statusDownloading")..."
+ json set status "statusDownloading"
+
+ rm -f "$A_TMP" "$B_TMP" "$outputFile" "$outputCache" "$outputGzip"
+ if [ "$($awk '/^MemFree/ {print int($2/1000)}' "/proc/meminfo")" -lt 32 ]; then
+ output 3 'Low free memory, restarting resolver '
+ if dns 'quiet'; then
+ output_okn
+ else
+ output_failn
+ fi
+ fi
+ touch $A_TMP; touch $B_TMP;
+ output 1 'Downloading lists '
+ rm -f "$sharedMemoryError"
+ config_load "$packageName"
+ config_foreach load_validate_file_url_section 'file_url' _process_file_url
+ wait
+ if [ -n "$(uci changes "$packageName")" ]; then
+ output 2 "Saving updated file size(s) "
+ uci commit "$packageName" && output_okn || output_failn
+ fi
+ output 1 '\n'
+
+ if [ -s "$sharedMemoryError" ]; then
+ while IFS= read -r line; do
+ json add error "$line"
+ done < "$sharedMemoryError"
+ rm -f "$sharedMemoryError"
+ fi
+
+ if [ "$canary_domains_icloud" -ne 0 ]; then
+ canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsiCloud}"
+ fi
+ if [ "$canary_domains_mozilla" -ne 0 ]; then
+ canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsMozilla}"
+ fi
+
+ for hf in $blocked_domain $canaryDomains; do echo "$hf" | sed "$domainsFilter" >> $B_TMP; done
+ allowed_domain="${allowed_domain}
+$(cat $A_TMP)"
+ for hf in ${allowed_domain}; do hf="$(echo "$hf" | sed 's/\./\\./g')"; allow_filter="$allow_filter/(^|\.)${hf}$/d;"; done
+
+ [ ! -s "$B_TMP" ] && return 1
+
+ output 1 'Processing downloads '
+ output 2 'Sorting combined list '
+ json set status "statusProcessing"
+ json set message "$(get_text "statusProcessing"): sorting combined list"
+ if [ "$allow_non_ascii" -gt 0 ]; then
+ if sort -u "$B_TMP" > "$A_TMP"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorSorting"
+ fi
+ else
+ if sort -u "$B_TMP" | grep -E -v '[^a-zA-Z0-9=/.-]' > "$A_TMP"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorSorting"
+ fi
+ fi
+
+ if [ "$dns" = 'dnsmasq.conf' ] || \
+ [ "$dns" = 'dnsmasq.ipset' ] || \
+ [ "$dns" = 'dnsmasq.nftset' ] || \
+ [ "$dns" = 'dnsmasq.servers' ] || \
+ [ "$dns" = 'unbound.adb_list' ]; then
+ # TLD optimization written by Dirk Brenken (dev@brenken.org)
+ output 2 'Optimizing combined list '
+ json set message "$(get_text "statusProcessing"): optimizing combined list"
+# sed -E 'G;:t;s/(.*)(\.)(.*)(\n)(.*)/\1\4\5\2\3/;tt;s/(.*)\n(\.)(.*)/\3\2\1/' is actually slower than command below
+ if $awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "$A_TMP" > "$B_TMP"; then
+ if sort "$B_TMP" > "$A_TMP"; then
+ if $awk '{if(NR=1){tld=$NF};while(getline){if($NF!~tld"\\."){print tld;tld=$NF}}print tld}' "$A_TMP" > "$B_TMP"; then
+ if $awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "$B_TMP" > "$A_TMP"; then
+ if sort -u "$A_TMP" > "$B_TMP"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorOptimization"
+ mv "$A_TMP" "$B_TMP"
+ fi
+ else
+ output_failn
+ json add error "errorOptimization"
+ fi
+ else
+ output_failn
+ json add error "errorOptimization"
+ mv "$A_TMP" "$B_TMP"
+ fi
+ else
+ output_failn
+ json add error "errorOptimization"
+ fi
+ else
+ output_failn
+ json add error "errorOptimization"
+ mv "$A_TMP" "$B_TMP"
+ fi
+ else
+ mv "$A_TMP" "$B_TMP"
+ fi
+
+ output 2 'Allowing domains '
+ json set message "$(get_text "statusProcessing"): allowing domains"
+ if sed -i -E "$allow_filter" "$B_TMP"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorAllowListProcessing"
+ fi
+
+ output 2 'Formatting merged file '
+ json set message "$(get_text "statusProcessing"): formatting merged file"
+ if [ -z "$outputFilterIPv6" ]; then
+ if sed "$outputFilter" "$B_TMP" > "$A_TMP"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorDataFileFormatting"
+ fi
+ else
+ case "$dns" in
+ dnsmasq.addnhosts)
+ if sed "$outputFilter" "$B_TMP" > "$A_TMP" && \
+ sed "$outputFilterIPv6" "$B_TMP" >> "$A_TMP"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorDataFileFormatting"
+ fi
+ ;;
+ esac
+ fi
+
+ case "$dns" in
+ dnsmasq.addnhosts)
+ output 2 'Creating dnsmasq addnhosts file '
+ json set message "$(get_text "statusProcessing"): creating dnsmasq addnhosts file"
+ ;;
+ dnsmasq.conf)
+ output 2 'Creating dnsmasq config file '
+ json set message "$(get_text "statusProcessing"): creating dnsmasq config file"
+ ;;
+ dnsmasq.ipset)
+ output 2 'Creating dnsmasq ipset file '
+ json set message "$(get_text "statusProcessing"): creating dnsmasq ipset file"
+ ;;
+ dnsmasq.nftset)
+ output 2 'Creating dnsmasq nft set file '
+ json set message "$(get_text "statusProcessing"): creating dnsmasq nft set file"
+ ;;
+ dnsmasq.servers)
+ output 2 'Creating dnsmasq servers file '
+ json set message "$(get_text "statusProcessing"): creating dnsmasq servers file"
+ ;;
+ unbound.adb_list)
+ output 2 'Creating Unbound adb_list file '
+ json set message "$(get_text "statusProcessing"): creating Unbound adb_list file"
+ ;;
+ esac
+
+ if mv "$A_TMP" "$outputFile"; then
+ output_ok
+ else
+ output_failn
+ json add error "errorMovingDataFile"
+ fi
+ if [ "$compressed_cache" -gt 0 ]; then
+ output 2 'Creating compressed cache '
+ json set message "$(get_text "statusProcessing"): creating compressed cache"
+ if cache 'create_gzip'; then
+ output_ok
+ else
+ output_failn
+ json add error "errorCreatingCompressedCache"
+ fi
+ else
+ rm -f "$outputGzip"
+ fi
+ output 2 'Removing temporary files '
+ json set message "$(get_text "statusProcessing"): removing temporary files"
+ rm -f "/tmp/${packageName}_tmp.*" "$A_TMP" "$B_TMP" "$outputCache" || j=1
+ if [ $j -eq 0 ]; then
+ output_ok
+ else
+ output_failn
+ json add error "errorRemovingTempFiles"
+ fi
+ output 1 '\n'
+}
+
+adb_allow() {
+ local c hf string="$1"
+ local validation_result="$3"
+ load_environment "$validation_result" 'quiet' || return 1
+ if [ ! -s "$outputFile" ]; then
+ output "No block-list ('$outputFile') found.\\n"
+ return 0
+ elif [ -z "$string" ]; then
+ output "Usage: /etc/init.d/${packageName} allow 'domain' ...\\n"
+ return 0
+ elif [ -n "$dnsmasq_config_file_url" ]; then
+ output "Allowing individual domains is not possible when using external dnsmasq config file.\\n"
+ return 0
+ fi
+ case "$dns" in
+ dnsmasq.addnhosts|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|dnsmasq.servers)
+ output 1 "Allowing domain(s) and restarting dnsmasq "
+ output 2 "Allowing domain(s) \\n"
+ for c in $string; do
+ output 2 " $c "
+ hf="$(echo "$c" | sed 's/\./\\./g')"
+ if sed -i "/(^|\.)${hf}$/d;" "$outputFile" && \
+ uci_add_list_if_new "${packageName}" 'config' 'allowed_domain' "$c"; then
+ output_ok
+ else
+ output_fail
+ fi
+ done
+ if [ "$compressed_cache" -gt 0 ]; then
+ output 2 'Creating compressed cache '
+ if cache 'create_gzip'; then
+ output_ok
+ else
+ output_failn
+ fi
+ fi
+ output 2 "Committing changes to config "
+ if [ -n "$(uci_changes "$packageName")" ] && uci_commit "$packageName"; then
+ allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
+ json set triggers
+ json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
+ output_ok;
+ if [ "$dns" = 'dnsmasq.ipset' ]; then
+ output 2 "Flushing adb ipset "
+ if ipset -q -! flush adb; then output_ok; else output_fail; fi
+ fi
+ if [ "$dns" = 'dnsmasq.nftset' ]; then
+ output 2 "Flushing adb nft sets "
+ nft flush set inet fw4 adb6
+ if nft flush set inet fw4 adb4; then output_ok; else output_fail; fi
+ fi
+ output 2 "Restarting dnsmasq "
+ if dnsmasq_restart; then output_okn; else output_failn; fi
+ else
+ output_fail;
+ fi
+ ;;
+ unbound.adb_list)
+ output 1 "Allowing domain(s) and restarting Unbound "
+ output 2 "Allowing domain(s) \\n"
+ for c in $string; do
+ output 2 " $c "
+ if sed -i "/${string}/d" "$outputFile" && \
+ uci_add_list_if_new "$packageName" 'config' 'allowed_domain' "$string"; then
+ output_ok
+ else
+ output_fail
+ fi
+ done
+ if [ "$compressed_cache" -gt 0 ]; then
+ output 2 'Creating compressed cache '
+ if cache 'create_gzip'; then
+ output_ok
+ else
+ output_failn
+ fi
+ fi
+ output 2 "Committing changes to config "
+ if [ -n "$(uci_changes "$packageName")" ] && uci_commit "$packageName"; then
+ allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
+ json set triggers
+ json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
+ output_ok;
+ output 2 "Restarting Unbound "
+ if unbound_restart; then output_okn; else output_failn; fi
+ else
+ output_fail;
+ fi
+ ;;
+ esac
+}
+
+adb_check() {
+ local c param="$1"
+ local validation_result="$3"
+ load_environment "$validation_result" 'quiet' || return 1
+ if [ ! -s "$outputFile" ]; then
+ output "No block-list ('$outputFile') found.\\n"
+ return 0
+ elif [ -z "$param" ]; then
+ output "Usage: /etc/init.d/${packageName} check 'domain' ...\\n"
+ return 0
+ fi
+ for string in ${param}; do
+ c="$(grep -c "$string" "$outputFile")"
+ if [ "$c" -gt 0 ]; then
+ if [ "$c" -eq 1 ]; then
+ output "Found 1 match for '$string' in '$outputFile'.\\n"
+ else
+ output "Found $c matches for '$string' in '$outputFile'.\\n"
+ fi
+ if [ "$c" -le 20 ]; then
+ case "$dns" in
+ dnsmasq.addnhosts)
+ grep "$string" "$outputFile" | sed 's|^127.0.0.1 ||;s|^:: ||;';;
+ dnsmasq.conf)
+ grep "$string" "$outputFile" | sed 's|local=/||;s|/$||;';;
+ dnsmasq.ipset)
+ grep "$string" "$outputFile" | sed 's|ipset=/||;s|/adb$||;';;
+ dnsmasq.nftset)
+ grep "$string" "$outputFile" | sed 's|nftset=/||;s|/4#inet#adb#adb4||;';;
+ dnsmasq.servers)
+ grep "$string" "$outputFile" | sed 's|server=/||;s|/$||;';;
+ unbound.adb_list)
+ grep "$string" "$outputFile" | sed 's|^local-zone: "||;s|" static$||;';;
+ esac
+ fi
+ else
+ output "The '$string' is not found in current block-list ('$outputFile').\\n"
+ fi
+ done
+}
+
+adb_config_update() {
+ local R_TMP label
+ local param validation_result="$3"
+ case "$1" in
+ on_boot) param="$1";;
+ *) param='quiet';;
+ esac
+ load_environment "$validation_result" "$param" || return 1
+ label="${config_update_url##*//}"
+ label="${label%%/*}";
+ [ "$config_update_enabled" -ne 0 ] || return 0
+
+ if [ "$param" != 'download' ]; then
+ cache 'test' && return 0
+ cache 'test_gzip' && return 0
+ fi
+ output 1 'Updating config '
+ while [ -z "$R_TMP" ] || [ -e "$R_TMP" ]; do
+ R_TMP="$(mktemp -u -q -t ${packageName}_tmp.XXXXXXXX)"
+ done
+ if ! $dl_command "$config_update_url" "$dl_flag" "$R_TMP" 2>/dev/null || [ ! -s "$R_TMP" ]; then
+ output 1 "$_FAIL_\\n"
+ output 2 "[DL] Config Update: $label $__FAIL__\\n"
+ json add error "errorDownloadingConfigUpdate"
+ else
+ if [ -s "$R_TMP" ] && sed -f "$R_TMP" -i "$packageConfigFile" 2>/dev/null; then
+ output 1 "$_OK_\\n"
+ output 2 "[DL] Config Update: $label $__OK__\\n"
+ else
+ output 1 "$_FAIL_\\n"
+ output 2 "[DL] Config Update: $label $__FAIL__\\n"
+ json add error "errorParsingConfigUpdate"
+ fi
+ fi
+ rm -f "$R_TMP"
+ return 0
+}
+
+_config_add_url_size() {
+ local cfg="$1" url size
+ config_get url "$cfg" url
+ size="$(get_url_filesize "$url")"
+ output "$url${size:+: $size} "
+ if [ -n "$size" ]; then
+ uci set "${packageName}.${cfg}.size=$size"
+ output_okn
+ else
+ output_failn
+ fi
+}
+
+adb_sizes() {
+ local i
+ local validation_result="$3"
+ load_environment "$validation_result" 'quiet' || return 1
+ config_load "$packageName"
+ config_foreach _config_add_url_size 'file_url'
+ uci commit "$packageName"
+}
+
+# shellcheck disable=SC2120
+adb_start() {
+ local action status error message stats c
+ local param="$1" validation_result="$3"
+
+ load_environment "$validation_result" "$param" || return 1
+
+ status="$(json get status)"
+ error="$(json get error)"
+ message="$(json get message)"
+ stats="$(json get stats)"
+ action="$(json get triggers)"
+
+ if [ "$action" = 'on_boot' ] || [ "$param" = 'on_boot' ]; then
+ if cache 'test_gzip' || cache 'test'; then
+ action='restore'
+ else
+ action='download'
+ fi
+ elif [ "$action" = 'download' ] || [ "$param" = 'download' ] || [ -n "$error" ]; then
+ action='download'
+ elif [ ! -s "$outputFile" ]; then
+ if cache 'test_gzip' || cache 'test'; then
+ action='restore'
+ else
+ action='download'
+ fi
+ elif [ "$action" = 'restart' ] || [ "$param" = 'restart' ]; then
+ action='restart'
+ elif [ -s "$outputFile" ] && [ "$status" = "statusSuccess" ] && [ -z "$error" ]; then
+ status_service
+ return 0
+ else
+ action='download'
+ fi
+
+ json del all
+ json set triggers
+
+ if [ "$action" = 'restore' ]; then
+ output 0 "Starting $serviceName... "
+ output 3 "Starting $serviceName...\\n"
+ json set status "statusStarting"
+ if cache 'test_gzip' && ! cache 'test' && [ ! -s "$outputFile" ]; then
+ output 3 'Found compressed cache file, unpacking it '
+ json set message 'found compressed cache file, unpacking it.'
+ if cache 'unpack_gzip'; then
+ output_okn
+ else
+ output_failn
+ json add error "errorRestoreCompressedCache"
+ output "${_ERROR_}: $(get_text 'errorRestoreCompressedCache')!\\n"
+ action='download'
+ fi
+ fi
+ if cache 'test' && [ ! -s "$outputFile" ]; then
+ output 3 'Found cache file, reusing it '
+ json set message 'found cache file, reusing it.'
+ if cache 'restore'; then
+ output_okn
+ dns 'on_start'
+ else
+ output_failn
+ json add error "errorRestoreCache"
+ output "${_ERROR_}: $(get_text 'errorRestoreCache')!\\n"
+ action='download'
+ fi
+ fi
+ fi
+ if [ "$action" = 'download' ]; then
+ if [ -s "$outputFile" ] || cache 'test' || cache 'test_gzip'; then
+ output 0 "Force-reloading $serviceName... "
+ output 3 "Force-reloading $serviceName...\\n"
+ json set status "statusForceReloading"
+ else
+ output 0 "Starting $serviceName... "
+ output 3 "Starting $serviceName...\\n"
+ json set status "statusStarting"
+ fi
+ if [ "$dns" = 'dnsmasq.conf' ] && [ -n "$dnsmasq_config_file_url" ]; then
+ download_dnsmasq_file
+ else
+ download_lists
+ fi
+ dns 'on_start'
+ fi
+ if [ "$action" = 'restart' ]; then
+ output 0 "Restarting $serviceName... "
+ output 3 "Restarting $serviceName...\\n"
+ json set status "statusRestarting"
+ dns 'on_start'
+ fi
+ if [ "$action" = 'start' ]; then
+ output 0 "Starting $serviceName... "
+ output 3 "Starting $serviceName...\\n"
+ json set status "statusStarting"
+ dns 'on_start'
+ fi
+ if [ -s "$outputFile" ] && [ "$(json get status)" != "statusFail" ]; then
+ output 0 "$__OK__\\n";
+ json del message
+ json set status "statusSuccess"
+ json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
+ status_service
+ else
+ output 0 "$__FAIL__\\n";
+ json set status "statusFail"
+ json add error "errorOhSnap"
+ status_service
+ fi
+
+ procd_open_instance 'main'
+ procd_set_param command /bin/true
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+ procd_open_data
+ json_add_string 'status' "$(json get status)"
+ json_add_string 'errors' "$(json get error)"
+ json_add_string 'warnings' "$(json get warning)"
+ if [ -s "$outputFile" ]; then
+ json_add_int 'entries' "$(wc -l < "$outputFile")"
+ else
+ json_add_int 'entries' '0'
+ fi
+ json_add_array firewall
+ if [ "$force_dns" -ne 0 ]; then
+ for c in ${force_dns_port/,/ }; do
+ if netstat -tuln | grep LISTEN | grep ":${c}" >/dev/null 2>&1; then
+ json_add_object ""
+ json_add_string type redirect
+ json_add_string target DNAT
+ json_add_string src lan
+ json_add_string proto "tcp udp"
+ json_add_string src_dport "$c"
+ json_add_string dest_port "$c"
+ json_add_string family any
+ json_add_boolean reflection 0
+ json_close_object
+ else
+ json_add_object ""
+ json_add_string type rule
+ json_add_string src lan
+ json_add_string dest "*"
+ json_add_string proto "tcp udp"
+ json_add_string dest_port "$c"
+ json_add_string target REJECT
+ json_close_object
+ fi
+ done
+ fi
+ case "$dns" in
+ dnsmasq.ipset)
+ json_add_object ""
+ json_add_string type ipset
+ json_add_string name adb
+ json_add_string match dest_net
+ json_add_string storage hash
+ json_close_object
+ json_add_object ""
+ json_add_string type rule
+ json_add_string ipset adb
+ json_add_string src lan
+ json_add_string dest "*"
+ json_add_string proto "tcp udp"
+ json_add_string target REJECT
+ json_close_object
+ ;;
+ dnsmasq.nftset)
+ json_add_object ""
+ json_add_string type ipset
+ json_add_string name adb4
+ json_add_string family 4
+ json_add_string match dest_net
+ json_close_object
+ json_add_object ""
+ json_add_string type rule
+ json_add_string ipset adb4
+ json_add_string src lan
+ json_add_string dest "*"
+ json_add_string proto "tcp udp"
+ json_add_string target REJECT
+ json_close_object
+ if [ "$ipv6_enabled" -ne 0 ]; then
+ json_add_object ""
+ json_add_string type ipset
+ json_add_string name adb6
+ json_add_string family 6
+ json_add_string match dest_net
+ json_close_object
+ json_add_object ""
+ json_add_string type rule
+ json_add_string ipset adb6
+ json_add_string src lan
+ json_add_string dest "*"
+ json_add_string proto "tcp udp"
+ json_add_string target REJECT
+ json_close_object
+ fi
+ ;;
+ esac
+ json_close_array
+ procd_close_data
+ procd_close_instance
+}
+
+adb_status() {
+ local c url status message error stats
+ local validation_result="$3"
+ load_environment "$validation_result" 'quiet' || return 1
+ status="$(json get status)"
+ message="$(json get message)"
+ error="$(json get error)"
+ stats="$(json get stats)"
+ if [ "$status" = "statusSuccess" ]; then
+ output "$stats "; output_okn;
+ else
+ [ -n "$status" ] && status="$(get_text "$status")"
+ if [ -n "$status" ] && [ -n "$message" ]; then
+ status="${status}: $message"
+ fi
+ [ -n "$status" ] && output "$serviceName $status\\n"
+ fi
+ if [ -n "$error" ]; then
+ for c in $error; do
+ url="${c##*|}"
+ c="${c%|*}"
+ case "$c" in
+ errorDownloadingList|errorParsingList)
+ output "${_ERROR_}: $(get_text "$c") $url!\\n";;
+ *)
+ output "${_ERROR_}: $(get_text "$c")!\\n";;
+ esac
+ n=$((n+1))
+ done
+ fi
+}
+
+# shellcheck disable=SC2120
+adb_stop() {
+ local validation_result="$3"
+ load_environment "$validation_result" 'quiet' || return 1
+ if [ -s "$outputFile" ]; then
+ output "Stopping $serviceName... "
+ cache 'create'
+ if dns 'on_stop'; then
+ ipset -q -! flush adb
+ ipset -q -! destroy adb
+ nft delete set inet fw4 adb4
+ nft delete set inet fw4 adb6
+ led_off "$led"
+ output 0 "$__OK__\\n"; output_okn;
+ json set status "statusStopped"
+ json del message
+ else
+ output 0 "$__FAIL__\\n"; output_fail;
+ json set status "statusFail"
+ json add error "errorStopping"
+ output "${_ERROR_}: $(get_text 'errorStopping')!\\n"
+ fi
+ fi
+}
+
+adb_pause() {
+ local timeout="${1:-$pause_timeout}"
+ local validation_result="$3"
+ adb_stop 'on_pause' '' "$validation_result"
+ output "Sleeping for $timeout seconds... "
+ if sleep "$timeout"; then
+ output_okn
+ else
+ output_failn
+ fi
+ adb_start 'on_pause' '' "$validation_result"
+}
+
+allow() { load_validate_config 'config' adb_allow "'$*'"; }
+boot() {
+ ubus -t 30 wait_for network.interface 2>/dev/null
+ rc_procd start_service 'on_boot'
+}
+check() { load_validate_config 'config' adb_check "'$*'"; }
+dl() { rc_procd start_service 'download'; }
+killcache() {
+ local compressed_cache_dir
+ config_load "$packageName"
+ config_get compressed_cache_dir 'config' 'compressed_cache_dir' '/etc'
+ if [ "$(sanitize_dir "$compressed_cache_dir")" = '/' ]; then
+ compressed_cache_dir=''
+ elif [ -n "$(sanitize_dir "$compressed_cache_dir")" ]; then
+ compressed_cache_dir="$(sanitize_dir "$compressed_cache_dir")"
+ else
+ compressed_cache_dir="/etc"
+ fi
+ rm -f "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
+ rm -f "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
+ rm -f "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
+ rm -f "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
+ rm -f "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
+ rm -f "$unboundCache" "$unboundGzip"
+ config_load 'dhcp'
+ config_foreach resolver 'dnsmasq' 'cleanup'
+ uci_commit 'dhcp'
+ return 0
+}
+reload_service() { rc_procd start_service 'restart'; }
+restart_service() { rc_procd start_service 'restart'; }
+service_started() { procd_set_config_changed firewall; }
+service_stopped() { procd_set_config_changed firewall; }
+service_triggers() {
+ local wan wan6 i
+ local procd_trigger_wan6
+ config_load "$packageName"
+ config_get_bool procd_trigger_wan6 'config' 'procd_trigger_wan6' '0'
+ . /lib/functions/network.sh
+ network_flush_cache
+ network_find_wan wan
+ wan="${wan:-wan}"
+ if [ "$procd_trigger_wan6" -ne 0 ]; then
+ network_find_wan6 wan6
+ wan6="${wan6:-wan6}"
+ fi
+ for i in "$wan" "$wan6"; do
+ [ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" start
+ done
+ procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload
+}
+sizes() { load_validate_config 'config' adb_sizes "''"; }
+start_service() {
+ load_validate_config 'config' adb_config_update "'$*'"
+ load_validate_config 'config' adb_start "'$*'"
+}
+status_service() { load_validate_config 'config' adb_status "''"; }
+stop_service() { load_validate_config 'config' adb_stop "'$*'"; }
+pause() { load_validate_config 'config' adb_pause "'$*'"; }
+version() { echo "$PKG_VERSION"; }
+
+load_validate_file_url_section() {
+ uci_load_validate "$packageName" "$packageName" "$1" "$2" \
+ 'enabled:bool:1' \
+ 'action:or("allow", "block"):block' \
+ 'size:or(uinteger, "")' \
+ 'url:string'
+}
+
+load_validate_config() {
+ . /lib/functions/network.sh
+ . /usr/share/libubox/jshn.sh
+ local enabled
+ local force_dns
+ local force_dns_port
+ local parallel_downloads
+ local debug
+ local compressed_cache
+ local compressed_cache_dir
+ local ipv6_enabled
+ local allow_non_ascii
+ local canary_domains_icloud
+ local canary_domains_mozilla
+ local config_update_enabled
+ local config_update_url
+ local download_timeout
+ local pause_timeout
+ local curl_additional_param
+ local curl_max_file_size
+ local curl_retry
+ local verbosity
+ local procd_trigger_wan6
+ local procd_boot_wan_timeout
+ local led
+ local dns
+ local dnsmasq_instance
+ local allowed_domain
+ local blocked_domain
+ local dnsmasq_config_file_url
+ uci_load_validate "$packageName" "$packageName" "$1" "${2}${3:+ $3}" \
+ 'enabled:bool:0' \
+ 'force_dns:bool:1' \
+ 'force_dns_port:list(integer):53,853' \
+ 'parallel_downloads:bool:1' \
+ 'debug:bool:0' \
+ 'compressed_cache:bool:0' \
+ 'compressed_cache_dir:directory:/etc' \
+ 'ipv6_enabled:bool:0' \
+ 'allow_non_ascii:bool:0' \
+ 'canary_domains_icloud:bool:0' \
+ 'canary_domains_mozilla:bool:0' \
+ 'config_update_enabled:bool:0' \
+ 'config_update_url:string:https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.conf.update' \
+ 'download_timeout:range(1,60):20' \
+ 'pause_timeout:range(10,120):60' \
+ 'curl_additional_param:or("", string)' \
+ 'curl_max_file_size:or("", uinteger)' \
+ 'curl_retry:range(0,30):3' \
+ 'verbosity:range(0,2):2' \
+ 'procd_trigger_wan6:bool:0' \
+ 'procd_boot_wan_timeout:integer:60' \
+ 'led:or("", "none", file, device, string)' \
+ 'dns:or("dnsmasq.addnhosts", "dnsmasq.conf", "dnsmasq.ipset", "dnsmasq.nftset", "dnsmasq.servers", "unbound.adb_list"):dnsmasq.servers' \
+ 'dnsmasq_instance:list(or(integer, string)):*' \
+ 'allowed_domain:list(string)' \
+ 'blocked_domain:list(string)' \
+ 'dnsmasq_config_file_url:string'
+}
--- /dev/null
+#!/bin/sh
+# Copyright 2023 MOSSDeF, Stan Grishin (stangri@melmac.ca)
+# shellcheck disable=SC1091,SC2015,SC3037,SC3043,SC2317,SC3060
+
+readonly packageName='adblock-fast'
+readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
+readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
+readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
+readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
+readonly _ERROR_='\033[0;31mERROR\033[0m'
+readonly _WARNING_='\033[0;33mWARNING\033[0m'
+output() {
+# Can take a single parameter (text) to be output at any verbosity
+# Or target verbosity level and text to be output at specifc verbosity
+ local msg memmsg logmsg
+ local sharedMemoryOutput="/dev/shm/$packageName-output"
+ verbosity="${verbosity:-2}"
+ if [ "$#" -ne 1 ]; then
+ if [ $((verbosity & $1)) -gt 0 ] || [ "$verbosity" = "$1" ]; then
+ shift
+ else
+ return 0
+ fi
+ fi
+ [ -t 1 ] && printf "%b" "$1"
+ msg="$1";
+ if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
+ [ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
+ logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
+ logger -t "${packageName:-service}" "$(printf "%b" "$logmsg")"
+ rm -f "$sharedMemoryOutput"
+ else
+ printf "%b" "$msg" >> "$sharedMemoryOutput"
+ fi
+}
+output_ok() { output 1 "$_OK_"; output 2 "$__OK__\\n"; }
+output_okn() { output 1 "$_OK_\\n"; output 2 "$__OK__\\n"; }
+output_fail() { output 1 "$_FAIL_"; output 2 "$__FAIL__\\n"; }
+output_failn() { output 1 "$_FAIL_\\n"; output 2 "$__FAIL__\\n"; }
+is_present() { command -v "$1" >/dev/null 2>&1; }
+get_url_filesize() {
+ local url="$1" size size_command
+ [ -n "$1" ] || return 0
+ is_present 'curl' || return 0
+ size_command='curl --silent --insecure --fail --head --request GET'
+ size="$($size_command "$url" | grep -Po '^[cC]ontent-[lL]ength: \K\w+')"
+ echo -en "$size"
+}
+
+# Transition from simple-adblock
+_enable_url() {
+ local cfg="$1" url="$2" action="$3"
+ local u a
+ config_get u "$cfg" 'url'
+ config_get a "$cfg" 'action' 'block'
+ if [ "$u" = "$url" ] && [ "$a" = "$action" ]; then
+ uci del "${packageName}.${cfg}.enabled" && _found=1
+ fi
+}
+
+enable_add_url() {
+ local url="$1" action="$2" _found
+ config_load "$packageName"
+ config_foreach _enable_url 'file_url' "$url" "$action"
+ if [ -z "$_found" ]; then
+ uci add "${packageName}" 'file_url' >/dev/null 2>&1
+ uci set "${packageName}.@file_url[-1].url=$url"
+ uci set "${packageName}.@file_url[-1].size=$(get_url_filesize "$url")"
+ uci set "${packageName}.@file_url[-1].action=$action"
+ fi
+}
+
+if [ -s '/etc/config/simple-adblock' ] \
+ && [ ! -s '/etc/config/adblock-fast-opkg' ] \
+ && [ "$(uci get adblock-fast.config.enabled)" = '0' ]; then
+ cp -f '/etc/config/adblock-fast' '/etc/config/adblock-fast-opkg'
+ enabled="$(uci get simple-adblock.config.enabled)"
+ if [ -x '/etc/init.d/simple-adblock' ]; then
+ output "Stopping and disabling simple-adblock "
+ if /etc/init.d/simple-adblock stop >/dev/null 2>&1 \
+ && /etc/init.d/simple-adblock disable \
+ && uci set simple-adblock.config.enabled=0 \
+ && uci commit simple-adblock; then
+ output_okn
+ else
+ output_failn
+ fi
+ else
+ output "Disabling simple-adblock."
+ if uci set simple-adblock.config.enabled=0 \
+ && uci commit simple-adblock; then
+ output_okn
+ else
+ output_failn
+ fi
+ fi
+ output "Migrating simple-adblock config file "
+ for i in allow_non_ascii canary_domains_icloud canary_domains_mozilla \
+ compressed_cache compressed_cache_dir config_update_enabled \
+ curl_additional_param curl_max_file_size curl_retry download_timeout \
+ debug dns dns_instance dnsmasq_config_file_url force_dns led \
+ parallel_downloads procd_trigger_wan6 procd_boot_wan_timeout verbosity; do
+ j="$(uci -q get simple-adblock.config.${i})"
+ [ -n "$j" ] && uci set "${packageName}.config.${i}=${j}"
+ done
+ [ -n "$enabled" ] && uci set "${packageName}.config.enabled=${enabled}"
+ j="$(uci -q get simple-adblock.config.config_update_url)"
+ if [ "${j//simple-adblock/}" = "$j" ]; then
+ uci set "${packageName}.config.config_update_url=$j"
+ fi
+ ccd="$(uci get simple-adblock.config.compressed_cache_dir)"
+ ccd="${ccd:-/etc}"
+ for j in $(uci -q get simple-adblock.config.allowed_domain); do
+ [ -n "$j" ] && uci add_list "${packageName}.config.allowed_domain=${j}"
+ done
+ for j in $(uci -q get simple-adblock.config.blocked_domain); do
+ [ -n "$j" ] && uci add_list "${packageName}.config.blocked_domain=${j}"
+ done
+ for j in $(uci -q get simple-adblock.config.force_dns_port); do
+ [ -n "$j" ] && uci add_list "${packageName}.config.force_dns_port=${j}"
+ done
+ output_okn
+
+ for i in allowed_domains_url blocked_adblockplus_url blocked_domains_url \
+ blocked_hosts_url; do
+ output "Migrating simple-adblock ${i} "
+ for j in $(uci -q get simple-adblock.config.${i}); do
+ if [ "$i" = 'allowed_domains_url' ]; then
+ enable_add_url "$j" 'allow'
+ else
+ enable_add_url "$j" 'block'
+ fi
+ done
+ output_okn
+ done
+ uci commit "$packageName"
+ output "Migrating simple-adblock cache file(s) "
+ for i in '/var/run/simple-adblock/dnsmasq.addnhosts.cache' \
+ '/var/run/simple-adblock/dnsmasq.conf.cache' \
+ '/var/run/simple-adblock/dnsmasq.ipset.cache' \
+ '/var/run/simple-adblock/dnsmasq.nftset.cache' \
+ '/var/run/simple-adblock/dnsmasq.servers.cache' \
+ '/var/run/simple-adblock/unbound.cache'; do
+ if [ -s "$i" ]; then
+ current_dir="$(dirname "$i")"
+ mkdir -p "${current_dir//simple-adblock/adblock-fast}"
+ mv -f "$i" "${i//simple-adblock/adblock-fast}" && output_okn || output_failn
+ fi
+ done
+ for i in 'simple-adblock.dnsmasq.addnhosts.gz' \
+ 'simple-adblock.dnsmasq.conf.gz' \
+ 'simple-adblock.dnsmasq.ipset.gz' \
+ 'simple-adblock.dnsmasq.nftset.gz' \
+ 'simple-adblock.dnsmasq.servers.gz' \
+ 'simple-adblock.unbound.gz'; do
+ i="${ccd}/${i}"
+ if [ -s "$i" ]; then
+ mkdir -p "${ccd//simple-adblock/adblock-fast}"
+ mv -f "$i" "${i//simple-adblock/adblock-fast}" && output_okn || output_failn
+ fi
+ done
+ output_okn
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+/etc/init.d/"$1" version 2>&1 | grep "$2"
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2023 Jonas Jelonek
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=croc
+PKG_VERSION:=9.6.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/schollz/croc/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=2d3ba7bae3c49e3870e2f8523c6be00e92fe6e46828269a8cea34d4034102cad
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jonas Jelonek <jelonek.jonas@gmail.com>
+
+PKG_BUILD_DEPENDS:=golang/host
+PKG_BUILD_PARALLEL:=1
+PKG_BUILD_FLAGS:=no-mips16
+
+GO_PKG:=github.com/schollz/croc/v9
+GO_PKG_BUILD_PKG:=$(GO_PKG)
+GO_PKG_LDFLAGS_X:=$(GO_PKG)/src/cli.Version=v$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../../lang/golang/golang-package.mk
+
+define Package/croc
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=File Transfer
+ TITLE:=Easily and securely send things from one computer to another
+ URL:=https://github.com/schollz/croc
+ DEPENDS:=$(GO_ARCH_DEPENDS)
+endef
+
+define Package/croc/description
+ croc is a tool that allows any two computers to simply and securely
+ transfer files and folders by using a relay.
+endef
+
+$(eval $(call GoBinPackage,croc))
+$(eval $(call BuildPackage,croc))
PKG_NAME:=ddns-scripts
PKG_VERSION:=2.8.2
-PKG_RELEASE:=38
+PKG_RELEASE:=39
PKG_LICENSE:=GPL-2.0
{
"name": "desec.io",
"ipv4": {
- "url": "http://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv4=[IP]&myipv6=preserve",
+ "url": "https://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv4=[IP]&myipv6=preserve",
"answer": "good|nochg"
},
"ipv6": {
- "url": "http://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv6=[IP]&myipv4=preserve",
+ "url": "https://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv6=[IP]&myipv4=preserve",
"answer": "good|nochg"
}
}
PKG_HASH:=05f0a3e8c8f489caf95919e2a75a1ec4598edd3428d2b9dd357caba6adb2607d
PKG_BUILD_DIR:=$(BUILD_DIR)/dnscrypt-proxy-$(PKG_VERSION)
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=haproxy
-PKG_VERSION:=2.8.2
+PKG_VERSION:=2.8.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.haproxy.org/download/2.8/src
-PKG_HASH:=698d6906d170946a869769964e57816ba3da3adf61ff75e89972b137f4658db0
+PKG_HASH:=9ecc6ffe67a977d1ed279107bbdab790d73ae2a626bc38eee23fa1f6786a759e
PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>, \
Christian Lachner <gladiac@gmail.com>
#!/bin/sh
CLONEURL=https://git.haproxy.org/git/haproxy-2.8.git
-BASE_TAG=v2.8.2
+BASE_TAG=v2.8.3
TMP_REPODIR=tmprepo
PATCHESDIR=patches
PKG_NAME:=https-dns-proxy
PKG_VERSION:=2023-05-25
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
define Package/https-dns-proxy/install
$(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/https_dns_proxy $(1)/usr/sbin/https-dns-proxy
$(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/etc/init.d/https-dns-proxy $(1)/etc/init.d/https-dns-proxy
+ $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/https-dns-proxy
$(INSTALL_DIR) $(1)/etc/config
- $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+ $(INSTALL_CONF) ./files/etc/config/https-dns-proxy $(1)/etc/config/https-dns-proxy
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/online
+ $(INSTALL_DATA) ./files/etc/hotplug.d/online/30-https-dns-proxy $(1)/etc/hotplug.d/online/30-https-dns-proxy
$(INSTALL_DIR) $(1)/etc/uci-defaults/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/https_dns_proxy $(1)/usr/sbin/https-dns-proxy
- $(INSTALL_BIN) ./files/https-dns-proxy.init $(1)/etc/init.d/https-dns-proxy
- $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/https-dns-proxy
- $(INSTALL_CONF) ./files/https-dns-proxy.config $(1)/etc/config/https-dns-proxy
- $(INSTALL_BIN) ./files/https-dns-proxy.defaults $(1)/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh
+ $(INSTALL_BIN) ./files/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh $(1)/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh
endef
$(eval $(call BuildPackage,https-dns-proxy))
--- /dev/null
+config main 'config'
+ option canary_domains_icloud '1'
+ option canary_domains_mozilla '1'
+ option dnsmasq_config_update '*'
+ option force_dns '1'
+ list force_dns_port '53'
+ list force_dns_port '853'
+# ports listed below are used by some
+# of the dnscrypt-proxy v1 resolvers
+# list force_dns_port '553'
+# list force_dns_port '1443'
+# list force_dns_port '4343'
+# list force_dns_port '4434'
+# list force_dns_port '5443'
+# list force_dns_port '8443'
+ option procd_trigger_wan6 '0'
+
+config https-dns-proxy
+ option bootstrap_dns '1.1.1.1,1.0.0.1'
+ option resolver_url 'https://cloudflare-dns.com/dns-query'
+ option listen_addr '127.0.0.1'
+ option listen_port '5053'
+ option user 'nobody'
+ option group 'nogroup'
+
+config https-dns-proxy
+ option bootstrap_dns '8.8.8.8,8.8.4.4'
+ option resolver_url 'https://dns.google/dns-query'
+ option listen_addr '127.0.0.1'
+ option listen_port '5054'
+ option user 'nobody'
+ option group 'nogroup'
--- /dev/null
+#!/bin/sh
+/etc/init.d/https-dns-proxy start 'on_hotplug'
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright 2019-2023 Stan Grishin (stangri@melmac.ca)
+# shellcheck disable=SC1091,SC3043,SC3060
+
+# shellcheck disable=SC2034
+START=90
+# shellcheck disable=SC2034
+USE_PROCD=1
+
+if type extra_command 1>/dev/null 2>&1; then
+ extra_command 'version' 'Show version information'
+else
+# shellcheck disable=SC2034
+ EXTRA_COMMANDS='version'
+fi
+
+readonly PKG_VERSION='dev-test'
+readonly packageName='https-dns-proxy'
+readonly serviceName="$packageName $PKG_VERSION"
+readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
+readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
+readonly PROG=/usr/sbin/https-dns-proxy
+readonly BOOTSTRAP_CF='1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001'
+readonly BOOTSTRAP_GOOGLE='8.8.8.8,8.8.4.4,2001:4860:4860::8888,2001:4860:4860::8844'
+readonly DEFAULT_BOOTSTRAP="${BOOTSTRAP_CF},${BOOTSTRAP_GOOGLE}"
+readonly canaryDomainsMozilla='use-application-dns.net'
+readonly canaryDomainsiCloud='mask.icloud.com mask-h2.icloud.com'
+
+str_contains() { [ -n "$1" ] &&[ -n "$2" ] && [ "${1//$2}" != "$1" ]; }
+is_mac_address() { expr "$1" : '[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]$' >/dev/null; }
+is_ipv4() { expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; }
+is_ipv6() { ! is_mac_address "$1" && str_contains "$1" ":"; }
+output() {
+ local msg memmsg logmsg
+ local sharedMemoryOutput="/dev/shm/$packageName-output"
+ [ -t 1 ] && printf "%b" "$@"
+ msg="${1//$serviceName /service }";
+ if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
+ [ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
+ logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
+ logger -t "$packageName" "$(printf "%b" "$logmsg")"
+ rm -f "$sharedMemoryOutput"
+ else
+ printf "%b" "$msg" >> "$sharedMemoryOutput"
+ fi
+}
+output_ok() { output "$_OK_"; }
+output_okn() { output "${_OK_}\\n"; }
+output_fail() { output "$_FAIL_"; }
+output_failn() { output "${_FAIL_}\\n"; }
+uci_add_list_if_new() {
+ local PACKAGE="$1"
+ local CONFIG="$2"
+ local OPTION="$3"
+ local VALUE="$4"
+ local i
+ [ -n "$PACKAGE" ] && [ -n "$CONFIG" ] && [ -n "$OPTION" ] && [ -n "$VALUE" ] || return 1
+ for i in $(uci_get "$PACKAGE" "$CONFIG" "$OPTION"); do
+ [ "$i" = "$VALUE" ] && return 0
+ done
+ uci_add_list "$PACKAGE" "$CONFIG" "$OPTION" "$VALUE"
+}
+uci_changes() {
+ local PACKAGE="$1"
+ local CONFIG="$2"
+ local OPTION="$3"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
+}
+
+dnsmasq_restart() { [ -x /etc/init.d/dnsmasq ] || return 1; /etc/init.d/dnsmasq restart >/dev/null 2>&1; }
+
+version() { echo "$PKG_VERSION"; }
+
+xappend() { PROG_param="$PROG_param $1"; }
+
+append_bool() {
+ local section="$1"
+ local option="$2"
+ local value="$3"
+ local default="${4:-0}"
+ local _loctmp
+ config_get_bool _loctmp "$section" "$option" "$default"
+ [ "$_loctmp" -ne 0 ] && xappend "$value"
+}
+
+append_parm() {
+ local section="$1"
+ local option="$2"
+ local switch="$3"
+ local default="$4"
+ local _loctmp
+ config_get _loctmp "$section" "$option" "$default"
+ [ -n "$_loctmp" ] && xappend "$switch $_loctmp"
+}
+
+append_counter() {
+ local section="$1"
+ local option="$2"
+ local switch="$3"
+ local default="${4:-0}"
+ local _loctmp i
+ config_get _loctmp "$section" "$option" "$default"
+# shellcheck disable=SC2086,SC2154
+ for i in $(seq 1 $_loctmp); do
+ xappend '-v'
+ done
+}
+
+append_bootstrap() {
+ local section="$1"
+ local option="$2"
+ local switch="$3"
+ local default="$4"
+ local _old_ifs="$IFS"
+ local _loctmp _newtmp i
+ config_get _loctmp "$section" "$option" "$default"
+ [ -z "$_loctmp" ] && return 0
+ IFS=" ,"
+ for i in $_loctmp; do
+ if { [ "$ipv6_resolvers_only" -eq 0 ] && is_ipv4 "$i"; } || \
+ { [ "$ipv6_resolvers_only" -ne 0 ] && is_ipv6 "$i"; }; then
+ [ -z "$_newtmp" ] && _newtmp="$i" || _newtmp="${_newtmp},${i}"
+ fi
+ done
+ IFS="$_old_ifs"
+ [ -n "$_newtmp" ] && xappend "$switch $_newtmp"
+ [ "$ipv6_resolvers_only" -eq 0 ] && xappend '-4'
+}
+
+resolver_health_check() { resolveip -t 3 one.one.one.one >/dev/null 2>&1; }
+
+boot() {
+ ubus -t 30 wait_for network.interface 2>/dev/null
+ rc_procd start_service 'on_boot'
+ resolver_health_check || rc_procd stop_service 'on_boot'
+}
+
+start_instance() {
+ local cfg="$1" param="$2"
+ local PROG_param
+ local listen_addr listen_port ipv6_resolvers_only p url iface
+
+ config_get url "$cfg" 'resolver_url'
+ config_get_bool ipv6_resolvers_only "$cfg" 'use_ipv6_resolvers_only' '0'
+ append_parm "$cfg" 'resolver_url' '-r'
+ append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
+ append_parm "$cfg" 'listen_port' '-p' "$port"
+ append_parm "$cfg" 'dscp_codepoint' '-c'
+ append_bootstrap "$cfg" 'bootstrap_dns' '-b' "$DEFAULT_BOOTSTRAP"
+ append_parm "$cfg" 'user' '-u' 'nobody'
+ append_parm "$cfg" 'group' '-g' 'nogroup'
+ append_parm "$cfg" 'ca_certs_file' '-C'
+ append_parm "$cfg" 'polling_interval' '-i'
+ append_parm "$cfg" 'proxy_server' '-t'
+ append_parm "$cfg" 'logfile' '-l'
+ append_bool "$cfg" 'use_http1' '-x'
+ append_counter "$cfg" 'verbosity' '-v' '0'
+
+ procd_open_instance
+# shellcheck disable=SC2086
+ procd_set_param command $PROG $PROG_param
+ procd_set_param stderr 1
+ procd_set_param stdout 1
+ procd_set_param respawn
+ procd_open_data
+ json_add_object mdns
+ procd_add_mdns_service "$packageName" 'udp' "$port" "DNS over HTTPS proxy"
+ json_close_object
+ if [ "$force_dns" -ne 0 ]; then
+ json_add_array firewall
+ for iface in $procd_fw_src_interfaces; do
+ for p in $force_dns_port; do
+ if netstat -tuln | grep 'LISTEN' | grep ":${p}" >/dev/null 2>&1 || [ "$p" = '53' ]; then
+ json_add_object ''
+ json_add_string type redirect
+ json_add_string target DNAT
+ json_add_string src "$iface"
+ json_add_string proto 'tcp udp'
+ json_add_string src_dport "$p"
+ json_add_string dest_port "$p"
+ json_add_string family any
+ json_add_boolean reflection 0
+ json_close_object
+ else
+ json_add_object ''
+ json_add_string type rule
+ json_add_string src "$iface"
+ json_add_string dest '*'
+ json_add_string proto 'tcp udp'
+ json_add_string dest_port "$p"
+ json_add_string target REJECT
+ json_close_object
+ fi
+ done
+ done
+ json_close_array
+ fi
+ procd_close_data
+ procd_close_instance
+
+ if [ "$?" ]; then
+ config_get listen_addr "$cfg" 'listen_addr' '127.0.0.1'
+ config_get listen_port "$cfg" 'listen_port' "$port"
+ if [ "$dnsmasq_config_update" = '*' ]; then
+ config_load 'dhcp'
+ config_foreach dnsmasq_doh_server 'dnsmasq' 'add' "${listen_addr}" "${listen_port}"
+ elif [ -n "$dnsmasq_config_update" ]; then
+ for i in $dnsmasq_config_update; do
+ if [ -n "$(uci_get 'dhcp' "@dnsmasq[$i]")" ]; then
+ dnsmasq_doh_server "@dnsmasq[$i]" 'add' "${listen_addr}" "${listen_port}"
+ elif [ -n "$(uci_get 'dhcp' "$i")" ]; then
+ dnsmasq_doh_server "${i}" 'add' "${listen_addr}" "${listen_port}"
+ fi
+ done
+ fi
+ output_ok
+ port="$((port+1))"
+ force_dns=0
+ else
+ output_fail
+ fi
+}
+
+start_service() {
+ local param="$1"
+ local canaryDomains canary_domains_icloud canary_domains_mozilla
+ local dnsmasq_config_update force_dns force_dns_port
+ local procd_fw_src_interfaces
+
+ local port=5053
+ output "Starting $serviceName instances ${param:+$param }"
+ config_load "$packageName"
+ config_get_bool canary_domains_icloud 'config' 'canary_domains_icloud' '1'
+ config_get_bool canary_domains_mozilla 'config' 'canary_domains_mozilla' '1'
+ config_get_bool force_dns 'config' 'force_dns' '1'
+ config_get dnsmasq_config_update 'config' 'dnsmasq_config_update' '*'
+ config_get force_dns_port 'config' 'force_dns_port' '53 853'
+ config_get procd_fw_src_interfaces 'config' 'procd_fw_src_interfaces' 'lan'
+ if [ "$canary_domains_icloud" -ne 0 ]; then
+ canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsiCloud}"
+ fi
+ if [ "$canary_domains_mozilla" -ne 0 ]; then
+ canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsMozilla}"
+ fi
+ dhcp_backup 'create'
+ config_load "$packageName"
+ config_foreach start_instance "$packageName" "$param"
+ output "\\n"
+ if [ -n "$(uci_changes dhcp)" ]; then
+ output "Updating dnsmasq config "
+ if uci_commit 'dhcp'; then
+ output_okn
+ else
+ output_failn
+ fi
+ param='dnsmasq_restart'
+ fi
+ if [ "$param" = 'on_hotplug' ] || [ "$param" = 'on_boot' ] || \
+ [ "$param" = 'dnsmasq_restart' ] ; then
+ output "Restarting dnsmasq "
+ if dnsmasq_restart; then
+ output_okn
+ else
+ output_failn
+ fi
+ fi
+}
+
+stop_service() {
+ local param="$1"
+ local canaryDomains canary_domains_icloud canary_domains_mozilla
+ local dnsmasq_config_update
+ local s=0
+ output "Stopping $serviceName ${param:+$param }"
+ config_load "$packageName"
+ config_get dnsmasq_config_update 'config' 'dnsmasq_config_update' '*'
+ config_get_bool canary_domains_icloud 'config' 'canary_domains_icloud' '1'
+ config_get_bool canary_domains_mozilla 'config' 'canary_domains_mozilla' '1'
+ if [ "$canary_domains_icloud" -ne 0 ]; then
+ canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsiCloud}"
+ fi
+ if [ "$canary_domains_mozilla" -ne 0 ]; then
+ canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsMozilla}"
+ fi
+ dhcp_backup 'restore'
+ if [ -n "$(uci_changes dhcp)" ]; then
+ uci_commit 'dhcp'
+ dnsmasq_restart || s=1
+ fi
+# shellcheck disable=SC2015
+ [ "$s" = '0' ] && output_okn || output_failn
+}
+
+# shellcheck disable=SC1091
+service_triggers() {
+ local wan wan6 i
+ local procd_trigger_wan6
+ config_load "$packageName"
+ config_get_bool procd_trigger_wan6 'config' 'procd_trigger_wan6' '0'
+ . /lib/functions/network.sh
+ network_flush_cache
+ network_find_wan wan
+ wan="${wan:-wan}"
+ if [ "$procd_trigger_wan6" -ne 0 ]; then
+ network_find_wan6 wan6
+ wan6="${wan6:-wan6}"
+ fi
+ for i in "$wan" "$wan6"; do
+ [ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" restart
+ done
+ procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload
+}
+
+service_started() { procd_set_config_changed firewall; }
+service_stopped() { procd_set_config_changed firewall; }
+restart() { procd_send_signal "$packageName"; rc_procd start_service; }
+
+dnsmasq_doh_server() {
+ local cfg="$1" param="$2" address="${3:-127.0.0.1}" port="$4" i
+ case "$param" in
+ add)
+ if [ "$force_dns" -ne 0 ]; then
+ for i in $canaryDomains; do
+ uci_add_list_if_new 'dhcp' "$cfg" 'server' "/${i}/"
+ done
+ fi
+ case $address in
+ 0.0.0.0|::ffff:0.0.0.0) address='127.0.0.1';;
+ ::) address='::1';;
+ esac
+ uci_add_list_if_new 'dhcp' "$cfg" 'server' "${address}#${port}"
+ uci_add_list_if_new 'dhcp' "$cfg" 'doh_server' "${address}#${port}"
+ ;;
+ remove)
+ for i in $(uci -q get "dhcp.$cfg.doh_server"); do
+ uci_remove_list 'dhcp' "$cfg" 'server' "$i"
+ uci_remove_list 'dhcp' "$cfg" 'doh_server' "$i"
+ done
+ for i in $canaryDomains; do
+ uci_remove_list 'dhcp' "$cfg" 'server' "/${i}/"
+ uci_remove_list 'dhcp' "$cfg" 'doh_server' "/${i}/"
+ done
+ ;;
+ esac
+}
+
+dnsmasq_create_server_backup() {
+ local cfg="$1" i
+ [ -n "$(uci_get 'dhcp' "$cfg")" ] || return 1
+ if [ -z "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" ]; then
+ if [ -z "$(uci_get 'dhcp' "$cfg" 'noresolv')" ]; then
+ uci_set 'dhcp' "$cfg" 'doh_backup_noresolv' '-1'
+ else
+ uci_set 'dhcp' "$cfg" 'doh_backup_noresolv' "$(uci_get 'dhcp' "$cfg" noresolv)"
+ fi
+ uci_set 'dhcp' "$cfg" 'noresolv' 1
+ fi
+ if [ -z "$(uci_get 'dhcp' "$cfg" 'doh_backup_server')" ]; then
+ if [ -z "$(uci_get 'dhcp' "$cfg" 'server')" ]; then
+ uci_add_list 'dhcp' "$cfg" 'doh_backup_server' ""
+ fi
+ for i in $(uci_get 'dhcp' "$cfg" 'server'); do
+ uci_add_list 'dhcp' "$cfg" 'doh_backup_server' "$i"
+ if [ "$i" = "$(echo "$i" | tr -d /\#)" ]; then
+ uci_remove_list 'dhcp' "$cfg" 'server' "$i"
+ fi
+ done
+ fi
+ return 0
+}
+
+dnsmasq_restore_server_backup() {
+ local cfg="$1" i
+ [ -n "$(uci_get 'dhcp' "$cfg")" ] || return 0
+ if [ -n "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" ]; then
+ if [ "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" = "-1" ]; then
+ uci_remove 'dhcp' "$cfg" 'noresolv'
+ else
+ uci_set 'dhcp' "$cfg" 'noresolv' "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')"
+ fi
+ uci_remove 'dhcp' "$cfg" 'doh_backup_noresolv'
+ fi
+ if uci_get 'dhcp' "$cfg" 'doh_backup_server' >/dev/null 2>&1; then
+ dnsmasq_doh_server "$cfg" 'remove'
+ for i in $(uci_get 'dhcp' "$cfg" 'doh_backup_server'); do
+ uci_add_list_if_new 'dhcp' "$cfg" 'server' "$i"
+ done
+ uci_remove 'dhcp' "$cfg" 'doh_backup_server'
+ fi
+}
+
+dhcp_backup() {
+ local i
+ config_load 'dhcp'
+ case "$1" in
+ create)
+ if [ "$dnsmasq_config_update" = "*" ]; then
+ config_foreach dnsmasq_create_server_backup 'dnsmasq'
+ elif [ -n "$dnsmasq_config_update" ]; then
+ for i in $dnsmasq_config_update; do
+ if [ -n "$(uci_get 'dhcp' "@dnsmasq[$i]")" ]; then
+ dnsmasq_create_server_backup "@dnsmasq[$i]"
+ elif [ -n "$(uci_get 'dhcp' "$i")" ]; then
+ dnsmasq_create_server_backup "$i"
+ fi
+ done
+ fi
+ ;;
+ restore)
+ config_foreach dnsmasq_restore_server_backup 'dnsmasq'
+ ;;
+ esac
+}
--- /dev/null
+#!/bin/sh
+ sed -i "s|update_dnsmasq_config|dnsmasq_config_update|" "/etc/config/https-dns-proxy"
+ sed -i "s|wan6_trigger|procd_trigger_wan6|" "/etc/config/https-dns-proxy"
+++ /dev/null
-config main 'config'
- option canary_domains_icloud '1'
- option canary_domains_mozilla '1'
- option dnsmasq_config_update '*'
- option force_dns '1'
- list force_dns_port '53'
- list force_dns_port '853'
-# ports listed below are used by some
-# of the dnscrypt-proxy v1 resolvers
-# list force_dns_port '553'
-# list force_dns_port '1443'
-# list force_dns_port '4343'
-# list force_dns_port '4434'
-# list force_dns_port '5443'
-# list force_dns_port '8443'
- option procd_trigger_wan6 '0'
-
-config https-dns-proxy
- option bootstrap_dns '1.1.1.1,1.0.0.1'
- option resolver_url 'https://cloudflare-dns.com/dns-query'
- option listen_addr '127.0.0.1'
- option listen_port '5053'
- option user 'nobody'
- option group 'nogroup'
-
-config https-dns-proxy
- option bootstrap_dns '8.8.8.8,8.8.4.4'
- option resolver_url 'https://dns.google/dns-query'
- option listen_addr '127.0.0.1'
- option listen_port '5054'
- option user 'nobody'
- option group 'nogroup'
+++ /dev/null
-#!/bin/sh
- sed -i "s|update_dnsmasq_config|dnsmasq_config_update|" "/etc/config/https-dns-proxy"
- sed -i "s|wan6_trigger|procd_trigger_wan6|" "/etc/config/https-dns-proxy"
+++ /dev/null
-#!/bin/sh
-
-if [ "$ACTION" = 'ifup' ] && [ "$INTERFACE" = 'wan' ] && /etc/init.d/https-dns-proxy enabled; then
- logger -t "https-dns-proxy" "Restarting https-dns-proxy due to $ACTION of $INTERFACE"
- /etc/init.d/https-dns-proxy restart
-fi
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright 2019-2022 Stan Grishin (stangri@melmac.ca)
-# shellcheck disable=SC1091,SC3043,SC3060
-
-# shellcheck disable=SC2034
-START=95
-# shellcheck disable=SC2034
-USE_PROCD=1
-
-if type extra_command 1>/dev/null 2>&1; then
- extra_command 'version' 'Show version information'
-else
-# shellcheck disable=SC2034
- EXTRA_COMMANDS='version'
-fi
-
-readonly PKG_VERSION='dev-test'
-readonly packageName='https-dns-proxy'
-readonly serviceName="$packageName $PKG_VERSION"
-readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
-readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
-readonly PROG=/usr/sbin/https-dns-proxy
-readonly BOOTSTRAP_CF='1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001'
-readonly BOOTSTRAP_GOOGLE='8.8.8.8,8.8.4.4,2001:4860:4860::8888,2001:4860:4860::8844'
-readonly DEFAULT_BOOTSTRAP="${BOOTSTRAP_CF},${BOOTSTRAP_GOOGLE}"
-readonly canaryDomainsMozilla='use-application-dns.net'
-readonly canaryDomainsiCloud='mask.icloud.com mask-h2.icloud.com'
-
-str_contains() { [ -n "$1" ] &&[ -n "$2" ] && [ "${1//$2}" != "$1" ]; }
-is_mac_address() { expr "$1" : '[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]$' >/dev/null; }
-is_ipv4() { expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; }
-is_ipv6() { ! is_mac_address "$1" && str_contains "$1" ":"; }
-output() {
- local msg memmsg logmsg
- local sharedMemoryOutput="/dev/shm/$packageName-output"
- [ -t 1 ] && printf "%b" "$@"
- msg="${1//$serviceName /service }";
- if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
- [ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
- logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
- logger -t "$packageName" "$(printf "%b" "$logmsg")"
- rm -f "$sharedMemoryOutput"
- else
- printf "%b" "$msg" >> "$sharedMemoryOutput"
- fi
-}
-output_ok() { output "$_OK_"; }
-output_okn() { output "${_OK_}\\n"; }
-output_fail() { output "$_FAIL_"; }
-output_failn() { output "${_FAIL_}\\n"; }
-uci_add_list_if_new() {
- local PACKAGE="$1"
- local CONFIG="$2"
- local OPTION="$3"
- local VALUE="$4"
- local i
- [ -n "$PACKAGE" ] && [ -n "$CONFIG" ] && [ -n "$OPTION" ] && [ -n "$VALUE" ] || return 1
- for i in $(uci_get "$PACKAGE" "$CONFIG" "$OPTION"); do
- [ "$i" = "$VALUE" ] && return 0
- done
- uci_add_list "$PACKAGE" "$CONFIG" "$OPTION" "$VALUE"
-}
-uci_changes() {
- local PACKAGE="$1"
- local CONFIG="$2"
- local OPTION="$3"
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
-}
-
-dnsmasq_restart() { [ -x /etc/init.d/dnsmasq ] || return 1; /etc/init.d/dnsmasq restart >/dev/null 2>&1; }
-
-version() { echo "$PKG_VERSION"; }
-
-xappend() { param="$param $1"; }
-
-append_bool() {
- local section="$1"
- local option="$2"
- local value="$3"
- local default="${4:-0}"
- local _loctmp
- config_get_bool _loctmp "$section" "$option" "$default"
- [ "$_loctmp" -ne 0 ] && xappend "$value"
-}
-
-append_parm() {
- local section="$1"
- local option="$2"
- local switch="$3"
- local default="$4"
- local _loctmp
- config_get _loctmp "$section" "$option" "$default"
- [ -n "$_loctmp" ] && xappend "$switch $_loctmp"
-}
-
-append_counter() {
- local section="$1"
- local option="$2"
- local switch="$3"
- local default="${4:-0}"
- local _loctmp i
- config_get _loctmp "$section" "$option" "$default"
-# shellcheck disable=SC2086,SC2154
- for i in $(seq 1 $_loctmp); do
- xappend '-v'
- done
-}
-
-append_bootstrap() {
- local section="$1"
- local option="$2"
- local switch="$3"
- local default="$4"
- local _old_ifs="$IFS"
- local _loctmp _newtmp i
- config_get _loctmp "$section" "$option" "$default"
- [ -z "$_loctmp" ] && return 0
- IFS=" ,"
- for i in $_loctmp; do
- if { [ "$ipv6_resolvers_only" -eq 0 ] && is_ipv4 "$i"; } || \
- { [ "$ipv6_resolvers_only" -ne 0 ] && is_ipv6 "$i"; }; then
- [ -z "$_newtmp" ] && _newtmp="$i" || _newtmp="${_newtmp},${i}"
- fi
- done
- IFS="$_old_ifs"
- [ -n "$_newtmp" ] && xappend "$switch $_newtmp"
- [ "$ipv6_resolvers_only" -eq 0 ] && xappend '-4'
-}
-
-boot() {
- ubus -t 30 wait_for network.interface 2>/dev/null
- rc_procd start_service 'on_boot'
-}
-
-start_instance() {
- local cfg="$1" param listen_addr listen_port ipv6_resolvers_only p url iface
-
- config_get url "$cfg" 'resolver_url'
- config_get_bool ipv6_resolvers_only "$cfg" 'use_ipv6_resolvers_only' '0'
- append_parm "$cfg" 'resolver_url' '-r'
- append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
- append_parm "$cfg" 'listen_port' '-p' "$port"
- append_parm "$cfg" 'dscp_codepoint' '-c'
- append_bootstrap "$cfg" 'bootstrap_dns' '-b' "$DEFAULT_BOOTSTRAP"
- append_parm "$cfg" 'user' '-u' 'nobody'
- append_parm "$cfg" 'group' '-g' 'nogroup'
- append_parm "$cfg" 'ca_certs_file' '-C'
- append_parm "$cfg" 'polling_interval' '-i'
- append_parm "$cfg" 'proxy_server' '-t'
- append_parm "$cfg" 'logfile' '-l'
- append_bool "$cfg" 'use_http1' '-x'
- append_counter "$cfg" 'verbosity' '-v' '0'
-
- procd_open_instance
-# shellcheck disable=SC2086
- procd_set_param command $PROG $param
- procd_set_param stderr 1
- procd_set_param stdout 1
- procd_set_param respawn
- procd_open_data
- json_add_object mdns
- procd_add_mdns_service "$packageName" 'udp' "$port" "DNS over HTTPS proxy"
- json_close_object
- json_add_string url "$url"
- if [ "$force_dns" -ne 0 ]; then
- json_add_array firewall
- for iface in $procd_fw_src_interfaces; do
- for p in $force_dns_port; do
- if netstat -tuln | grep 'LISTEN' | grep ":${p}" >/dev/null 2>&1 || [ "$p" = '53' ]; then
- json_add_object ''
- json_add_string type redirect
- json_add_string target DNAT
- json_add_string src "$iface"
- json_add_string proto 'tcp udp'
- json_add_string src_dport "$p"
- json_add_string dest_port "$p"
- json_add_string family any
- json_add_boolean reflection 0
- json_close_object
- else
- json_add_object ''
- json_add_string type rule
- json_add_string src "$iface"
- json_add_string dest '*'
- json_add_string proto 'tcp udp'
- json_add_string dest_port "$p"
- json_add_string target REJECT
- json_close_object
- fi
- done
- done
- json_close_array
- fi
- procd_close_data
- procd_close_instance
-
- if [ "$?" ]; then
- config_get listen_addr "$cfg" 'listen_addr' '127.0.0.1'
- config_get listen_port "$cfg" 'listen_port' "$port"
- if [ "$dnsmasq_config_update" = '*' ]; then
- config_load 'dhcp'
- config_foreach dnsmasq_doh_server 'dnsmasq' 'add' "${listen_addr}" "${listen_port}"
- elif [ -n "$dnsmasq_config_update" ]; then
- for i in $dnsmasq_config_update; do
- if [ -n "$(uci_get 'dhcp' "@dnsmasq[$i]")" ]; then
- dnsmasq_doh_server "@dnsmasq[$i]" 'add' "${listen_addr}" "${listen_port}"
- elif [ -n "$(uci_get 'dhcp' "$i")" ]; then
- dnsmasq_doh_server "${i}" 'add' "${listen_addr}" "${listen_port}"
- fi
- done
- fi
- output_ok
- port="$((port+1))"
- force_dns=0
- else
- output_fail
- fi
-}
-
-start_service() {
- local canaryDomains canary_domains_icloud canary_domains_mozilla
- local dnsmasq_config_update force_dns force_dns_port
- local procd_fw_src_interfaces
-
- local port=5053
- output "Starting $serviceName instances "
- config_load "$packageName"
- config_get_bool canary_domains_icloud 'config' 'canary_domains_icloud' '1'
- config_get_bool canary_domains_mozilla 'config' 'canary_domains_mozilla' '1'
- config_get_bool force_dns 'config' 'force_dns' '1'
- config_get dnsmasq_config_update 'config' 'dnsmasq_config_update' '*'
- config_get force_dns_port 'config' 'force_dns_port' '53 853'
- config_get procd_fw_src_interfaces 'config' 'procd_fw_src_interfaces' 'lan'
- if [ "$canary_domains_icloud" -ne 0 ]; then
- canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsiCloud}"
- fi
- if [ "$canary_domains_mozilla" -ne 0 ]; then
- canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsMozilla}"
- fi
- dhcp_backup 'create'
- config_load "$packageName"
- config_foreach start_instance "$packageName"
- output "\\n"
- if [ -n "$(uci_changes dhcp)" ]; then
- output "Updating dnsmasq config "
- if uci_commit 'dhcp'; then
- output_okn
- else
- output_failn
- fi
- output "Restarting dnsmasq "
- if dnsmasq_restart; then
- output_okn
- else
- output_failn
- fi
- fi
-}
-
-stop_service() {
- local canaryDomains canary_domains_icloud canary_domains_mozilla
- local dnsmasq_config_update
- local s=0
- output "Stopping $serviceName "
- config_load "$packageName"
- config_get dnsmasq_config_update 'config' 'dnsmasq_config_update' '*'
- config_get_bool canary_domains_icloud 'config' 'canary_domains_icloud' '1'
- config_get_bool canary_domains_mozilla 'config' 'canary_domains_mozilla' '1'
- if [ "$canary_domains_icloud" -ne 0 ]; then
- canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsiCloud}"
- fi
- if [ "$canary_domains_mozilla" -ne 0 ]; then
- canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsMozilla}"
- fi
- dhcp_backup 'restore'
- if [ -n "$(uci_changes dhcp)" ]; then
- uci_commit 'dhcp'
- dnsmasq_restart || s=1
- fi
-# shellcheck disable=SC2015
- [ "$s" -eq 0 ] && output_okn || output_failn
-}
-
-# shellcheck disable=SC1091
-service_triggers() {
- local wan wan6 i
- local procd_trigger_wan6
- config_load "$packageName"
- config_get_bool procd_trigger_wan6 'config' 'procd_trigger_wan6' '0'
- . /lib/functions/network.sh
- network_flush_cache
- network_find_wan wan
- wan="${wan:-wan}"
- if [ "$procd_trigger_wan6" -ne 0 ]; then
- network_find_wan6 wan6
- wan6="${wan6:-wan6}"
- fi
- for i in "$wan" "$wan6"; do
- [ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" restart
- done
- procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload
-}
-
-service_started() { procd_set_config_changed firewall; }
-service_stopped() { procd_set_config_changed firewall; }
-restart() { procd_send_signal "$packageName"; rc_procd start_service; }
-
-dnsmasq_doh_server() {
- local cfg="$1" param="$2" address="${3:-127.0.0.1}" port="$4" i
- case "$param" in
- add)
- if [ "$force_dns" -ne 0 ]; then
- for i in $canaryDomains; do
- uci_add_list_if_new 'dhcp' "$cfg" 'server' "/${i}/"
- done
- fi
- case $address in
- 0.0.0.0|::ffff:0.0.0.0) address='127.0.0.1';;
- ::) address='::1';;
- esac
- uci_add_list_if_new 'dhcp' "$cfg" 'server' "${address}#${port}"
- ;;
- remove)
- eval "$(ubus call service list "{ 'verbose': true, 'name': '$packageName' }" | jsonfilter -F '# ' -e 'TUPLES=@[*].instances[*].command[4,6]')"
- for i in $TUPLES; do
- uci_remove_list 'dhcp' "$cfg" 'server' "$i"
- done
- for i in $canaryDomains; do
- uci_remove_list 'dhcp' "$cfg" 'server' "/${i}/"
- done
- ;;
- esac
-}
-
-dnsmasq_create_server_backup() {
- local cfg="$1" i
- [ -n "$(uci_get 'dhcp' "$cfg")" ] || return 1
- if [ -z "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" ]; then
- if [ -z "$(uci_get 'dhcp' "$cfg" 'noresolv')" ]; then
- uci_set 'dhcp' "$cfg" 'doh_backup_noresolv' '-1'
- else
- uci_set 'dhcp' "$cfg" 'doh_backup_noresolv' "$(uci_get 'dhcp' "$cfg" noresolv)"
- fi
- uci_set 'dhcp' "$cfg" 'noresolv' 1
- fi
- if [ -z "$(uci_get 'dhcp' "$cfg" 'doh_backup_server')" ]; then
- if [ -z "$(uci_get 'dhcp' "$cfg" 'server')" ]; then
- uci_add_list 'dhcp' "$cfg" 'doh_backup_server' ""
- fi
- for i in $(uci_get 'dhcp' "$cfg" 'server'); do
- uci_add_list 'dhcp' "$cfg" 'doh_backup_server' "$i"
- if [ "$i" = "$(echo "$i" | tr -d /\#)" ]; then
- uci_remove_list 'dhcp' "$cfg" 'server' "$i"
- fi
- done
- fi
- return 0
-}
-
-dnsmasq_restore_server_backup() {
- local cfg="$1" i
- [ -n "$(uci_get 'dhcp' "$cfg")" ] || return 0
- if [ -n "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" ]; then
- if [ "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" = "-1" ]; then
- uci_remove 'dhcp' "$cfg" 'noresolv'
- else
- uci_set 'dhcp' "$cfg" 'noresolv' "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')"
- fi
- uci_remove 'dhcp' "$cfg" 'doh_backup_noresolv'
- fi
- if uci_get 'dhcp' "$cfg" 'doh_backup_server' >/dev/null 2>&1; then
- dnsmasq_doh_server "$cfg" 'remove'
- for i in $(uci_get 'dhcp' "$cfg" 'doh_backup_server'); do
- uci_add_list_if_new 'dhcp' "$cfg" 'server' "$i"
- done
- uci_remove 'dhcp' "$cfg" 'doh_backup_server'
- fi
-}
-
-dhcp_backup() {
- local i
- config_load 'dhcp'
- case "$1" in
- create)
- if [ "$dnsmasq_config_update" = "*" ]; then
- config_foreach dnsmasq_create_server_backup 'dnsmasq'
- elif [ -n "$dnsmasq_config_update" ]; then
- for i in $dnsmasq_config_update; do
- if [ -n "$(uci_get 'dhcp' "@dnsmasq[$i]")" ]; then
- dnsmasq_create_server_backup "@dnsmasq[$i]"
- elif [ -n "$(uci_get 'dhcp' "$i")" ]; then
- dnsmasq_create_server_backup "$i"
- fi
- done
- fi
- ;;
- restore)
- config_foreach dnsmasq_restore_server_backup 'dnsmasq'
- ;;
- esac
-}
include $(TOPDIR)/rules.mk
PKG_NAME:=knot-resolver
-PKG_VERSION:=5.5.3
+PKG_VERSION:=5.7.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-resolver
-PKG_HASH:=a38f57c68b7d237d662784d8406e6098aad66a148f44dcf498d1e9664c5fed2d
+PKG_HASH:=383ef6db1cccabd2dd788ea9385f05e98a2bafdfeb7f0eda57ff9d572f4fad71
PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec1@gmail.com>
PKG_LICENSE:=GPL-3.0-later
+##endif
gnutls = dependency('gnutls')
luajit = dependency('luajit')
- # NOTE avoid using link_args for luajit due to a macOS issue
+ message('------------------------------')
PKG_NAME:=modemmanager
PKG_SOURCE_VERSION:=1.20.6
-PKG_RELEASE:=12
+PKG_RELEASE:=13
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/system-services/org.freedesktop.ModemManager1.service $(1)/usr/share/dbus-1/system-services
$(INSTALL_DIR) $(1)/usr/share/ModemManager
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ModemManager/*.conf $(1)/usr/share/ModemManager
+ $$(if $$(wildcard $(PKG_INSTALL_DIR)/usr/share/ModemManager/*.conf),$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ModemManager/*.conf $(1)/usr/share/ModemManager,)
$(INSTALL_DATA) ./files/modemmanager.common $(1)/usr/share/ModemManager
$(INSTALL_DIR) $(1)/usr/share/ModemManager/fcc-unlock.available.d
CFG=$(mm_get_modem_config "${MODEM_DEVICE}")
[ -n "${CFG}" ] || exit 3
-logger -t "modemmanager" "interface ${CFG} (network device ${INTERFACE}) ${STATE}"
-proto_init_update $INTERFACE 0
-proto_send_update $CFG
+IFUP=$(ifstatus "${CFG}" | jsonfilter -e "@.up")
+
+[ "${IFUP}" = "true" ] && {
+ logger -t "modemmanager" "interface ${CFG} (network device ${INTERFACE}) ${STATE}"
+ proto_init_update $INTERFACE 0
+ proto_send_update $CFG
+}
+
exit 0
proto_send_update "${interface}"
}
-modemmanager_disconnected_method_common() {
- local interface="$1"
-
- echo "running disconnection (common)"
-
- proto_init_update "*" 0
- proto_send_update "${interface}"
-}
-
proto_modemmanager_init_config() {
available=1
no_device=1
# disconnection handling only requires special treatment in IPv4/PPP
[ "${bearermethod_ipv4}" = "ppp" ] && modemmanager_disconnected_method_ppp_ipv4 "${interface}"
- modemmanager_disconnected_method_common "${interface}"
# disconnect
mmcli --modem="${device}" --simple-disconnect ||
# low power, only if requested
[ "${lowpower:-0}" -lt 1 ] ||
mmcli --modem="${device}" --set-power-state-low
-
- proto_init_update "*" 0
- proto_send_update "$interface"
}
[ -n "$INCLUDE_ONLY" ] || {
include $(TOPDIR)/rules.mk
PKG_NAME:=pdns
-PKG_VERSION:=4.8.1
+PKG_VERSION:=4.8.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://downloads.powerdns.com/releases/
-PKG_HASH:=66dd3ee2654f42b4eb80260f94ecb48e313a81817f58125ce48c14c2d26e309e
+PKG_HASH:=3b173fda4c51bb07b5a51d8c599eedd7962a02056b410e3c9d9d69ed97be35b9
PKG_MAINTAINER:=Peter van Dijk <peter.van.dijk@powerdns.com>
PKG_LICENCE:=GPL-2.0-only
+++ /dev/null
-# Copyright 2017-2022 Stan Grishin (stangri@melmac.ca)
-# TLD optimization written by Dirk Brenken (dev@brenken.org)
-# This is free software, licensed under the GNU General Public License v3.
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=simple-adblock
-PKG_VERSION:=1.9.5
-PKG_RELEASE:=5
-PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
-PKG_LICENSE:=GPL-3.0-or-later
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/simple-adblock
- SECTION:=net
- CATEGORY:=Network
- TITLE:=Simple AdBlock Service
- URL:=https://docs.openwrt.melmac.net/simple-adblock/
- DEPENDS:=+jshn +wget
- PKGARCH:=all
-endef
-
-define Package/simple-adblock/description
-Simple adblock script to block ad or abuse/malware domains with DNSMASQ or Unbound.
-Script supports local/remote list of domains and hosts-files for both block-listing and allow-listing.
-Please see https://docs.openwrt.melmac.net/simple-adblock/ for more information.
-endef
-
-define Package/simple-adblock/conffiles
-/etc/config/simple-adblock
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
-endef
-
-define Package/simple-adblock/install
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_DIR) $(1)/etc/config
- $(INSTALL_DIR) $(1)/tmp
- $(INSTALL_BIN) ./files/simple-adblock.init $(1)/etc/init.d/simple-adblock
- $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/simple-adblock
- $(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
- $(INSTALL_DATA) ./files/simple-adblock.conf.update $(1)/tmp/simple-adblock.conf.update
-endef
-
-define Package/simple-adblock/postinst
- #!/bin/sh
- # check if we are on real system
- if [ -z "$${IPKG_INSTROOT}" ]; then
- sed -f /tmp/simple-adblock.conf.update -i /etc/config/simple-adblock || true
- /etc/init.d/simple-adblock enable
- fi
- exit 0
-endef
-
-define Package/simple-adblock/prerm
- #!/bin/sh
- # check if we are on real system
- if [ -z "$${IPKG_INSTROOT}" ]; then
- echo "Stopping service and removing rc.d symlink for simple-adblock"
- /etc/init.d/simple-adblock stop || true
- /etc/init.d/simple-adblock killcache || true
- /etc/init.d/simple-adblock disable || true
- fi
- exit 0
-endef
-
-$(eval $(call BuildPackage,simple-adblock))
+++ /dev/null
-# README
-
-README has been moved to [https://docs.openwrt.melmac.net/simple-adblock/](https://docs.openwrt.melmac.net/simple-adblock/).
+++ /dev/null
-config simple-adblock 'config'
- option enabled '0'
- list allowed_domain 'cdn.jsdelivr.net'
- option allow_non_ascii '0'
- option canary_domains_icloud '0'
- option canary_domains_mozilla '0'
- option compressed_cache '0'
- option compressed_cache_dir '/etc'
- option config_update_enabled '0'
- option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update'
- option curl_additional_param ''
- option curl_max_file_size '30000000'
- option curl_retry '3'
- option download_timeout '10'
- option debug '0'
- option dns 'dnsmasq.servers'
- option dns_instance '0'
- option force_dns '1'
- list force_dns_port '53'
- list force_dns_port '853'
-# ports listed below are used by some
-# of the dnscrypt-proxy v1 resolvers
-# list force_dns_port '553'
-# list force_dns_port '1443'
-# list force_dns_port '4343'
-# list force_dns_port '4434'
-# list force_dns_port '5443'
-# list force_dns_port '8443'
- option led 'none'
- option parallel_downloads '1'
- option procd_trigger_wan6 '0'
- option procd_boot_wan_timeout '60'
- option verbosity '2'
-
-# File size: 16.0K
- list blocked_hosts_url 'https://adaway.org/hosts.txt'
-
-# File size: 20.0K
- list blocked_hosts_url 'https://cdn.jsdelivr.net/gh/hoshsadiq/adblock-nocoin-list/hosts.txt'
-
-# File size: 80.0K
- list blocked_hosts_url 'https://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'
-
-# File size: 388.0K
-# block-list may be too big for some routers
-# block-list may block some video-streaming content
-# list blocked_hosts_url 'https://cdn.jsdelivr.net/gh/jawz101/MobileAdTrackers/hosts'
-
-# File size: 424.0K
-# block-list may be too big for some routers
- list blocked_hosts_url 'https://winhelp2002.mvps.org/hosts.txt'
-
-# File size: 432.0K
-# block-list may be too big for some routers
- list blocked_hosts_url 'https://someonewhocares.org/hosts/hosts'
-
-# File size: 624.0K
-# block-list too big for most routers
-# list blocked_hosts_url 'http://sysctl.org/cameleon/hosts'
-
-# File size: 1.4M
-# block-list too big for most routers
-# list blocked_adblockplus_url 'https://small.oisd.nl/'
-
-# File size: 1.6M
-# block-list too big for most routers
-# list blocked_hosts_url 'https://cdn.jsdelivr.net/gh/StevenBlack/hosts/hosts'
-
-# File size: 2.0M
-# block-list too big for most routers
-# list blocked_domains_url https://cdn.jsdelivr.net/gh/bongochong/CombinedPrivacyBlockLists/NoFormatting/cpbl-ctld.txt
-
-# File size: 3.1M
-# block-list too big for most routers
-# list blocked_hosts_url 'https://hostsfile.mine.nu/Hosts'
-
-# File size: 8.3M
-# enabling this will disable processing of any other block/allow-lists
-# option dnsmasq_config_file_url 'https://dnsmasq.oisd.nl/'
-
-# File size: 5.0M
-# block-list may be too big for some routers
-# list blocked_domains_url 'https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_trackers_justdomains.txt'
-
-# File size: 6.2M
-# block-list too big for most routers
-# list blocked_adblockplus_url 'https://nsfw.oisd.nl/'
-
-# File size: 6.2M
-# block-list too big for most routers
-# list blocked_adblockplus_url 'https://big.oisd.nl/'
-
-# File size: 1.5M
-# block-list too big for most routers
-# list blocked_domains_url 'https://small.oisd.nl/domains'
-
-# File size: 7.8M
-# block-list too big for most routers
-# list blocked_domains_url 'https://nsfw.oisd.nl/domains'
-
-# File size: 19.9M
-# block-list too big for most routers
-# list blocked_domains_url 'https://big.oisd.nl/domains'
-
-# site was down on last check
-# list blocked_domains_url 'http://support.it-mate.co.uk/downloads/hosts.txt'
+++ /dev/null
-s|whitelist_domains_url|allowed_domains_url|g
-s|whitelist_domain|allowed_domain|g
-s|blacklist_hosts_url|blocked_hosts_url|g
-s|blacklist_domains_url|blocked_domains_url|g
-s|blacklist_domain|blocked_domain|g
-s|ssl.bblck.me|cdn.jsdelivr.net/gh/paulgb/BarbBlock|g
-s|raw.githubusercontent.com/StevenBlack/hosts/|cdn.jsdelivr.net/gh/StevenBlack/hosts@|g
-s|raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/|cdn.jsdelivr.net/gh/hoshsadiq/adblock-nocoin-list@|g
-s|raw.githubusercontent.com/jawz101/MobileAdTrackers/|cdn.jsdelivr.net/gh/jawz101/MobileAdTrackers@|g
-s|http://winhelp2002.mvps.org/hosts.txt|https://winhelp2002.mvps.org/hosts.txt|g
-s|list blocked_domains_url 'https://dbl.oisd.nl/basic'|list blocked_adblockplus_url 'https://small.oisd.nl/'|g
-s|list blocked_domains_url 'https://dbl.oisd.nl/nsfw'|list blocked_adblockplus_url 'https://nsfw.oisd.nl/'|g
-s|list blocked_domains_url 'https://dbl.oisd.nl/'|list blocked_adblockplus_url 'https://big.oisd.nl/'|g
-s|list blocked_hosts_url 'https://hosts.oisd.nl/basic'|list blocked_adblockplus_url 'https://small.oisd.nl/'|g
-s|list blocked_hosts_url 'https://hosts.oisd.nl/nsfw'|list blocked_adblockplus_url 'https://nsfw.oisd.nl/'|g
-s|list blocked_hosts_url 'https://hosts.oisd.nl/'|list blocked_adblockplus_url 'https://big.oisd.nl/'|g
-\|dshield.org|d
-\|www.malwaredomainlist.com/hostslist/hosts.txt|d
-\|https://mirror1.malwaredomains.com/files/justdomains|d
-\|lists.disconnect.me|d
-\|https://cdn.jsdelivr.net/gh/paulgb/BarbBlock/blacklists/domain-list.txt|d
-\|dnsmasq.oisd.nl|d
-\|dnsmasq2.oisd.nl|d
-\|https://cdn.jsdelivr.net/gh/AdguardTeam/cname-trackers@master/combined_disguised_trackers_justdomains.txt|d
+++ /dev/null
-#!/bin/sh
-
-if [ "$ACTION" = "ifup" ]; then
- sleep 10 && /etc/init.d/simple-adblock start hotplug &
-fi
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright 2017-2022 Stan Grishin (stangri@melmac.ca)
-# shellcheck disable=SC1091,SC2016,SC3043,SC3057,SC3060
-
-# shellcheck disable=SC2034
-START=94
-# shellcheck disable=SC2034
-USE_PROCD=1
-LC_ALL=C
-
-if type extra_command 1>/dev/null 2>&1; then
- extra_command 'allow' 'Allows domain in current block-list and config'
- extra_command 'check' 'Checks if specified domain is found in current block-list'
- extra_command 'dl' 'Force-downloads all enabled block-list'
- extra_command 'killcache' 'Delete all cached files'
- extra_command 'pause' 'Pauses AdBlocking for specified number of seconds (default: 60)'
- extra_command 'sizes' 'Displays the file-sizes of enabled block-lists'
- extra_command 'version' 'Show version information'
-else
-# shellcheck disable=SC2034
- EXTRA_COMMANDS='allow check dl killcache pause sizes status_service version'
-# shellcheck disable=SC2034
- EXTRA_HELP=' allow Allows domain(s) in current block-list and config
- check Checks if specified domain is found in current block-list
- dl Force-downloads all enabled block-list
- pause Pauses AdBlocking for specified number of seconds (default: 60)
- sizes Displays the file-sizes of enabled block-lists'
-fi
-
-readonly PKG_VERSION='dev-test'
-readonly packageName='simple-adblock'
-readonly serviceName="$packageName $PKG_VERSION"
-readonly packageConfigFile="/etc/config/${packageName}"
-readonly dnsmasqAddnhostsFile="/var/run/${packageName}/dnsmasq.addnhosts"
-readonly dnsmasqAddnhostsCache="/var/run/${packageName}/dnsmasq.addnhosts.cache"
-readonly dnsmasqAddnhostsGzip="${packageName}.dnsmasq.addnhosts.gz"
-readonly dnsmasqAddnhostsFilter='s|^|127.0.0.1 |;s|$||'
-readonly dnsmasqAddnhostsFilterIPv6='s|^|:: |;s|$||'
-readonly dnsmasqConfFile="/tmp/dnsmasq.d/${packageName}"
-readonly dnsmasqConfCache="/var/run/${packageName}/dnsmasq.conf.cache"
-readonly dnsmasqConfGzip="${packageName}.dnsmasq.conf.gz"
-readonly dnsmasqConfFilter='s|^|local=/|;s|$|/|'
-readonly dnsmasqIpsetFile="/tmp/dnsmasq.d/${packageName}.ipset"
-readonly dnsmasqIpsetCache="/var/run/${packageName}/dnsmasq.ipset.cache"
-readonly dnsmasqIpsetGzip="${packageName}.dnsmasq.ipset.gz"
-readonly dnsmasqIpsetFilter='s|^|ipset=/|;s|$|/adb|'
-readonly dnsmasqNftsetFile="/tmp/dnsmasq.d/${packageName}.nftset"
-readonly dnsmasqNftsetCache="/var/run/${packageName}/dnsmasq.nftset.cache"
-readonly dnsmasqNftsetGzip="${packageName}.dnsmasq.nftset.gz"
-readonly dnsmasqNftsetFilter='s|^|nftset=/|;s|$|/4#inet#fw4#adb4|'
-readonly dnsmasqNftsetFilterIPv6='s|^|nftset=/|;s|$|/4#inet#fw4#adb4,6#inet#fw4#adb6|'
-readonly dnsmasqServersFile="/var/run/${packageName}/dnsmasq.servers"
-readonly dnsmasqServersCache="/var/run/${packageName}/dnsmasq.servers.cache"
-readonly dnsmasqServersGzip="${packageName}.dnsmasq.servers.gz"
-readonly dnsmasqServersFilter='s|^|server=/|;s|$|/|'
-readonly unboundFile="/var/lib/unbound/adb_list.${packageName}"
-readonly unboundCache="/var/run/${packageName}/unbound.cache"
-readonly unboundGzip="${packageName}.unbound.gz"
-readonly unboundFilter='s|^|local-zone: "|;s|$|" static|'
-readonly A_TMP="/var/${packageName}.hosts.a.tmp"
-readonly B_TMP="/var/${packageName}.hosts.b.tmp"
-readonly jsonFile="/var/run/${packageName}/${packageName}.json"
-readonly sharedMemoryError="/dev/shm/$packageName-error"
-readonly hostsFilter='/localhost/d;/^#/d;/^[^0-9]/d;s/^0\.0\.0\.0.//;s/^127\.0\.0\.1.//;s/[[:space:]]*#.*$//;s/[[:cntrl:]]$//;s/[[:space:]]//g;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;/[^[:alnum:]_.-]/d;'
-readonly domainsFilter='/^#/d;s/[[:space:]]*#.*$//;s/[[:space:]]*$//;s/[[:cntrl:]]$//;/[[:space:]]/d;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;/[^[:alnum:]_.-]/d;'
-readonly adBlockPlusFilter='/^#/d;/^!/d;s/[[:space:]]*#.*$//;s/^||//;s/\^$//;s/[[:space:]]*$//;s/[[:cntrl:]]$//;/[[:space:]]/d;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;/[^[:alnum:]_.-]/d;'
-readonly dnsmasqFileFilter='\|^server=/[[:alnum:]_.-].*/|!d'
-readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
-readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
-readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
-readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
-readonly _ERROR_='\033[0;31mERROR\033[0m'
-readonly _WARNING_='\033[0;33mWARNING\033[0m'
-# shellcheck disable=SC2155
-readonly ipset="$(command -v ipset)"
-# shellcheck disable=SC2155
-readonly nft="$(command -v nft)"
-readonly canaryDomainsMozilla='use-application-dns.net'
-readonly canaryDomainsiCloud='mask.icloud.com mask-h2.icloud.com'
-
-dl_command=
-dl_flag=
-isSSLSupported=
-outputFilter=
-outputFilterIPv6=
-outputFile=
-outputGzip=
-outputCache=
-awk='awk'
-load_environment_flag=
-
-debug() { local i j; for i in "$@"; do eval "j=\$$i"; echo "${i}: ${j} "; done; }
-
-uci_add_list_if_new() {
- local PACKAGE="$1"
- local CONFIG="$2"
- local OPTION="$3"
- local VALUE="$4"
- local i
- [ -n "$PACKAGE" ] && [ -n "$CONFIG" ] && [ -n "$OPTION" ] && [ -n "$VALUE" ] || return 1
- for i in $(uci_get "$PACKAGE" "$CONFIG" "$OPTION"); do
- [ "$i" = "$VALUE" ] && return 0
- done
- uci_add_list "$PACKAGE" "$CONFIG" "$OPTION" "$VALUE"
-}
-uci_changes() {
- local PACKAGE="$1"
- local CONFIG="$2"
- local OPTION="$3"
- /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
-}
-
-ipset() { "$ipset" "$@" >/dev/null 2>&1; }
-nft() { "$nft" "$@" >/dev/null 2>&1; }
-
-get_text() {
- local r
- case "$1" in
- errorConfigValidationFail) r="$packageName config validation failed";;
- errorServiceDisabled) r="$packageName is currently disabled";;
- errorNoDnsmasqIpset)
- r="dnsmasq ipset support is enabled in $packageName, but dnsmasq is either not installed or installed dnsmasq does not support ipset";;
- errorNoIpset)
- r="dnsmasq ipset support is enabled in $packageName, but ipset is either not installed or installed ipset does not support 'hash:net' type";;
- errorNoDnsmasqNftset)
- r="dnsmasq nft set support is enabled in $packageName, but dnsmasq is either not installed or installed dnsmasq does not support nft set";;
- errorNoNft) r="dnsmasq nft sets support is enabled in $packageName, but nft is not installed";;
- errorNoWanGateway) r="The ${serviceName} failed to discover WAN gateway";;
- errorOutputDirCreate) r="failed to create directory for %s file";;
- errorOutputFileCreate) r="failed to create $outputFile file";;
- errorFailDNSReload) r="failed to restart/reload DNS resolver";;
- errorSharedMemory) r="failed to access shared memory";;
- errorSorting) r="failed to sort data file";;
- errorOptimization) r="failed to optimize data file";;
- errorAllowListProcessing) r="failed to process allow-list";;
- errorDataFileFormatting) r="failed to format data file";;
- errorMovingDataFile) r="failed to move data file '${A_TMP}' to '${outputFile}'";;
- errorCreatingCompressedCache) r="failed to create compressed cache";;
- errorRemovingTempFiles) r="failed to remove temporary files";;
- errorRestoreCompressedCache) r="failed to unpack compressed cache";;
- errorRestoreCache) r="failed to move '$outputCache' to '$outputFile'";;
- errorOhSnap) r="failed to create block-list or restart DNS resolver";;
- errorStopping) r="failed to stop $serviceName";;
- errorDNSReload) r="failed to reload/restart DNS resolver";;
- errorDownloadingConfigUpdate) r="failed to download Config Update file";;
- errorDownloadingList) r="failed to download";;
- errorParsingConfigUpdate) r="failed to parse Config Update file";;
- errorParsingList) r="failed to parse";;
- errorNoSSLSupport) r="no HTTPS/SSL support on device";;
- errorCreatingDirectory) r="failed to create output/cache/gzip file directory";;
-
- statusNoInstall) r="$serviceName is not installed or not found";;
- statusStopped) r="Stopped";;
- statusStarting) r="Starting";;
- statusRestarting) r="Restarting";;
- statusForceReloading) r="Force Reloading";;
- statusDownloading) r="Downloading";;
- statusProcessing) r="Processing";;
- statusError) r="Error";;
- statusWarning) r="Warning";;
- statusFail) r="Fail";;
- statusSuccess) r="Success";;
-
- warningExternalDnsmasqConfig)
- r="use of external dnsmasq config file detected, please set 'dns' option to 'dnsmasq.conf'";;
- warningMissingRecommendedPackages) r="Some recommended packages are missing";;
- warningInvalidCompressedCacheDir) r="invalid compressed cache directory '%s'";;
- esac
- echo "$r"
-}
-
-output_ok() { output 1 "$_OK_"; output 2 "$__OK__\\n"; }
-output_okn() { output 1 "$_OK_\\n"; output 2 "$__OK__\\n"; }
-output_fail() { output 1 "$_FAIL_"; output 2 "$__FAIL__\\n"; }
-output_failn() { output 1 "$_FAIL_\\n"; output 2 "$__FAIL__\\n"; }
-str_replace() { printf "%b" "$1" | sed -e "s/$(printf "%b" "$2")/$(printf "%b" "$3")/g"; }
-str_contains() { test "$1" != "$(str_replace "$1" "$2" '')"; }
-is_greater() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
-is_greater_or_equal() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$2"; }
-is_chaos_calmer() { ubus -S call system board | grep -q 'Chaos Calmer'; }
-led_on(){ if [ -n "${1}" ] && [ -e "${1}/trigger" ]; then echo 'default-on' > "${1}/trigger" 2>&1; fi; }
-led_off(){ if [ -n "${1}" ] && [ -e "${1}/trigger" ]; then echo 'none' > "${1}/trigger" 2>&1; fi; }
-dnsmasq_hup() { killall -q -s HUP dnsmasq; }
-dnsmasq_kill() { killall -q -s KILL dnsmasq; }
-dnsmasq_restart() { /etc/init.d/dnsmasq restart >/dev/null 2>&1; }
-unbound_restart() { /etc/init.d/unbound restart >/dev/null 2>&1; }
-is_present() { command -v "$1" >/dev/null 2>&1; }
-sanitize_dir() { [ -d "$(readlink -fn "$1")" ] && readlink -fn "$1"; }
-
-output() {
-# Can take a single parameter (text) to be output at any verbosity
-# Or target verbosity level and text to be output at specifc verbosity
- local msg memmsg logmsg
- local sharedMemoryOutput="/dev/shm/$packageName-output"
- verbosity="${verbosity:-2}"
- if [ $# -ne 1 ]; then
- if [ $((verbosity & $1)) -gt 0 ] || [ "$verbosity" = "$1" ]; then shift; else return 0; fi
- fi
- [ -t 1 ] && printf "%b" "$1"
- msg="${1//$serviceName /service }";
- if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
- [ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
- logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
- logger -t "${packageName:-service} [$$]" "$(printf "%b" "$logmsg")"
- rm -f "$sharedMemoryOutput"
- else
- printf "%b" "$msg" >> "$sharedMemoryOutput"
- fi
-}
-
-load_network() {
- local param="$1"
- local i j wan_if wan_gw wan_proto
- local counter wan_if_timeout="$procd_boot_wan_timeout" wan_gw_timeout='5'
- counter=0
- while [ -z "$wan_if" ]; do
- network_flush_cache
- network_find_wan wan_if
- if [ -n "$wan_if" ]; then
- output "WAN interface found: '${wan_if}'.\\n"
- break
- fi
- if [ "$counter" -gt "$wan_if_timeout" ]; then
- output "WAN interface timeout, assuming 'wan'.\\n"
- wan_if='wan'
- break
- fi
- counter=$((counter+1))
- output "Waiting to discover WAN Interface...\\n"
- sleep 1
- done
-
- counter=0
- wan_proto="$(uci -q get "network.${wan_if}.proto")"
- if [ "$wan_proto" = 'pppoe' ]; then
- wan_gw_timeout=$((wan_gw_timeout+10))
- fi
- while [ "$counter" -le "$wan_gw_timeout" ]; do
- network_flush_cache
- network_get_gateway wan_gw "$wan_if"
- if [ -n "$wan_gw" ]; then
- output "WAN gateway found: '${wan_gw}.'\\n"
- return 0
- fi
- counter=$((counter+1))
- output "Waiting to discover $wan_if gateway...\\n"
- sleep 1
- done
- json add error "errorNoWanGateway"
- output "${_ERROR_}: $(get_text 'errorNoWanGateway')!\\n"; return 1;
-}
-
-load_environment() {
- local i j
- local validation_result="$1" param="$2"
-
- [ -z "$load_environment_flag" ] || return 0
-
- if [ "$validation_result" != '0' ]; then
- json add error "errorConfigValidationFail"
- output "${_ERROR_}: $(get_text 'errorConfigValidationFail')!\\n"
- output "Please check if the '$packageConfigFile' contains correct values for config options.\\n"
- return 1
- fi
-
- if [ "$enabled" -eq 0 ]; then
- json add error "errorServiceDisabled"
- output "${_ERROR_}: $(get_text 'errorServiceDisabled')!\\n"
- output "Run the following commands before starting service again:\\n"
- output "uci set ${packageName}.config.enabled='1'; uci commit $packageName;\\n"
- return 1
- fi
-
- if [ "$debug" -ne 0 ]; then
- exec 1>>/tmp/simple-adblock.log
- exec 2>&1
- set -x
- fi
-
- if [ -n "$dnsmasq_config_file_url" ]; then
- case "$dns" in
- dnsmasq.conf) :;;
- *)
- if [ "$param" != 'quiet' ]; then
- json add warning "warningExternalDnsmasqConfig"
- output "${_WARNING_}: $(get_text 'warningExternalDnsmasqConfig')!\\n"
- fi
- ;;
- esac
- fi
-
- case "$dns" in
- dnsmasq.addnhosts|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|dnsmasq.servers)
- if dnsmasq -v 2>/dev/null | grep -q 'no-IDN' || ! dnsmasq -v 2>/dev/null | grep -q -w 'IDN'; then
- allow_non_ascii=0
- fi
- ;;
- unbound.adb_list)
- allow_non_ascii=1;;
- esac
-
- case "$dns" in
- dnsmasq.ipset)
- if dnsmasq -v 2>/dev/null | grep -q 'no-ipset' || ! dnsmasq -v 2>/dev/null | grep -q -w 'ipset'; then
- if [ "$param" != 'quiet' ]; then
- json add error "errorNoDnsmasqIpset"
- output "${_ERROR_}: $(get_text 'errorNoDnsmasqIpset')!\\n"
- fi
- dns='dnsmasq.servers'
- fi
- if ! ipset help hash:net; then
- if [ "$param" != 'quiet' ]; then
- json add error "errorNoIpset"
- output "${_ERROR_}: $(get_text 'errorNoIpset')!\\n"
- fi
- dns='dnsmasq.servers'
- fi
- ;;
- dnsmasq.nftset)
- if dnsmasq -v 2>/dev/null | grep -q 'no-nftset' || ! dnsmasq -v 2>/dev/null | grep -q -w 'nftset'; then
- if [ "$param" != 'quiet' ]; then
- json add error "errorNoDnsmasqNftset"
- output "${_ERROR_}: $(get_text 'errorNoDnsmasqNftset')!\\n"
- fi
- dns='dnsmasq.servers'
- fi
- if [ -z "$nft" ]; then
- if [ "$param" != 'quiet' ]; then
- json add error "errorNoNft"
- output "${_ERROR_}: $(get_text 'errorNoNft')!\\n"
- fi
- dns='dnsmasq.servers'
- fi
- ;;
- esac
-
- if [ "$(sanitize_dir "$compressed_cache_dir")" = '/' ]; then
- compressed_cache_dir=''
- elif [ -n "$(sanitize_dir "$compressed_cache_dir")" ]; then
- compressed_cache_dir="$(sanitize_dir "$compressed_cache_dir")"
- else
- json add warning 'warningInvalidCompressedCacheDir' "$compressed_cache_dir"
- compressed_cache_dir="/etc"
- fi
-
- case "$dns" in
- dnsmasq.addnhosts)
- outputFilter="$dnsmasqAddnhostsFilter"
- outputFile="$dnsmasqAddnhostsFile"
- outputCache="$dnsmasqAddnhostsCache"
- outputGzip="${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- if [ "$ipv6_enabled" -ne 0 ]; then
- outputFilterIPv6="$dnsmasqAddnhostsFilterIPv6"
- fi
- rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
- rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
- ;;
- dnsmasq.conf)
- outputFilter="$dnsmasqConfFilter"
- outputFile="$dnsmasqConfFile"
- outputCache="$dnsmasqConfCache"
- outputGzip="${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
- rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
- ;;
- dnsmasq.ipset)
- outputFilter="$dnsmasqIpsetFilter"
- outputFile="$dnsmasqIpsetFile"
- outputCache="$dnsmasqIpsetCache"
- outputGzip="${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
- rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
- ;;
- dnsmasq.nftset)
- if [ "$ipv6_enabled" -ne 0 ]; then
- outputFilter="$dnsmasqNftsetFilterIPv6"
- else
- outputFilter="$dnsmasqNftsetFilter"
- fi
- outputFile="$dnsmasqNftsetFile"
- outputCache="$dnsmasqNftsetCache"
- outputGzip="${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
- rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
- ;;
- dnsmasq.servers)
- outputFilter="$dnsmasqServersFilter"
- outputFile="$dnsmasqServersFile"
- outputCache="$dnsmasqServersCache"
- outputGzip="${compressed_cache_dir}/${dnsmasqServersGzip}"
- rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
- ;;
- unbound.adb_list)
- outputFilter="$unboundFilter"
- outputFile="$unboundFile"
- outputCache="$unboundCache"
- outputGzip="$unboundGzip"
- rm -f "$dnsmasqAddnhostsFile" "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- rm -f "$dnsmasqConfFile" "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqIpsetFile" "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqNftsetFile" "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$dnsmasqServersFile" "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
- ;;
- esac
-
- for i in "$jsonFile" "$outputFile" "$outputCache" "$outputGzip"; do
- if ! mkdir -p "$(dirname "$i")"; then
- if [ "$param" != 'quiet' ]; then
- json add error "errorOutputDirCreate" "$i"
- output "${_ERROR_}: $(get_text 'errorOutputDirCreate' "$i")!\\n"
- fi
- fi
- done
-
- is_present 'gawk' && awk='gawk'
- if ! is_present '/usr/libexec/grep-gnu' || ! is_present '/usr/libexec/sed-gnu' || \
- ! is_present '/usr/libexec/sort-coreutils' || ! is_present 'gawk'; then
- local s="opkg update; opkg --force-overwrite install"
- is_present 'gawk' || s="$s gawk"
- is_present '/usr/libexec/grep-gnu' || s="$s grep"
- is_present '/usr/libexec/sed-gnu' || s="$s sed"
- is_present '/usr/libexec/sort-coreutils' || s="$s coreutils-sort"
- if [ "$param" != 'quiet' ]; then
- json add warning "warningMissingRecommendedPackages" "${i}"
- output "${_WARNING_}: $(get_text 'warningMissingRecommendedPackages'), install them by running:\\n"
- output "$s;\\n"
- fi
- fi
- # Prefer curl because it supports the file:// scheme.
- if is_present 'curl'; then
- dl_command="curl --silent --insecure"
- dl_command="${dl_command}${curl_additional_param:+ $curl_additional_param}"
- dl_command="${dl_command}${curl_max_file_size:+ --max-filesize $curl_max_file_size}"
- dl_command="${dl_command}${curl_retry:+ --retry $curl_retry}"
- dl_command="${dl_command}${download_timeout:+ --connect-timeout $download_timeout}"
- dl_flag="-o"
- elif is_present '/usr/libexec/wget-ssl'; then
- dl_command="/usr/libexec/wget-ssl --no-check-certificate -q"
- dl_command="${dl_command}${download_timeout:+ --timeout $download_timeout}"
- dl_flag="-O"
- elif is_present wget && wget --version 2>/dev/null | grep -q "+https"; then
- dl_command="wget --no-check-certificate -q"
- dl_command="${dl_command}${download_timeout:+ --timeout $download_timeout}"
- dl_flag="-O"
- else
- dl_command="uclient-fetch --no-check-certificate -q"
- dl_command="${dl_command}${download_timeout:+ --timeout $download_timeout}"
- dl_flag="-O"
- fi
- led="${led:+/sys/class/leds/$led}"
- if curl --version 2>/dev/null | grep -q "https" \
- || wget --version 2>/dev/null | grep -q "+https" \
- || grep -q "libustream-mbedtls" /usr/lib/opkg/status \
- || grep -q "libustream-openssl" /usr/lib/opkg/status \
- || grep -q "libustream-wolfssl" /usr/lib/opkg/status; then
- isSSLSupported=1
- else
- unset isSSLSupported
- fi
- load_environment_flag=1
- cache 'test' && return 0
- cache 'test_gzip' && return 0
- if [ "$param" = 'on_boot' ]; then
- load_network "$param"
- return "$?"
- else
- return 0
- fi
-}
-
-resolver() {
- local cfg="$1" param="$2"
- case "$param" in
- dnsmasq.addnhosts)
- if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then
- uci_remove 'dhcp' "$cfg" 'serversfile'
- fi
- uci_add_list_if_new 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile"
- ;;
- cleanup|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|unbound.adb_list)
- uci_remove_list 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile"
- if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then
- uci_remove 'dhcp' "$cfg" 'serversfile'
- fi
- ;;
- dnsmasq.servers)
- uci_remove_list 'dhcp' "$cfg" 'addnhosts' "$dnsmasqAddnhostsFile"
- if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" != "$dnsmasqServersFile" ]; then
- uci_set 'dhcp' "$cfg" 'serversfile' "$dnsmasqServersFile"
- fi
- ;;
- esac
-}
-
-dns() {
- local param output_text i
- case $1 in
- on_start)
- if [ ! -s "$outputFile" ]; then
- json set status "statusFail"
- json add error "errorOutputFileCreate"
- output "${_ERROR_}: $(get_text 'errorOutputFileCreate')!\\n"
- return 1
- fi
-
- config_load 'dhcp'
- if [ "$dns_instance" = "*" ]; then
- config_foreach resolver 'dnsmasq' "$dns"
- elif [ -n "$dns_instance" ]; then
- for i in $dns_instance; do
- resolver "@dnsmasq[$i]" "$dns" || resolver "$i" "$dns"
- done
- fi
-
- case "$dns" in
- dnsmasq.addnhosts|dnsmasq.servers)
- chmod 660 "$outputFile"
- chown root:dnsmasq "$outputFile"
- param=dnsmasq_restart
- output_text='Reloading dnsmasq'
- ;;
- dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset)
- chmod 660 "$outputFile"
- chown root:dnsmasq "$outputFile"
- param=dnsmasq_restart
- output_text='Restarting dnsmasq'
- ;;
- unbound.adb_list)
- param=unbound_restart
- output_text='Restarting Unbound'
- ;;
- esac
-
- if [ -n "$(uci_changes dhcp)" ]; then
- uci_commit dhcp
- if [ "$param" = 'unbound_restart' ]; then
- param='dnsmasq_restart; unbound_restart;'
- output_text='Restarting Unbound/dnsmasq'
- else
- param=dnsmasq_restart
- output_text='Restarting dnsmasq'
- fi
- fi
- output 1 "$output_text "
- output 2 "$output_text "
- json set message "$output_text"
- if eval "$param"; then
- json set status "statusSuccess"
- led_on "$led"
- output_okn
- else
- output_fail
- json set status "statusFail"
- json add error "errorDNSReload"
- output "${_ERROR_}: $(get_text 'errorDNSReload')!\\n"
- return 1
- fi
- ;;
- on_stop)
- case "$dns" in
- dnsmasq.addnhosts|dnsmasq.servers)
- param=dnsmasq_restart
- ;;
- dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset)
- param=dnsmasq_restart
- ;;
- unbound.adb_list)
- param=unbound_restart
- ;;
- esac
- if [ -n "$(uci_changes dhcp)" ]; then
- uci_commit dhcp
- if [ "$param" = 'unbound_restart' ]; then
- param='dnsmasq_restart; unbound_restart;'
- else
- param=dnsmasq_restart
- fi
- fi
- eval "$param"
- return $?
- ;;
- quiet)
- case "$dns" in
- dnsmasq.addnhosts|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|dnsmasq.servers)
- param=dnsmasq_restart
- ;;
- unbound.adb_list)
- param=unbound_restart
- ;;
- esac
- eval "$param"
- return $?
- ;;
- esac
-}
-
-json() {
-# shellcheck disable=SC2034
- local action="$1" param="$2" value="$3"
- shift 3
-# shellcheck disable=SC2124
- local extras="$@" line
- local status message error stats
- local reload restart curReload curRestart ret i
- if [ -s "$jsonFile" ]; then
- json_load_file "$jsonFile" 2>/dev/null
- json_select 'data' 2>/dev/null
- for i in status message error stats reload restart; do
- json_get_var $i "$i" 2>/dev/null
- done
- fi
- case "$action" in
- get)
- case "$param" in
- triggers)
- curReload="$parallel_downloads $debug $download_timeout $allowed_domain $blocked_domain $allowed_domains_url \
- $blocked_adblockplus_url $blocked_domains_url $blocked_hosts_url $dns $config_update_enabled $config_update_url \
- $dnsmasq_config_file_url $curl_additional_param $curl_max_file_size $curl_retry"
- curRestart="$compressed_cache $compressed_cache_dir $force_dns $led $force_dns_port"
- if [ ! -s "$jsonFile" ]; then
- ret='on_boot'
- elif [ "$curReload" != "$reload" ]; then
- ret='download'
- elif [ "$curRestart" != "$restart" ]; then
- ret='restart'
- fi
- printf "%b" "$ret"
- return;;
- *)
- printf "%b" "$(eval echo "\$$param")"; return;;
- esac
- ;;
- add)
- line="$(eval echo "\$$param")"
- eval "$param"='${line:+$line }${value}${extras:+|$extras}'
- ;;
- del)
- case "$param" in
- all)
- unset status message error stats;;
- triggers)
- unset reload restart;;
- *)
- unset "$param";;
- esac
- ;;
- set)
- case "$param" in
- triggers)
- reload="$parallel_downloads $debug $download_timeout $allowed_domain $blocked_domain $allowed_domains_url \
- $blocked_adblockplus_url $blocked_domains_url $blocked_hosts_url $dns $config_update_enabled $config_update_url \
- $dnsmasq_config_file_url $curl_additional_param $curl_max_file_size $curl_retry"
- restart="$compressed_cache $compressed_cache_dir $force_dns $led $force_dns_port"
- ;;
- *)
- eval "$param"='${value}${extras:+|$extras}';;
- esac
- ;;
- esac
- json_init
- json_add_object 'data'
- json_add_string version "$PKG_VERSION"
- json_add_string status "$status"
- json_add_string message "$message"
- json_add_string error "$error"
- json_add_string stats "$stats"
- json_add_string reload "$reload"
- json_add_string restart "$restart"
- json_close_object
- mkdir -p "$(dirname "$jsonFile")"
- json_dump > "$jsonFile"
- sync
-}
-
-cache() {
- local R_TMP
- case "$1" in
- create|backup)
- [ -s "$outputFile" ] && { mv -f "$outputFile" "$outputCache"; } >/dev/null 2>/dev/null
- return $?
- ;;
- restore|use)
- [ -s "$outputCache" ] && mv "$outputCache" "$outputFile" >/dev/null 2>/dev/null
- return $?
- ;;
- test)
- [ -s "$outputCache" ]
- return $?
- ;;
- test_gzip)
- [ -s "$outputGzip" ] && gzip -t -c "$outputGzip"
- return $?
- ;;
- create_gzip)
- rm -f "$outputGzip" >/dev/null 2>/dev/null
- R_TMP="$(mktemp -u -q -t ${packageName}_tmp.XXXXXXXX)"
- if gzip < "$outputFile" > "$R_TMP"; then
- if mv "$R_TMP" "$outputGzip"; then
- rm -f "$R_TMP"
- return 0
- else
- rm -f "$R_TMP"
- return 1
- fi
- else
- return 1
- fi
- ;;
- expand|unpack|unpack_gzip)
- [ -s "$outputGzip" ] && gzip -dc < "$outputGzip" > "$outputCache"
- return $?
- ;;
- esac
-}
-
-process_url() {
- local label type D_TMP R_TMP
- if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then return 1; fi
- label="${1##*//}"; label="${label%%/*}";
- case "$2" in
- adbp) label="ADBPlus: $label"; filter="$adBlockPlusFilter"
- ;;
- dnsmasq) label="Dnsmasq: $label"; filter="$dnsmasqFileFilter"
- ;;
- domains) label="Domains: $label"; filter="$domainsFilter"
- ;;
- hosts) label="Hosts: $label"; filter="$hostsFilter"
- ;;
- esac
- case "$3" in
- allowed) type='Allowed'; D_TMP="$A_TMP"
- ;;
- blocked) type='Blocked'; D_TMP="$B_TMP"
- ;;
- file) type='File'; D_TMP="$B_TMP"
- ;;
- esac
- if [ "${1:0:5}" = "https" ] && [ -z "$isSSLSupported" ]; then
- output 1 "$_FAIL_"
- output 2 "[DL] $type $label $__FAIL__\\n"
- echo "errorNoSSLSupport|${1}" >> "$sharedMemoryError"
- return 0
- fi
- while [ -z "$R_TMP" ] || [ -e "$R_TMP" ]; do
- R_TMP="$(mktemp -u -q -t ${packageName}_tmp.XXXXXXXX)"
- done
- if ! $dl_command "$1" "$dl_flag" "$R_TMP" 2>/dev/null || [ ! -s "$R_TMP" ]; then
- output 1 "$_FAIL_"
- output 2 "[DL] $type $label $__FAIL__\\n"
- echo "errorDownloadingList|${1}" >> "$sharedMemoryError"
- else
- sed -i "$filter" "$R_TMP"
- if [ ! -s "$R_TMP" ]; then
- output 1 "$_FAIL_"
- output 2 "[DL] $type $label $__FAIL__\\n"
- echo "errorParsingList|${1}" >> "$sharedMemoryError"
- else
- cat "${R_TMP}" >> "$D_TMP"
- output 1 "$_OK_"
- output 2 "[DL] $type $label $__OK__\\n"
- fi
- fi
- rm -f "$R_TMP"
- return 0
-}
-
-download_dnsmasq_file() {
- local hf allow_filter j=0 R_TMP
-
- json set message "$(get_text "statusDownloading")..."
- json set status "statusDownloading"
-
- rm -f "$A_TMP" "$B_TMP" "$outputFile" "$outputCache" "$outputGzip"
- if [ "$($awk '/^MemFree/ {print int($2/1000)}' "/proc/meminfo")" -lt 32 ]; then
- output 3 'Low free memory, restarting resolver '
- if dns 'quiet'; then
- output_okn
- else
- output_failn
- fi
- fi
- touch $A_TMP; touch $B_TMP;
- output 1 'Downloading dnsmasq file '
- rm -f "$sharedMemoryError"
- process_url "$dnsmasq_config_file_url" 'dnsmasq' 'file'
-# output 1 '\n'
- if [ -s "$sharedMemoryError" ]; then
- while IFS= read -r line; do
- json add error "$line"
- done < "$sharedMemoryError"
- rm -f "$sharedMemoryError"
- fi
- output 2 'Creating dnsmasq file '
- if mv "$B_TMP" "$outputFile"; then
- output 2 "$__OK__\\n"
- else
- output 2 "$__FAIL__\\n"
- json add error "errorMovingDataFile"
- fi
- output 1 '\n'
-}
-
-download_lists() {
- local hf allow_filter j=0 R_TMP
-
- json set message "$(get_text "statusDownloading")..."
- json set status "statusDownloading"
-
- rm -f "$A_TMP" "$B_TMP" "$outputFile" "$outputCache" "$outputGzip"
- if [ "$($awk '/^MemFree/ {print int($2/1000)}' "/proc/meminfo")" -lt 32 ]; then
- output 3 'Low free memory, restarting resolver '
- if dns 'quiet'; then
- output_okn
- else
- output_failn
- fi
- fi
- touch $A_TMP; touch $B_TMP;
- output 1 'Downloading lists '
- rm -f "$sharedMemoryError"
- for hf in ${blocked_hosts_url}; do
- if [ "$parallel_downloads" -gt 0 ]; then
- process_url "$hf" 'hosts' 'blocked' &
- else
- process_url "$hf" 'hosts' 'blocked'
- fi
- done
- for hf in ${blocked_adblockplus_url}; do
- if [ "$parallel_downloads" -gt 0 ]; then
- process_url "$hf" 'adbp' 'blocked' &
- else
- process_url "$hf" 'adbp' 'blocked'
- fi
- done
- for hf in ${blocked_domains_url}; do
- if [ "$parallel_downloads" -gt 0 ]; then
- process_url "$hf" 'domains' 'blocked' &
- else
- process_url "$hf" 'domains' 'blocked'
- fi
- done
- for hf in ${allowed_domains_url}; do
- if [ "$parallel_downloads" -gt 0 ]; then
- process_url "$hf" 'domains' 'allowed' &
- else
- process_url "$hf" 'domains' 'allowed'
- fi
- done
- wait
- output 1 '\n'
- if [ -s "$sharedMemoryError" ]; then
- while IFS= read -r line; do
- json add error "$line"
- done < "$sharedMemoryError"
- rm -f "$sharedMemoryError"
- fi
-
- if [ "$canary_domains_icloud" -ne 0 ]; then
- canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsiCloud}"
- fi
- if [ "$canary_domains_mozilla" -ne 0 ]; then
- canaryDomains="${canaryDomains:+$canaryDomains }${canaryDomainsMozilla}"
- fi
-
- for hf in $blocked_domain $canaryDomains; do echo "$hf" | sed "$domainsFilter" >> $B_TMP; done
- allowed_domain="${allowed_domain}
-$(cat $A_TMP)"
- for hf in ${allowed_domain}; do hf="$(echo "$hf" | sed 's/\./\\./g')"; allow_filter="$allow_filter/(^|\.)${hf}$/d;"; done
-
- [ ! -s "$B_TMP" ] && return 1
-
- output 1 'Processing downloads '
- output 2 'Sorting combined list '
- json set status "statusProcessing"
- json set message "$(get_text "statusProcessing"): sorting combined list"
- if [ "$allow_non_ascii" -gt 0 ]; then
- if sort -u "$B_TMP" > "$A_TMP"; then
- output_ok
- else
- output_failn
- json add error "errorSorting"
- fi
- else
- if sort -u "$B_TMP" | grep -E -v '[^a-zA-Z0-9=/.-]' > "$A_TMP"; then
- output_ok
- else
- output_failn
- json add error "errorSorting"
- fi
- fi
-
- if [ "$dns" = 'dnsmasq.conf' ] || \
- [ "$dns" = 'dnsmasq.ipset' ] || \
- [ "$dns" = 'dnsmasq.nftset' ] || \
- [ "$dns" = 'dnsmasq.servers' ] || \
- [ "$dns" = 'unbound.adb_list' ]; then
- # TLD optimization written by Dirk Brenken (dev@brenken.org)
- output 2 'Optimizing combined list '
- json set message "$(get_text "statusProcessing"): optimizing combined list"
-# sed -E 'G;:t;s/(.*)(\.)(.*)(\n)(.*)/\1\4\5\2\3/;tt;s/(.*)\n(\.)(.*)/\3\2\1/' is actually slower than command below
- if $awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "$A_TMP" > "$B_TMP"; then
- if sort "$B_TMP" > "$A_TMP"; then
- if $awk '{if(NR=1){tld=$NF};while(getline){if($NF!~tld"\\."){print tld;tld=$NF}}print tld}' "$A_TMP" > "$B_TMP"; then
- if $awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "$B_TMP" > "$A_TMP"; then
- if sort -u "$A_TMP" > "$B_TMP"; then
- output_ok
- else
- output_failn
- json add error "errorOptimization"
- mv "$A_TMP" "$B_TMP"
- fi
- else
- output_failn
- json add error "errorOptimization"
- fi
- else
- output_failn
- json add error "errorOptimization"
- mv "$A_TMP" "$B_TMP"
- fi
- else
- output_failn
- json add error "errorOptimization"
- fi
- else
- output_failn
- json add error "errorOptimization"
- mv "$A_TMP" "$B_TMP"
- fi
- else
- mv "$A_TMP" "$B_TMP"
- fi
-
- output 2 'Allowing domains '
- json set message "$(get_text "statusProcessing"): allowing domains"
- if sed -i -E "$allow_filter" "$B_TMP"; then
- output_ok
- else
- output_failn
- json add error "errorAllowListProcessing"
- fi
-
- output 2 'Formatting merged file '
- json set message "$(get_text "statusProcessing"): formatting merged file"
- if [ -z "$outputFilterIPv6" ]; then
- if sed "$outputFilter" "$B_TMP" > "$A_TMP"; then
- output_ok
- else
- output_failn
- json add error "errorDataFileFormatting"
- fi
- else
- case "$dns" in
- dnsmasq.addnhosts)
- if sed "$outputFilter" "$B_TMP" > "$A_TMP" && \
- sed "$outputFilterIPv6" "$B_TMP" >> "$A_TMP"; then
- output_ok
- else
- output_failn
- json add error "errorDataFileFormatting"
- fi
- ;;
- esac
- fi
-
- case "$dns" in
- dnsmasq.addnhosts)
- output 2 'Creating dnsmasq addnhosts file '
- json set message "$(get_text "statusProcessing"): creating dnsmasq addnhosts file"
- ;;
- dnsmasq.conf)
- output 2 'Creating dnsmasq config file '
- json set message "$(get_text "statusProcessing"): creating dnsmasq config file"
- ;;
- dnsmasq.ipset)
- output 2 'Creating dnsmasq ipset file '
- json set message "$(get_text "statusProcessing"): creating dnsmasq ipset file"
- ;;
- dnsmasq.nftset)
- output 2 'Creating dnsmasq nft set file '
- json set message "$(get_text "statusProcessing"): creating dnsmasq nft set file"
- ;;
- dnsmasq.servers)
- output 2 'Creating dnsmasq servers file '
- json set message "$(get_text "statusProcessing"): creating dnsmasq servers file"
- ;;
- unbound.adb_list)
- output 2 'Creating Unbound adb_list file '
- json set message "$(get_text "statusProcessing"): creating Unbound adb_list file"
- ;;
- esac
-
- if mv "$A_TMP" "$outputFile"; then
- output_ok
- else
- output_failn
- json add error "errorMovingDataFile"
- fi
- if [ "$compressed_cache" -gt 0 ]; then
- output 2 'Creating compressed cache '
- json set message "$(get_text "statusProcessing"): creating compressed cache"
- if cache 'create_gzip'; then
- output_ok
- else
- output_failn
- json add error "errorCreatingCompressedCache"
- fi
- else
- rm -f "$outputGzip"
- fi
- output 2 'Removing temporary files '
- json set message "$(get_text "statusProcessing"): removing temporary files"
- rm -f "/tmp/${packageName}_tmp.*" "$A_TMP" "$B_TMP" "$outputCache" || j=1
- if [ $j -eq 0 ]; then
- output_ok
- else
- output_failn
- json add error "errorRemovingTempFiles"
- fi
- output 1 '\n'
-}
-
-adb_allow() {
- local c hf string="$1"
- local validation_result="$3"
- load_environment "$validation_result" 'quiet' || return 1
- if [ ! -s "$outputFile" ]; then
- output "No block-list ('$outputFile') found.\\n"
- return 0
- elif [ -z "$string" ]; then
- output "Usage: /etc/init.d/${packageName} allow 'domain' ...\\n"
- return 0
- elif [ -n "$dnsmasq_config_file_url" ]; then
- output "Allowing individual domains is not possible when using external dnsmasq config file.\\n"
- return 0
- fi
- case "$dns" in
- dnsmasq.addnhosts|dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset|dnsmasq.servers)
- output 1 "Allowing domain(s) and restarting dnsmasq "
- output 2 "Allowing domain(s) \\n"
- for c in $string; do
- output 2 " $c "
- hf="$(echo "$c" | sed 's/\./\\./g')"
- if sed -i "/(^|\.)${hf}$/d;" "$outputFile" && \
- uci_add_list_if_new "${packageName}" 'config' 'allowed_domain' "$c"; then
- output_ok
- else
- output_fail
- fi
- done
- if [ "$compressed_cache" -gt 0 ]; then
- output 2 'Creating compressed cache '
- if cache 'create_gzip'; then
- output_ok
- else
- output_failn
- fi
- fi
- output 2 "Committing changes to config "
- if [ -n "$(uci_changes "$packageName")" ] && uci_commit "$packageName"; then
- allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
- json set triggers
- json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
- output_ok;
- if [ "$dns" = 'dnsmasq.ipset' ]; then
- output 2 "Flushing adb ipset "
- if ipset -q -! flush adb; then output_ok; else output_fail; fi
- fi
- if [ "$dns" = 'dnsmasq.nftset' ]; then
- output 2 "Flushing adb nft sets "
- nft flush set inet fw4 adb6
- if nft flush set inet fw4 adb4; then output_ok; else output_fail; fi
- fi
- output 2 "Restarting dnsmasq "
- if dnsmasq_restart; then output_okn; else output_failn; fi
- else
- output_fail;
- fi
- ;;
- unbound.adb_list)
- output 1 "Allowing domain(s) and restarting Unbound "
- output 2 "Allowing domain(s) \\n"
- for c in $string; do
- output 2 " $c "
- if sed -i "/${string}/d" "$outputFile" && \
- uci_add_list_if_new "$packageName" 'config' 'allowed_domain' "$string"; then
- output_ok
- else
- output_fail
- fi
- done
- if [ "$compressed_cache" -gt 0 ]; then
- output 2 'Creating compressed cache '
- if cache 'create_gzip'; then
- output_ok
- else
- output_failn
- fi
- fi
- output 2 "Committing changes to config "
- if [ -n "$(uci_changes "$packageName")" ] && uci_commit "$packageName"; then
- allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
- json set triggers
- json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
- output_ok;
- output 2 "Restarting Unbound "
- if unbound_restart; then output_okn; else output_failn; fi
- else
- output_fail;
- fi
- ;;
- esac
-}
-
-adb_check() {
- local c param="$1"
- local validation_result="$3"
- load_environment "$validation_result" 'quiet' || return 1
- if [ ! -s "$outputFile" ]; then
- output "No block-list ('$outputFile') found.\\n"
- return 0
- elif [ -z "$param" ]; then
- output "Usage: /etc/init.d/${packageName} check 'domain' ...\\n"
- return 0
- fi
- for string in ${param}; do
- c="$(grep -c "$string" "$outputFile")"
- if [ "$c" -gt 0 ]; then
- if [ "$c" -eq 1 ]; then
- output "Found 1 match for '$string' in '$outputFile'.\\n"
- else
- output "Found $c matches for '$string' in '$outputFile'.\\n"
- fi
- if [ "$c" -le 20 ]; then
- case "$dns" in
- dnsmasq.addnhosts)
- grep "$string" "$outputFile" | sed 's|^127.0.0.1 ||;s|^:: ||;';;
- dnsmasq.conf)
- grep "$string" "$outputFile" | sed 's|local=/||;s|/$||;';;
- dnsmasq.ipset)
- grep "$string" "$outputFile" | sed 's|ipset=/||;s|/adb$||;';;
- dnsmasq.nftset)
- grep "$string" "$outputFile" | sed 's|nftset=/||;s|/4#inet#adb#adb4||;';;
- dnsmasq.servers)
- grep "$string" "$outputFile" | sed 's|server=/||;s|/$||;';;
- unbound.adb_list)
- grep "$string" "$outputFile" | sed 's|^local-zone: "||;s|" static$||;';;
- esac
- fi
- else
- output "The '$string' is not found in current block-list ('$outputFile').\\n"
- fi
- done
-}
-
-adb_config_update() {
- local R_TMP label
- local param validation_result="$3"
- case "$1" in
- on_boot) param="$1";;
- *) param='quiet';;
- esac
- load_environment "$validation_result" "$param" || return 1
- label="${config_update_url##*//}"
- label="${label%%/*}";
- [ "$config_update_enabled" -ne 0 ] || return 0
-
- if [ "$param" != 'download' ]; then
- cache 'test' && return 0
- cache 'test_gzip' && return 0
- fi
- output 1 'Updating config '
- while [ -z "$R_TMP" ] || [ -e "$R_TMP" ]; do
- R_TMP="$(mktemp -u -q -t ${packageName}_tmp.XXXXXXXX)"
- done
- if ! $dl_command "$config_update_url" "$dl_flag" "$R_TMP" 2>/dev/null || [ ! -s "$R_TMP" ]; then
- output 1 "$_FAIL_\\n"
- output 2 "[DL] Config Update: $label $__FAIL__\\n"
- json add error "errorDownloadingConfigUpdate"
- else
- if [ -s "$R_TMP" ] && sed -f "$R_TMP" -i "$packageConfigFile" 2>/dev/null; then
- output 1 "$_OK_\\n"
- output 2 "[DL] Config Update: $label $__OK__\\n"
- else
- output 1 "$_FAIL_\\n"
- output 2 "[DL] Config Update: $label $__FAIL__\\n"
- json add error "errorParsingConfigUpdate"
- fi
- fi
- rm -f "$R_TMP"
- return 0
-}
-
-adb_sizes() {
- local i
- local validation_result="$3"
- load_environment "$validation_result" 'quiet' || return 1
-
- echo "# $(date)"
- for i in ${blocked_adblockplus_url}; do
- [ "${i//melmac}" != "$i" ] && continue
- if $dl_command "$i" "$dl_flag" /tmp/sast 2>/dev/null && [ -s /tmp/sast ]; then
- echo "# File size: $(du -sh /tmp/sast | $awk '{print $1}')"
- if is_greater "$(du -sk /tmp/sast)" "500"; then
- echo "# block-list too big for most routers"
- elif is_greater "$(du -sk /tmp/sast)" "100"; then
- echo "# block-list may be too big for some routers"
- fi
- rm -rf /tmp/sast
- echo " list blocked_adblockplus_url '$i'"
- echo ""
- else
- echo "# site was down on last check"
- echo "# list blocked_adblockplus_url '$i'"
- echo ""
- fi
- done
- for i in ${blocked_domains_url}; do
- [ "${i//melmac}" != "$i" ] && continue
- if $dl_command "$i" "$dl_flag" /tmp/sast 2>/dev/null && [ -s /tmp/sast ]; then
- echo "# File size: $(du -sh /tmp/sast | $awk '{print $1}')"
- if is_greater "$(du -sk /tmp/sast)" "500"; then
- echo "# block-list too big for most routers"
- elif is_greater "$(du -sk /tmp/sast)" "100"; then
- echo "# block-list may be too big for some routers"
- fi
- rm -rf /tmp/sast
- echo " list blocked_domains_url '$i'"
- echo ""
- else
- echo "# site was down on last check"
- echo "# list blocked_domains_url '$i'"
- echo ""
- fi
- done
- for i in ${blocked_hosts_url}; do
- if $dl_command "$i" "$dl_flag" /tmp/sast 2>/dev/null && [ -s /tmp/sast ]; then
- echo "# File size: $(du -sh /tmp/sast | $awk '{print $1}')"
- if is_greater "$(du -sk /tmp/sast)" "500"; then
- echo "# block-list too big for most routers"
- elif is_greater "$(du -sk /tmp/sast)" "100"; then
- echo "# block-list may be too big for some routers"
- fi
- rm -rf /tmp/sast
- echo " list blocked_hosts_url '$i'"
- echo ""
- else
- echo "# site was down on last check"
- echo "# list blocked_hosts_url '$i'"
- echo ""
- fi
- done
-}
-
-# shellcheck disable=SC2120
-adb_start() {
- local action status error message stats c
- local param="$1" validation_result="$3"
-
- load_environment "$validation_result" "$param" || return 1
-
- status="$(json get status)"
- error="$(json get error)"
- message="$(json get message)"
- stats="$(json get stats)"
- action="$(json get triggers)"
-
- if [ "$action" = 'on_boot' ] || [ "$param" = 'on_boot' ]; then
- if cache 'test_gzip' || cache 'test'; then
- action='restore'
- else
- action='download'
- fi
- elif [ "$action" = 'download' ] || [ "$param" = 'download' ] || [ -n "$error" ]; then
- action='download'
- elif [ ! -s "$outputFile" ]; then
- if cache 'test_gzip' || cache 'test'; then
- action='restore'
- else
- action='download'
- fi
- elif [ "$action" = 'restart' ] || [ "$param" = 'restart' ]; then
- action='restart'
- elif [ -s "$outputFile" ] && [ "$status" = "statusSuccess" ] && [ -z "$error" ]; then
- status_service
- return 0
- else
- action='download'
- fi
-
- json del all
- json set triggers
-
- if [ "$action" = 'restore' ]; then
- output 0 "Starting $serviceName... "
- output 3 "Starting $serviceName...\\n"
- json set status "statusStarting"
- if cache 'test_gzip' && ! cache 'test' && [ ! -s "$outputFile" ]; then
- output 3 'Found compressed cache file, unpacking it '
- json set message 'found compressed cache file, unpacking it.'
- if cache 'unpack_gzip'; then
- output_okn
- else
- output_failn
- json add error "errorRestoreCompressedCache"
- output "${_ERROR_}: $(get_text 'errorRestoreCompressedCache')!\\n"
- action='download'
- fi
- fi
- if cache 'test' && [ ! -s "$outputFile" ]; then
- output 3 'Found cache file, reusing it '
- json set message 'found cache file, reusing it.'
- if cache 'restore'; then
- output_okn
- dns 'on_start'
- else
- output_failn
- json add error "errorRestoreCache"
- output "${_ERROR_}: $(get_text 'errorRestoreCache')!\\n"
- action='download'
- fi
- fi
- fi
- if [ "$action" = 'download' ]; then
- if [ -s "$outputFile" ] || cache 'test' || cache 'test_gzip'; then
- output 0 "Force-reloading $serviceName... "
- output 3 "Force-reloading $serviceName...\\n"
- json set status "statusForceReloading"
- else
- output 0 "Starting $serviceName... "
- output 3 "Starting $serviceName...\\n"
- json set status "statusStarting"
- fi
- if [ -n "$dnsmasq_config_file_url" ]; then
- download_dnsmasq_file
- else
- download_lists
- fi
- dns 'on_start'
- fi
- if [ "$action" = 'restart' ]; then
- output 0 "Restarting $serviceName... "
- output 3 "Restarting $serviceName...\\n"
- json set status "statusRestarting"
- dns 'on_start'
- fi
- if [ "$action" = 'start' ]; then
- output 0 "Starting $serviceName... "
- output 3 "Starting $serviceName...\\n"
- json set status "statusStarting"
- dns 'on_start'
- fi
- if [ -s "$outputFile" ] && [ "$(json get status)" != "statusFail" ]; then
- output 0 "$__OK__\\n";
- json del message
- json set status "statusSuccess"
- json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
- status_service
- else
- output 0 "$__FAIL__\\n";
- json set status "statusFail"
- json add error "errorOhSnap"
- status_service
- fi
-
- procd_open_instance 'main'
- procd_set_param command /bin/true
- procd_set_param stdout 1
- procd_set_param stderr 1
- procd_open_data
- json_add_string 'status' "$(json get status)"
- json_add_string 'errors' "$(json get errors)"
- if [ -s "$outputFile" ]; then
- json_add_int 'entries' "$(wc -l < "$outputFile")"
- else
- json_add_int 'entries' '0'
- fi
- json_add_array firewall
- if [ "$force_dns" -ne 0 ]; then
- for c in ${force_dns_port/,/ }; do
- if netstat -tuln | grep LISTEN | grep ":${c}" >/dev/null 2>&1; then
- json_add_object ""
- json_add_string type redirect
- json_add_string target DNAT
- json_add_string src lan
- json_add_string proto "tcp udp"
- json_add_string src_dport "$c"
- json_add_string dest_port "$c"
- json_add_string family any
- json_add_boolean reflection 0
- json_close_object
- else
- json_add_object ""
- json_add_string type rule
- json_add_string src lan
- json_add_string dest "*"
- json_add_string proto "tcp udp"
- json_add_string dest_port "$c"
- json_add_string target REJECT
- json_close_object
- fi
- done
- fi
- case "$dns" in
- dnsmasq.ipset)
- json_add_object ""
- json_add_string type ipset
- json_add_string name adb
- json_add_string match dest_net
- json_add_string storage hash
- json_close_object
- json_add_object ""
- json_add_string type rule
- json_add_string ipset adb
- json_add_string src lan
- json_add_string dest "*"
- json_add_string proto "tcp udp"
- json_add_string target REJECT
- json_close_object
- ;;
- dnsmasq.nftset)
- json_add_object ""
- json_add_string type ipset
- json_add_string name adb4
- json_add_string family 4
- json_add_string match dest_net
- json_close_object
- json_add_object ""
- json_add_string type rule
- json_add_string ipset adb4
- json_add_string src lan
- json_add_string dest "*"
- json_add_string proto "tcp udp"
- json_add_string target REJECT
- json_close_object
- if [ "$ipv6_enabled" -ne 0 ]; then
- json_add_object ""
- json_add_string type ipset
- json_add_string name adb6
- json_add_string family 6
- json_add_string match dest_net
- json_close_object
- json_add_object ""
- json_add_string type rule
- json_add_string ipset adb6
- json_add_string src lan
- json_add_string dest "*"
- json_add_string proto "tcp udp"
- json_add_string target REJECT
- json_close_object
- fi
- ;;
- esac
- json_close_array
- procd_close_data
- procd_close_instance
-}
-
-adb_status() {
- local c url status message error stats
- local validation_result="$3"
- load_environment "$validation_result" 'quiet' || return 1
- status="$(json get status)"
- message="$(json get message)"
- error="$(json get error)"
- stats="$(json get stats)"
- if [ "$status" = "statusSuccess" ]; then
- output "$stats "; output_okn;
- else
- [ -n "$status" ] && status="$(get_text "$status")"
- if [ -n "$status" ] && [ -n "$message" ]; then
- status="${status}: $message"
- fi
- [ -n "$status" ] && output "$serviceName $status\\n"
- fi
- if [ -n "$error" ]; then
- for c in $error; do
- url="${c##*|}"
- c="${c%|*}"
- case "$c" in
- errorDownloadingList|errorParsingList)
- output "${_ERROR_}: $(get_text "$c") $url!\\n";;
- *)
- output "${_ERROR_}: $(get_text "$c")!\\n";;
- esac
- n=$((n+1))
- done
- fi
-}
-
-# shellcheck disable=SC2120
-adb_stop() {
- local validation_result="$3"
- load_environment "$validation_result" 'quiet' || return 1
- if [ -s "$outputFile" ]; then
- output "Stopping $serviceName... "
- cache 'create'
- if dns 'on_stop'; then
- ipset -q -! flush adb
- ipset -q -! destroy adb
- nft delete set inet fw4 adb4
- nft delete set inet fw4 adb6
- led_off "$led"
- output 0 "$__OK__\\n"; output_okn;
- json set status "statusStopped"
- json del message
- else
- output 0 "$__FAIL__\\n"; output_fail;
- json set status "statusFail"
- json add error "errorStopping"
- output "${_ERROR_}: $(get_text 'errorStopping')!\\n"
- fi
- fi
-}
-
-adb_pause() {
- local timeout="${1:-$pause_timeout}"
- local validation_result="$3"
- adb_stop 'on_pause' '' "$validation_result"
- output "Sleeping for $timeout seconds... "
- if sleep "$timeout"; then
- output_okn
- else
- output_failn
- fi
- adb_start 'on_pause' '' "$validation_result"
-}
-
-allow() { load_validate_config 'config' adb_allow "'$*'"; }
-boot() {
- ubus -t 30 wait_for network.interface 2>/dev/null
- rc_procd start_service 'on_boot'
-}
-check() { load_validate_config 'config' adb_check "'$*'"; }
-dl() { rc_procd start_service 'download'; }
-killcache() {
- local compressed_cache_dir
- config_load "$packageName"
- config_get compressed_cache_dir 'config' 'compressed_cache_dir' '/etc'
- if [ "$(sanitize_dir "$compressed_cache_dir")" = '/' ]; then
- compressed_cache_dir=''
- elif [ -n "$(sanitize_dir "$compressed_cache_dir")" ]; then
- compressed_cache_dir="$(sanitize_dir "$compressed_cache_dir")"
- else
- compressed_cache_dir="/etc"
- fi
- rm -f "$dnsmasqAddnhostsCache" "${compressed_cache_dir}/${dnsmasqAddnhostsGzip}"
- rm -f "$dnsmasqConfCache" "${compressed_cache_dir}/${dnsmasqConfGzip}"
- rm -f "$dnsmasqIpsetCache" "${compressed_cache_dir}/${dnsmasqIpsetGzip}"
- rm -f "$dnsmasqNftsetCache" "${compressed_cache_dir}/${dnsmasqNftsetGzip}"
- rm -f "$dnsmasqServersCache" "${compressed_cache_dir}/${dnsmasqServersGzip}"
- rm -f "$unboundCache" "$unboundGzip"
- config_load 'dhcp'
- config_foreach resolver 'dnsmasq' 'cleanup'
- uci_commit 'dhcp'
- return 0
-}
-reload_service() { rc_procd start_service 'restart'; }
-restart_service() { rc_procd start_service 'restart'; }
-service_started() { procd_set_config_changed firewall; }
-service_stopped() { procd_set_config_changed firewall; }
-service_triggers() {
- local wan wan6 i
- local procd_trigger_wan6
- config_load "$packageName"
- config_get_bool procd_trigger_wan6 'config' 'procd_trigger_wan6' '0'
- . /lib/functions/network.sh
- network_flush_cache
- network_find_wan wan
- wan="${wan:-wan}"
- if [ "$procd_trigger_wan6" -ne 0 ]; then
- network_find_wan6 wan6
- wan6="${wan6:-wan6}"
- fi
- for i in "$wan" "$wan6"; do
- [ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" start
- done
- procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload
-}
-sizes() { load_validate_config 'config' adb_sizes "''"; }
-start_service() {
- load_validate_config 'config' adb_config_update "'$*'"
- load_validate_config 'config' adb_start "'$*'"
-}
-status_service() { load_validate_config 'config' adb_status "''"; }
-stop_service() { load_validate_config 'config' adb_stop "'$*'"; }
-pause() { load_validate_config 'config' adb_pause "'$*'"; }
-version() { echo "$PKG_VERSION"; }
-
-load_validate_config() {
- . /lib/functions/network.sh
- . /usr/share/libubox/jshn.sh
- local enabled
- local force_dns
- local force_dns_port
- local parallel_downloads
- local debug
- local compressed_cache
- local compressed_cache_dir
- local ipv6_enabled
- local allow_non_ascii
- local canary_domains_icloud
- local canary_domains_mozilla
- local config_update_enabled
- local config_update_url
- local download_timeout
- local pause_timeout
- local curl_additional_param
- local curl_max_file_size
- local curl_retry
- local verbosity
- local procd_trigger_wan6
- local procd_boot_wan_timeout
- local led
- local dns
- local dns_instance
- local allowed_domain
- local allowed_domains_url
- local blocked_adblockplus_url
- local blocked_domain
- local blocked_domains_url
- local blocked_hosts_url
- local dnsmasq_config_file_url
- uci_load_validate "$packageName" "$packageName" "$1" "${2}${3:+ $3}" \
- 'enabled:bool:0' \
- 'force_dns:bool:1' \
- 'force_dns_port:list(integer):53,853' \
- 'parallel_downloads:bool:1' \
- 'debug:bool:0' \
- 'compressed_cache:bool:0' \
- 'compressed_cache_dir:directory:/etc' \
- 'ipv6_enabled:bool:0' \
- 'allow_non_ascii:bool:0' \
- 'canary_domains_icloud:bool:0' \
- 'canary_domains_mozilla:bool:0' \
- 'config_update_enabled:bool:0' \
- 'config_update_url:string:https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update' \
- 'download_timeout:range(1,60):20' \
- 'pause_timeout:range(10,120):60' \
- 'curl_additional_param:or("", string)' \
- 'curl_max_file_size:or("", uinteger)' \
- 'curl_retry:range(0,30):3' \
- 'verbosity:range(0,2):2' \
- 'procd_trigger_wan6:bool:0' \
- 'procd_boot_wan_timeout:integer:60' \
- 'led:or("", "none", file, device, string)' \
- 'dns:or("dnsmasq.addnhosts", "dnsmasq.conf", "dnsmasq.ipset", "dnsmasq.nftset", "dnsmasq.servers", "unbound.adb_list"):dnsmasq.servers' \
- 'dns_instance:list(or(integer, string)):0' \
- 'allowed_domain:list(string)' \
- 'allowed_domains_url:list(string)' \
- 'blocked_domain:list(string)' \
- 'blocked_adblockplus_url:list(string)' \
- 'blocked_domains_url:list(string)' \
- 'blocked_hosts_url:list(string)' \
- 'dnsmasq_config_file_url:string'
-}
+++ /dev/null
-#!/bin/sh
-
-/etc/init.d/"$1" version 2>&1 | grep "$2"
include $(TOPDIR)/rules.mk
PKG_NAME:=snort3
-PKG_VERSION:=3.1.67.0
+PKG_VERSION:=3.1.69.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/snort3/snort3/archive/refs/tags/
-PKG_HASH:=fed8ea7cf00d69c10e5750a6507392730552594f4f4a0dd5d1bf259a691b9a54
+PKG_HASH:=97083cd33a6ba33bdaa133bf19138a3f6a24ce93b2a9e285dcbd89858534cb72
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_LICENSE:=GPL-2.0-only
include $(TOPDIR)/rules.mk
PKG_NAME:=tor
-PKG_VERSION:=0.4.7.13
+PKG_VERSION:=0.4.8.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://dist.torproject.org/ \
https://archive.torproject.org/tor-package-archive
-PKG_HASH:=2079172cce034556f110048e26083ce9bea751f3154b0ad2809751815b11ea9d
+PKG_HASH:=09c1ce74a25fc3b48c81ff146cbd0dd538cbbb8fe4e2964fc2fb2b192f6a1d2b
PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de> \
Peter Wagner <tripolar@gmx.at>
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=unbound
-PKG_VERSION:=1.17.1
-PKG_RELEASE:=2
+PKG_VERSION:=1.18.0
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://nlnetlabs.nl/downloads/unbound
-PKG_HASH:=ee4085cecce12584e600f3d814a28fa822dfaacec1f94c84bfd67f8a5571a5f4
+PKG_HASH:=3da95490a85cff6420f26fae0b84a49f5112df1bf1b7fc34f8724f02082cb712
PKG_MAINTAINER:=Eric Luehrsen <ericluehrsen@gmail.com>
PKG_LICENSE:=BSD-3-Clause
target. Use "uname" on host only if "UNAME" variable is empty.
--- a/configure.ac
+++ b/configure.ac
-@@ -819,7 +819,7 @@ if test x_$ub_test_python != x_no; then
+@@ -840,7 +840,7 @@ if test x_$ub_test_python != x_no; then
fi
fi
+++ /dev/null
---- a/util/net_help.c
-+++ b/util/net_help.c
-@@ -1005,6 +1005,16 @@ listen_sslctx_setup(void* ctxt)
- log_crypto_err("could not set cipher list with SSL_CTX_set_cipher_list");
- }
- #endif
-+#if defined(SSL_OP_IGNORE_UNEXPECTED_EOF)
-+ /* ignore errors when peers do not send the mandatory close_notify
-+ * alert on shutdown.
-+ * Relevant for openssl >= 3 */
-+ if((SSL_CTX_set_options(ctx, SSL_OP_IGNORE_UNEXPECTED_EOF) &
-+ SSL_OP_IGNORE_UNEXPECTED_EOF) != SSL_OP_IGNORE_UNEXPECTED_EOF) {
-+ log_crypto_err("could not set SSL_OP_IGNORE_UNEXPECTED_EOF");
-+ return 0;
-+ }
-+#endif
-
- if((SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE) &
- SSL_OP_CIPHER_SERVER_PREFERENCE) !=
-@@ -1233,6 +1243,17 @@ void* connect_sslctx_create(char* key, c
- SSL_CTX_free(ctx);
- return 0;
- }
-+#endif
-+#if defined(SSL_OP_IGNORE_UNEXPECTED_EOF)
-+ /* ignore errors when peers do not send the mandatory close_notify
-+ * alert on shutdown.
-+ * Relevant for openssl >= 3 */
-+ if((SSL_CTX_set_options(ctx, SSL_OP_IGNORE_UNEXPECTED_EOF) &
-+ SSL_OP_IGNORE_UNEXPECTED_EOF) != SSL_OP_IGNORE_UNEXPECTED_EOF) {
-+ log_crypto_err("could not set SSL_OP_IGNORE_UNEXPECTED_EOF");
-+ SSL_CTX_free(ctx);
-+ return 0;
-+ }
- #endif
- if(key && key[0]) {
- if(!SSL_CTX_use_certificate_chain_file(ctx, pem)) {
include $(INCLUDE_DIR)/package.mk
-GEOIP_VER:=202308030045
+GEOIP_VER:=202308310037
GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
define Download/geoip
URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
URL_FILE:=geoip.dat
FILE:=$(GEOIP_FILE)
- HASH:=9b7fa7407f35e3087f3b052d12ed40974182c6e1864570b848c1ec901292ea82
+ HASH:=536d7aa9f54af747153d4f982adaa3181025dd72faaba8f532b3f514b467eff8
endef
-GEOSITE_VER:=20230803193133
+GEOSITE_VER:=20230905081311
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
define Download/geosite
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
URL_FILE:=dlc.dat
FILE:=$(GEOSITE_FILE)
- HASH:=3d335d493f168eace5414ca1ff54e4f255f8e5b1a90261d2debb1cbefa0666a0
+ HASH:=d393deda756a446ec5247730ef09fed80ba9fb8d9204d1263c45a3604435fe57
endef
define Package/v2ray-geodata/template
include $(TOPDIR)/rules.mk
PKG_NAME:=v2rayA
-PKG_VERSION:=2.2.2
+PKG_VERSION:=2.2.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/v2rayA/v2rayA/tar.gz/v$(PKG_VERSION)?
-PKG_HASH:=fc32ac028efdd3cac0f482a765ee6e7383b4a8d9be7a343898e64235536cb235
+PKG_HASH:=844da2a4c1ac1f7eae02519a0833255a63938f08a554cbea043606b28ee6ebed
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/service
PKG_LICENSE:=AGPL-3.0-only
URL:=https://github.com/v2rayA/v2rayA/releases/download/v$(PKG_VERSION)/
URL_FILE:=web.zip
FILE:=$(WEB_FILE)
- HASH:=24e5b61aedb6439f16264be55f50802e1198b87be2d456fc08c44945b67d736b
+ HASH:=2699dacdf39137af408a9ffcb91734e5af487bef4dccaa51f1bb3de6c4d3e8fe
endef
define Build/Prepare
include $(TOPDIR)/rules.mk
PKG_NAME:=cache-domains
-PKG_VERSION:=2.3.1
-PKG_RELEASE:=2
+PKG_VERSION:=2.4.0
+PKG_RELEASE:=1
PKG_MAINTAINER:=Gerard Ryan <G.M0N3Y.2503@gmail.com>
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface/
$(INSTALL_BIN) ./files/30-cache-domains $(1)/etc/hotplug.d/iface/
+
+ $(INSTALL_DIR) $(1)/usr/share/cache-domains/
+ $(INSTALL_BIN) ./files/test.sh $(1)/usr/share/cache-domains/
endef
Build/Compile=# Nothing to compile, just install the scripts
CACHE_DOMAINS_SRC="https://api.github.com/repos/uklans/cache-domains/tarball/master"
CACHE_DOMAINS_DIR="/var/cache-domains"
-CACHE_DOMAINS_CONF_FILE="${CACHE_DOMAINS_DIR}/lancache.conf"
CONFIG_FILE="/etc/cache-domains.json"
dnsmasq_conf() {
+ local ACTION="${1}"
+ local ADDN_CONF_DIR="${2}"
local I=0
local DNSMASQ_CONF_DIR
local DNSMASQ_CONF_FILE
while uci_get "dhcp" "@dnsmasq[${I}]" > /dev/null; do
DNSMASQ_CONF_DIR="$(uci_get "dhcp" "@dnsmasq[${I}]" "confdir" "/tmp/dnsmasq.d" || :)"
- DNSMASQ_CONF_FILE="${DNSMASQ_CONF_DIR}/$(basename "${CACHE_DOMAINS_CONF_FILE}")"
+ uci_remove_list "dhcp" "@dnsmasq[${I}]" "addnmount" "${ADDN_CONF_DIR}"
- case ${1} in
+ mkdir -p "${DNSMASQ_CONF_DIR}"
+ case "${ACTION}" in
add)
- ln -sf "${CACHE_DOMAINS_CONF_FILE}" "${DNSMASQ_CONF_FILE}"
+ ln -s "${ADDN_CONF_DIR}/"* "${DNSMASQ_CONF_DIR}" 2> /dev/null || :
+ uci_add_list "dhcp" "@dnsmasq[${I}]" "addnmount" "${ADDN_CONF_DIR}"
;;
remove)
- rm -f "${DNSMASQ_CONF_FILE}"
+ for DNSMASQ_CONF_FILE in "${DNSMASQ_CONF_DIR}/"*; do
+ case "$(readlink "${DNSMASQ_CONF_FILE}" || echo "${DNSMASQ_CONF_FILE}")" in
+ "${ADDN_CONF_DIR}"*)
+ rm -f "${DNSMASQ_CONF_FILE}"
+ ;;
+ esac
+ done
;;
*)
- echo "ERROR: Invalid action '${1}' for dnsmasq_conf()"
+ echo "ERROR: Invalid action '${ACTION}' for dnsmasq_conf()"
return 1
;;
esac
+ uci_commit "dhcp"
+
I=$((${I} + 1))
done
cd "${SOURCE_DIR}/scripts/"
cp "${CONFIG_FILE}" "config.json"
./create-dnsmasq.sh > /dev/null
- cat "./output/dnsmasq/"*".conf" > "${CACHE_DOMAINS_CONF_FILE}"
cd "${INITIAL_DIR}"
- rm -fr "${SOURCE_DIR}"
- dnsmasq_conf add
+ dnsmasq_conf add "${SOURCE_DIR}/scripts/output/dnsmasq"
}
cleanup() {
- dnsmasq_conf remove
+ dnsmasq_conf remove "${CACHE_DOMAINS_DIR}/$(ls "${CACHE_DOMAINS_DIR}")/scripts/output/dnsmasq"
}
-case ${1} in
+case "${1}" in
config*)
configure
;;
--- /dev/null
+#! /bin/sh
+
+set -o errexit
+
+test_url() {
+ echo "INFO: Testing '${2}' has ${1} addresses" >&2
+
+ case "${1}" in
+ IPv4)
+ nslookup -type=a "${2}"
+ ;;
+ IPv6)
+ nslookup -type=aaaa "${2}"
+ ;;
+ *)
+ echo "ERROR: Unknown IP version: ${1}" >&2
+ exit 1
+ ;;
+ esac
+}
+
+cache_domains() {
+ echo "INFO: cache-domains ${1}" >&2
+ cache-domains "${1}"
+ sleep 5
+}
+
+cache_domains cleanup
+
+test_url IPv4 lancache.steamcontent.com | grep -q 'canonical name ='
+test_url IPv6 lancache.steamcontent.com | grep -q 'canonical name ='
+
+test_url IPv4 dist.blizzard.com | grep -q 'canonical name ='
+test_url IPv6 dist.blizzard.com | grep -q 'canonical name ='
+
+cache_domains configure
+
+test_url IPv4 lancache.steamcontent.com | grep -q '10.10.3.10'
+test_url IPv4 lancache.steamcontent.com | grep -q '10.10.3.11'
+test_url IPv6 lancache.steamcontent.com > /dev/null # None configured
+
+test_url IPv4 dist.blizzard.com | grep -q '10.10.3.13'
+test_url IPv6 dist.blizzard.com > /dev/null # None configured
+
+cache_domains cleanup
+
+test_url IPv4 lancache.steamcontent.com | grep -q 'canonical name ='
+test_url IPv6 lancache.steamcontent.com | grep -q 'canonical name ='
+
+test_url IPv4 dist.blizzard.com | grep -q 'canonical name ='
+test_url IPv6 dist.blizzard.com | grep -q 'canonical name ='
include $(TOPDIR)/rules.mk
PKG_NAME:=compose
-PKG_VERSION:=2.20.3
+PKG_VERSION:=2.21.0
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/docker/compose/tar.gz/v${PKG_VERSION}?
-PKG_HASH:=af8025623de3991a15a89575ae4fc4f3f38a17311af9641815500c01f0775950
+PKG_HASH:=0014b23382a50c90f91849e491500568366052882e22011822ca2d8a3b2976f2
PKG_MAINTAINER:=Javier Marcet <javier@marcet.info>
include $(TOPDIR)/rules.mk
PKG_NAME:=mhz
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/wtarreau/mhz.git
--- /dev/null
+From d55f7b578eb2126d2e4a7f045321f6ba7df3800a Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko@gmail.com>
+Date: Wed, 30 Aug 2023 20:31:07 +0200
+Subject: [PATCH] Makefile: allow overriding CC and CFLAGS
+
+For OpenWrt and Buildroot which support really large amount of different
+architectures and cores it is sometimes required to pass our own CFLAGS.
+This is especially true if hardening options are to be respected.
+
+Also, for cross-compiling CC should be respected as currently it is
+working since both OpenWrt and Buildroot symlink gcc to the cross compiler.
+
+So, lets set the current values as defaults but allow them to be overriden.
+
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+-CC := gcc
+-CFLAGS := -O3 -Wall -fomit-frame-pointer
++CC ?= gcc
++CFLAGS ?= -O3 -Wall -fomit-frame-pointer
+
+ all: mhz
+
PKG_HASH:=c6ffbc34a511ac00d072219bda30699e51f2f4eb483cbae9e32e981d49e8b380
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE_URL:=@SF/sshpass
PKG_HASH:=71746e5e057ffe9b00b44ac40453bf47091930cba96bbea8dc48717dedc49fb7
-PKG_MAINTAINER:=Josef Schlehofer <josef.schlehofer@nic.cz>
+PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
include $(TOPDIR)/rules.mk
PKG_NAME:=syncthing
-PKG_VERSION:=1.23.7
+PKG_VERSION:=1.24.0
PKG_RELEASE:=1
PKG_SOURCE:=syncthing-source-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/syncthing/syncthing/releases/download/v$(PKG_VERSION)
-PKG_HASH:=18d8dd74d8077f500a139752261b78217ef0b0a912a7c017192097a7196e21a1
+PKG_HASH:=4a9459667f9b70a7d1e7d572c7c9d02431ef8f055679eef368300ce1a826608f
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/$(PKG_NAME)
$(if $(CONFIG_PACKAGE_strelaysrv),$(GO_PKG)/cmd/strelaysrv/)
GO_PKG_INSTALL_EXTRA:=^gui/
-GO_PKG_TAGS:=noupgrade,noquic
+GO_PKG_TAGS:=noupgrade
GO_PKG_LDFLAGS_X:=\
$(GO_PKG)/lib/build.Version=v$(PKG_VERSION) \
$(GO_PKG)/lib/build.Stamp=$(SOURCE_DATE_EPOCH) \