mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
fixdevelop
This commit is contained in:
parent
aeacaf914c
commit
753de38595
797 changed files with 70531 additions and 22374 deletions
45
6in4/Makefile
Executable file
45
6in4/Makefile
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2010-2015 OpenWrt.org
|
||||||
|
# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
|
# - Added gateway setting
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=6in4
|
||||||
|
PKG_VERSION:=270
|
||||||
|
PKG_RELEASE:=2
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/6in4
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
DEPENDS:=@IPV6 +kmod-sit +uclient-fetch
|
||||||
|
TITLE:=IPv6-in-IPv4 configuration support
|
||||||
|
MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||||
|
PKGARCH:=all
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/6in4/description
|
||||||
|
Provides support for 6in4 tunnels in /etc/config/network.
|
||||||
|
Refer to http://wiki.openwrt.org/doc/uci/network for
|
||||||
|
configuration details.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/6in4/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||||
|
$(INSTALL_BIN) ./files/6in4.sh $(1)/lib/netifd/proto/6in4.sh
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,6in4))
|
149
6in4/files/6in4.sh
Executable file
149
6in4/files/6in4.sh
Executable file
|
@ -0,0 +1,149 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# 6in4.sh - IPv6-in-IPv4 tunnel backend
|
||||||
|
# Copyright (c) 2010-2015 OpenWrt.org
|
||||||
|
|
||||||
|
[ -n "$INCLUDE_ONLY" ] || {
|
||||||
|
. /lib/functions.sh
|
||||||
|
. /lib/functions/network.sh
|
||||||
|
. ../netifd-proto.sh
|
||||||
|
init_proto "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_6in4_update() {
|
||||||
|
sh -c '
|
||||||
|
timeout=5
|
||||||
|
|
||||||
|
(while [ $((timeout--)) -gt 0 ]; do
|
||||||
|
sleep 1
|
||||||
|
kill -0 $$ || exit 0
|
||||||
|
done; kill -9 $$) 2>/dev/null &
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
' "$1" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_6in4_add_prefix() {
|
||||||
|
append "$3" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_6in4_setup() {
|
||||||
|
local cfg="$1"
|
||||||
|
local iface="$2"
|
||||||
|
local link="6in4-$cfg"
|
||||||
|
|
||||||
|
local mtu ttl tos ipaddr peeraddr ip6addr ip6prefix ip6prefixes tunlink tunnelid username password updatekey gateway
|
||||||
|
json_get_vars mtu ttl tos ipaddr peeraddr ip6addr tunlink tunnelid username password updatekey gateway
|
||||||
|
json_for_each_item proto_6in4_add_prefix ip6prefix ip6prefixes
|
||||||
|
|
||||||
|
[ -z "$peeraddr" ] && {
|
||||||
|
proto_notify_error "$cfg" "MISSING_ADDRESS"
|
||||||
|
proto_block_restart "$cfg"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "$tunlink" ] && ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
|
||||||
|
|
||||||
|
[ -z "$ipaddr" ] && {
|
||||||
|
local wanif="$tunlink"
|
||||||
|
if [ -z "$wanif" ] && ! network_find_wan wanif; then
|
||||||
|
proto_notify_error "$cfg" "NO_WAN_LINK"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! network_get_ipaddr ipaddr "$wanif"; then
|
||||||
|
proto_notify_error "$cfg" "NO_WAN_LINK"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_init_update "$link" 1
|
||||||
|
|
||||||
|
[ -n "$ip6addr" ] && {
|
||||||
|
local local6="${ip6addr%%/*}"
|
||||||
|
local mask6="${ip6addr##*/}"
|
||||||
|
[[ "$local6" = "$mask6" ]] && mask6=
|
||||||
|
proto_add_ipv6_address "$local6" "$mask6"
|
||||||
|
proto_add_ipv6_route "::" 0 "" "" "" "$local6/$mask6"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "$gateway" ] && {
|
||||||
|
proto_add_ipv6_route "::" 0 "$gateway"
|
||||||
|
}
|
||||||
|
|
||||||
|
for ip6prefix in $ip6prefixes; do
|
||||||
|
proto_add_ipv6_prefix "$ip6prefix"
|
||||||
|
proto_add_ipv6_route "::" 0 "" "" "" "$ip6prefix"
|
||||||
|
done
|
||||||
|
|
||||||
|
proto_add_tunnel
|
||||||
|
json_add_string mode sit
|
||||||
|
json_add_int mtu "${mtu:-1280}"
|
||||||
|
json_add_int ttl "${ttl:-64}"
|
||||||
|
[ -n "$tos" ] && json_add_string tos "$tos"
|
||||||
|
json_add_string local "$ipaddr"
|
||||||
|
json_add_string remote "$peeraddr"
|
||||||
|
[ -n "$tunlink" ] && json_add_string link "$tunlink"
|
||||||
|
proto_close_tunnel
|
||||||
|
|
||||||
|
proto_send_update "$cfg"
|
||||||
|
|
||||||
|
[ -n "$tunnelid" -a -n "$username" -a \( -n "$password" -o -n "$updatekey" \) ] && {
|
||||||
|
[ -n "$updatekey" ] && password="$updatekey"
|
||||||
|
|
||||||
|
local http="http"
|
||||||
|
local urlget="uclient-fetch"
|
||||||
|
local urlget_opts="-qO-"
|
||||||
|
local ca_path="${SSL_CERT_DIR:-/etc/ssl/certs}"
|
||||||
|
|
||||||
|
[ -f /lib/libustream-ssl.so ] && http=https
|
||||||
|
[ "$http" = "https" -a -z "$(find $ca_path -name "*.0" 2>/dev/null)" ] && {
|
||||||
|
urlget_opts="$urlget_opts --no-check-certificate"
|
||||||
|
}
|
||||||
|
|
||||||
|
local url="$http://ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid"
|
||||||
|
local try=0
|
||||||
|
local max=3
|
||||||
|
|
||||||
|
(
|
||||||
|
set -o pipefail
|
||||||
|
while [ $((++try)) -le $max ]; do
|
||||||
|
if proto_6in4_update $urlget $urlget_opts --user="$username" --password="$password" "$url" 2>&1 | \
|
||||||
|
sed -e 's,^Killed$,timeout,' -e "s,^,update $try/$max: ," | \
|
||||||
|
logger -t "$link";
|
||||||
|
then
|
||||||
|
logger -t "$link" "updated"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
logger -t "$link" "update failed"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_6in4_teardown() {
|
||||||
|
local cfg="$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
proto_6in4_init_config() {
|
||||||
|
no_device=1
|
||||||
|
available=1
|
||||||
|
|
||||||
|
proto_config_add_string "ipaddr"
|
||||||
|
proto_config_add_string "ip6addr"
|
||||||
|
proto_config_add_array "ip6prefix"
|
||||||
|
proto_config_add_string "peeraddr"
|
||||||
|
proto_config_add_string "tunlink"
|
||||||
|
proto_config_add_string "tunnelid"
|
||||||
|
proto_config_add_string "username"
|
||||||
|
proto_config_add_string "password"
|
||||||
|
proto_config_add_string "updatekey"
|
||||||
|
proto_config_add_string "gateway"
|
||||||
|
proto_config_add_int "mtu"
|
||||||
|
proto_config_add_int "ttl"
|
||||||
|
proto_config_add_string "tos"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "$INCLUDE_ONLY" ] || {
|
||||||
|
add_protocol 6in4
|
||||||
|
}
|
41
aquantia/Makefile
Executable file
41
aquantia/Makefile
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=kmod-aquantia
|
||||||
|
PKG_VERSION:=1.0
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define KernelPackage/phy-aquantia
|
||||||
|
SUBMENU:=Network Devices
|
||||||
|
TITLE:=aQuantia device support
|
||||||
|
DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 @KERNEL_5_4 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-hwmon-core +kmod-libphy
|
||||||
|
KCONFIG:=CONFIG_AQUANTIA_PHY
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,aquantia)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/phy-aquantia/description
|
||||||
|
Kernel modules for aQuantia Ethernet adapters.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/atlantic
|
||||||
|
SUBMENU:=Network Devices
|
||||||
|
TITLE:=aQuantia AQtion(tm) Support
|
||||||
|
DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 @KERNEL_5_4 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-phy-aquantia
|
||||||
|
KCONFIG:=CONFIG_AQTION
|
||||||
|
FILES:=$(LINUX_DIR)/drivers/net/ethernet/aquantia/atlantic/atlantic.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,atlantic)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/atlantic/description
|
||||||
|
Kernel modules for the aQuantia AQtion(tm) Ethernet card
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,phy-aquantia))
|
||||||
|
$(eval $(call KernelPackage,atlantic))
|
59
bcm27xx-eeprom/Makefile
Executable file
59
bcm27xx-eeprom/Makefile
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=bcm27xx-eeprom
|
||||||
|
PKG_VERSION:=v2022.04.26-138a1
|
||||||
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/rpi-eeprom/tar.gz/$(PKG_VERSION)?
|
||||||
|
PKG_HASH:=7c54839e68f226c5853fb63c8a1539b729d84b2e6bac311a51766c601d10a413
|
||||||
|
|
||||||
|
PKG_LICENSE:=BSD-3-Clause Custom
|
||||||
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
|
||||||
|
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
||||||
|
|
||||||
|
define Package/bcm27xx-eeprom
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
DEPENDS:=bcm27xx-userland +blkid +coreutils +coreutils-od +pciutils +python3-light
|
||||||
|
TITLE:=BCM27xx EEPROM tools
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/bcm27xx-eeprom/description
|
||||||
|
BCM27xx EEPROM tools.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
true
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/bcm27xx-eeprom/conffiles
|
||||||
|
/etc/bcm27xx-eeprom.conf
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/bcm27xx-eeprom/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc
|
||||||
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/rpi-eeprom-update-default $(1)/etc/bcm27xx-eeprom.conf
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-config $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-digest $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-update $(1)/usr/bin
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/raspberrypi/bootloader
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/firmware/release-notes.md $(1)/lib/firmware/raspberrypi/bootloader
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/raspberrypi/bootloader/critical
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/firmware/critical/ $(1)/lib/firmware/raspberrypi/bootloader/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/raspberrypi/bootloader/stable
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/firmware/stable/ $(1)/lib/firmware/raspberrypi/bootloader/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,bcm27xx-eeprom))
|
45
bcm27xx-eeprom/patches/0001-rpi-eeprom-update-OpenWrt-defaults.patch
Executable file
45
bcm27xx-eeprom/patches/0001-rpi-eeprom-update-OpenWrt-defaults.patch
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
From da37f7b051fe6833e25e78184cc9217dd4379187 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||||
|
Date: Mon, 23 Mar 2020 10:10:55 +0100
|
||||||
|
Subject: [PATCH] rpi-eeprom-update: OpenWrt defaults
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||||
|
---
|
||||||
|
rpi-eeprom-update | 6 +++---
|
||||||
|
rpi-eeprom-update-default | 5 +++--
|
||||||
|
2 files changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
--- a/rpi-eeprom-update
|
||||||
|
+++ b/rpi-eeprom-update
|
||||||
|
@@ -24,12 +24,12 @@ else
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Selects the release sub-directory
|
||||||
|
-FIRMWARE_RELEASE_STATUS=${FIRMWARE_RELEASE_STATUS:-default}
|
||||||
|
+FIRMWARE_RELEASE_STATUS=${FIRMWARE_RELEASE_STATUS:-stable}
|
||||||
|
FIRMWARE_IMAGE_DIR=${FIRMWARE_IMAGE_DIR:-${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}}
|
||||||
|
-FIRMWARE_BACKUP_DIR=${FIRMWARE_BACKUP_DIR:-/var/lib/raspberrypi/bootloader/backup}
|
||||||
|
+FIRMWARE_BACKUP_DIR=${FIRMWARE_BACKUP_DIR:-${FIRMWARE_ROOT}/backup}
|
||||||
|
ENABLE_VL805_UPDATES=${ENABLE_VL805_UPDATES:-1}
|
||||||
|
RECOVERY_BIN=${RECOVERY_BIN:-${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}/recovery.bin}
|
||||||
|
BOOTFS=${BOOTFS:-/boot}
|
||||||
|
CM4_ENABLE_RPI_EEPROM_UPDATE=${CM4_ENABLE_RPI_EEPROM_UPDATE:-0}
|
||||||
|
RPI_EEPROM_UPDATE_CONFIG_TOOL="${RPI_EEPROM_UPDATE_CONFIG_TOOL:-raspi-config}"
|
||||||
|
|
||||||
|
--- a/rpi-eeprom-update-default
|
||||||
|
+++ b/rpi-eeprom-update-default
|
||||||
|
@@ -1,8 +1,9 @@
|
||||||
|
|
||||||
|
FIRMWARE_ROOT=/lib/firmware/raspberrypi/bootloader
|
||||||
|
-FIRMWARE_RELEASE_STATUS="critical"
|
||||||
|
+FIRMWARE_RELEASE_STATUS="stable"
|
||||||
|
FIRMWARE_IMAGE_DIR="${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}"
|
||||||
|
-FIRMWARE_BACKUP_DIR="/var/lib/raspberrypi/bootloader/backup"
|
||||||
|
+FIRMWARE_BACKUP_DIR="${FIRMWARE_ROOT}/backup"
|
||||||
|
BOOTFS=/boot
|
||||||
|
USE_FLASHROM=0
|
||||||
|
EEPROM_CONFIG_HOOK=
|
||||||
|
+VCMAILBOX=/usr/bin/vcmailbox
|
|
@ -0,0 +1,26 @@
|
||||||
|
From 6674d49dea0104031b3f54df4c7a356dc4307bb2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||||
|
Date: Wed, 25 Mar 2020 20:58:35 +0100
|
||||||
|
Subject: [PATCH] rpi-eeprom-update: change default include path
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||||
|
---
|
||||||
|
rpi-eeprom-update | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
--- a/rpi-eeprom-update
|
||||||
|
+++ b/rpi-eeprom-update
|
||||||
|
@@ -6,8 +6,8 @@ set -e
|
||||||
|
|
||||||
|
script_dir=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
|
||||||
|
-if [ -f /etc/default/rpi-eeprom-update ]; then
|
||||||
|
- . /etc/default/rpi-eeprom-update
|
||||||
|
+if [ -f /etc/bcm27xx-eeprom.conf ]; then
|
||||||
|
+ . /etc/bcm27xx-eeprom.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCAL_MODE=0
|
|
@ -0,0 +1,33 @@
|
||||||
|
From 8376ac74390af0ad736c88615e128b82a75eebc0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||||
|
Date: Fri, 19 Feb 2021 10:54:23 +0100
|
||||||
|
Subject: [PATCH] rpi-eeprom-update: chmod silent (-f) is not supported
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||||
|
---
|
||||||
|
rpi-eeprom-update | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/rpi-eeprom-update
|
||||||
|
+++ b/rpi-eeprom-update
|
||||||
|
@@ -200,7 +200,7 @@ applyRecoveryUpdate()
|
||||||
|
|| die "Failed to copy ${TMP_EEPROM_IMAGE} to ${BOOTFS}"
|
||||||
|
|
||||||
|
# For NFS mounts ensure that the files are readable to the TFTP user
|
||||||
|
- chmod -f go+r "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" \
|
||||||
|
+ chmod go+r "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" \
|
||||||
|
|| die "Failed to set permissions on eeprom update files"
|
||||||
|
fi
|
||||||
|
|
||||||
|
@@ -211,7 +211,7 @@ applyRecoveryUpdate()
|
||||||
|
|| die "Failed to copy ${VL805_UPDATE_IMAGE} to ${BOOTFS}/vl805.bin"
|
||||||
|
|
||||||
|
# For NFS mounts ensure that the files are readable to the TFTP user
|
||||||
|
- chmod -f go+r "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" \
|
||||||
|
+ chmod go+r "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" \
|
||||||
|
|| die "Failed to set permissions on eeprom update files"
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
--- a/rpi-eeprom-config
|
||||||
|
+++ b/rpi-eeprom-config
|
||||||
|
@@ -166,8 +166,8 @@ def edit_config(eeprom=None):
|
||||||
|
"""
|
||||||
|
Implements something like 'git commit' for editing EEPROM configs.
|
||||||
|
"""
|
||||||
|
- # Default to nano if $EDITOR is not defined.
|
||||||
|
- editor = 'nano'
|
||||||
|
+ # Default to vi if $EDITOR is not defined.
|
||||||
|
+ editor = 'vi'
|
||||||
|
if 'EDITOR' in os.environ:
|
||||||
|
editor = os.environ['EDITOR']
|
||||||
|
|
||||||
|
@@ -428,7 +428,7 @@ Operating modes:
|
||||||
|
|
||||||
|
To cancel the pending update run 'sudo rpi-eeprom-update -r'
|
||||||
|
|
||||||
|
- The default text editor is nano and may be overridden by setting the 'EDITOR'
|
||||||
|
+ The default text editor is vi and may be overridden by setting the 'EDITOR'
|
||||||
|
environment variable and passing '-E' to 'sudo' to preserve the environment.
|
||||||
|
|
||||||
|
6. Signing the bootloader config file.
|
58
cryptodev-linux/Makefile
Executable file
58
cryptodev-linux/Makefile
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
|
PKG_NAME:=cryptodev-linux
|
||||||
|
PKG_VERSION:=1.12
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_HASH:=f51c2254749233b1b1d7ec9445158bd709f124f88e1c650fe2faac83c3a81938
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>
|
||||||
|
|
||||||
|
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define KernelPackage/cryptodev
|
||||||
|
SUBMENU:=Cryptographic API modules
|
||||||
|
TITLE:=Driver for cryptographic acceleration
|
||||||
|
URL:=http://cryptodev-linux.org/
|
||||||
|
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
|
||||||
|
DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX)
|
||||||
|
AUTOLOAD:=$(call AutoLoad,50,cryptodev)
|
||||||
|
MODPARAMS.cryptodev:=cryptodev_verbosity=-1
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/cryptodev/description
|
||||||
|
This is a driver for that allows to use the Linux kernel supported
|
||||||
|
hardware ciphers by user-space applications.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||||
|
$(KERNEL_MAKE_FLAGS) \
|
||||||
|
KERNEL_DIR="$(LINUX_DIR)"
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/InstallDev
|
||||||
|
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/crypto
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/crypto/cryptodev.h $(STAGING_DIR)/usr/include/crypto/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,cryptodev))
|
62
fullconenat/Makefile
Executable file
62
fullconenat/Makefile
Executable file
|
@ -0,0 +1,62 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2022 Chion Tang <tech@chionlab.moe>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=fullconenat
|
||||||
|
PKG_RELEASE:=9
|
||||||
|
|
||||||
|
PKG_SOURCE_DATE:=2022-02-13
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://github.com/llccd/netfilter-full-cone-nat.git
|
||||||
|
PKG_SOURCE_VERSION:=108a36cbdca17e68c9e6e7fd5e26156a88f738e8
|
||||||
|
PKG_MIRROR_HASH:=00d749235271dee194dcd23c22e6e85207ea90192a62a110b2af0b4e4de1971f
|
||||||
|
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
PKG_MAINTAINER:=Chion Tang <tech@chionlab.moe>
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/iptables-mod-fullconenat
|
||||||
|
SUBMENU:=Firewall
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
TITLE:=FULLCONENAT iptables extension
|
||||||
|
DEPENDS:=+iptables +kmod-ipt-fullconenat
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/iptables-mod-fullconenat/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libipt_FULLCONENAT.so $(1)/usr/lib/iptables
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/ipt-fullconenat
|
||||||
|
SUBMENU:=Netfilter Extensions
|
||||||
|
TITLE:=FULLCONENAT netfilter module
|
||||||
|
DEPENDS:=+kmod-nf-ipt +kmod-nf-nat
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_NF_CONNTRACK_EVENTS=y \
|
||||||
|
CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/xt_FULLCONENAT.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/kernel-defaults.mk
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||||
|
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||||
|
ARCH="$(LINUX_KARCH)" \
|
||||||
|
M="$(PKG_BUILD_DIR)" \
|
||||||
|
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||||
|
modules
|
||||||
|
$(call Build/Compile/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,ipt-fullconenat))
|
||||||
|
$(eval $(call BuildPackage,iptables-mod-fullconenat))
|
20
fullconenat/patches/001-fix-init-Repeat-definition.patch
Executable file
20
fullconenat/patches/001-fix-init-Repeat-definition.patch
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
--- a/libip6t_FULLCONENAT.c
|
||||||
|
+++ b/libip6t_FULLCONENAT.c
|
||||||
|
@@ -214,6 +214,7 @@ static struct xtables_target fullconenat_tg_reg = {
|
||||||
|
.x6_options = FULLCONENAT_opts,
|
||||||
|
};
|
||||||
|
|
||||||
|
+#define _init __attribute__((constructor)) _INIT
|
||||||
|
void _init(void)
|
||||||
|
{
|
||||||
|
xtables_register_target(&fullconenat_tg_reg);
|
||||||
|
--- a/libipt_FULLCONENAT.c
|
||||||
|
+++ b/libipt_FULLCONENAT.c
|
||||||
|
@@ -235,6 +235,7 @@ static struct xtables_target fullconenat_tg_reg = {
|
||||||
|
.x6_options = FULLCONENAT_opts,
|
||||||
|
};
|
||||||
|
|
||||||
|
+#define _init __attribute__((constructor)) _INIT
|
||||||
|
void _init(void)
|
||||||
|
{
|
||||||
|
xtables_register_target(&fullconenat_tg_reg);
|
26
fullconenat/patches/001-linux-6.1-support.patch
Executable file
26
fullconenat/patches/001-linux-6.1-support.patch
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
--- a/xt_FULLCONENAT.c
|
||||||
|
+++ b/xt_FULLCONENAT.c
|
||||||
|
@@ -325,7 +325,11 @@
|
||||||
|
/* for now we do the same thing for both --random and --random-fully */
|
||||||
|
|
||||||
|
/* select a random starting point */
|
||||||
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||||
|
+ start = (uint16_t)(get_random_u32() % (u32)range_size);
|
||||||
|
+#else
|
||||||
|
start = (uint16_t)(prandom_u32() % (u32)range_size);
|
||||||
|
+#endif
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ((original_port >= min && original_port <= min + range_size - 1)
|
||||||
|
@@ -995,7 +999,11 @@
|
||||||
|
/* for now we do the same thing for both --random and --random-fully */
|
||||||
|
|
||||||
|
/* select a random starting point */
|
||||||
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||||
|
+ start = (uint16_t)(get_random_u32() % (u32)range_size);
|
||||||
|
+#else
|
||||||
|
start = (uint16_t)(prandom_u32() % (u32)range_size);
|
||||||
|
+#endif
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ((original_port >= min && original_port <= min + range_size - 1)
|
6
fullconenat/src/Makefile
Executable file
6
fullconenat/src/Makefile
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
libipt_FULLCONENAT.so: libipt_FULLCONENAT.o
|
||||||
|
$(CC) -shared -lxtables -o $@ $^;
|
||||||
|
libipt_FULLCONENAT.o: libipt_FULLCONENAT.c
|
||||||
|
$(CC) ${CFLAGS} -fPIC -D_INIT=$*_init -c -o $@ $<;
|
||||||
|
|
||||||
|
obj-m += xt_FULLCONENAT.o
|
|
@ -37,7 +37,8 @@ PKG_CPE_ID:=cpe:/a:golang:go
|
||||||
PKG_BUILD_DEPENDS:=golang/host
|
PKG_BUILD_DEPENDS:=golang/host
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/go-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/go-$(PKG_VERSION)
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
PKG_USE_MIPS16:=0
|
#PKG_USE_MIPS16:=0
|
||||||
|
PKG_BUILD_FLAGS:=no-mips16
|
||||||
|
|
||||||
PKG_GO_PREFIX:=/usr
|
PKG_GO_PREFIX:=/usr
|
||||||
PKG_GO_VERSION_ID:=$(GO_VERSION_MAJOR_MINOR)
|
PKG_GO_VERSION_ID:=$(GO_VERSION_MAJOR_MINOR)
|
||||||
|
|
24
https-dns-proxy/Makefile
Normal file → Executable file
24
https-dns-proxy/Makefile
Normal file → Executable file
|
@ -1,14 +1,14 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=https-dns-proxy
|
PKG_NAME:=https-dns-proxy
|
||||||
PKG_VERSION:=2023-05-25
|
PKG_VERSION:=2021-11-22
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
|
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
|
||||||
PKG_SOURCE_DATE:=$(PKG_VERSION)
|
PKG_SOURCE_DATE:=2021-11-22
|
||||||
PKG_SOURCE_VERSION:=d03e11572562f008f68df217a7378628f1bb7b79
|
PKG_SOURCE_VERSION:=9336fd6272d67e8bb6e304fa54f3139a3d26f08f
|
||||||
PKG_MIRROR_HASH:=5af3683c48bc9e493ca2761a6f7ee756431692a695d6008f61b8b92431036dca
|
PKG_MIRROR_HASH:=60b1ddabaf1db3a9ee19f3294a1df714364d580cef5e3c2161363c371a557456
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
@ -16,20 +16,20 @@ PKG_LICENSE_FILES:=LICENSE
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
include $(INCLUDE_DIR)/cmake.mk
|
include $(INCLUDE_DIR)/cmake.mk
|
||||||
|
|
||||||
CMAKE_OPTIONS += -DCLANG_TIDY_EXE= -DGIT_VERSION=$(PKG_VERSION)-$(PKG_RELEASE)
|
CMAKE_OPTIONS += -DCLANG_TIDY_EXE=
|
||||||
|
|
||||||
define Package/https-dns-proxy
|
define Package/https-dns-proxy
|
||||||
SECTION:=net
|
SECTION:=net
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=DNS Over HTTPS Proxy
|
TITLE:=DNS Over HTTPS Proxy
|
||||||
URL:=https://docs.openwrt.melmac.net/https-dns-proxy/
|
URL:=https://docs.openwrt.melmac.net/https-dns-proxy/
|
||||||
DEPENDS:=+libcares +libcurl +libev +ca-bundle +jsonfilter
|
DEPENDS:=+libcares +libcurl +libev +ca-bundle
|
||||||
CONFLICTS:=https_dns_proxy
|
CONFLICTS:=https_dns_proxy
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/https-dns-proxy/description
|
define Package/https-dns-proxy/description
|
||||||
Light-weight DNS-over-HTTPS, non-caching translation proxy for the RFC 8484 DoH standard.
|
https-dns-proxy is a light-weight DNS<-->HTTPS, non-caching translation proxy for the RFC 8484 DoH standard.
|
||||||
It receives regular (UDP) DNS requests and resolves them via DoH resolver.
|
It receives regular (UDP) DNS requests and issues them via DoH.
|
||||||
Please see https://docs.openwrt.melmac.net/https-dns-proxy/ for more information.
|
Please see https://docs.openwrt.melmac.net/https-dns-proxy/ for more information.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -40,14 +40,12 @@ endef
|
||||||
define Package/https-dns-proxy/install
|
define Package/https-dns-proxy/install
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) ${1}/etc/config
|
||||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults/
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/https_dns_proxy $(1)/usr/sbin/https-dns-proxy
|
$(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
|
$(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
|
$(SED) "s|^\(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_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
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,https-dns-proxy))
|
$(eval $(call BuildPackage,https-dns-proxy))
|
||||||
|
|
0
https-dns-proxy/files/README.md
Normal file → Executable file
0
https-dns-proxy/files/README.md
Normal file → Executable file
9
https-dns-proxy/files/https-dns-proxy.config
Normal file → Executable file
9
https-dns-proxy/files/https-dns-proxy.config
Normal file → Executable file
|
@ -1,7 +1,5 @@
|
||||||
config main 'config'
|
config main 'config'
|
||||||
option canary_domains_icloud '1'
|
option update_dnsmasq_config '*'
|
||||||
option canary_domains_mozilla '1'
|
|
||||||
option dnsmasq_config_update '*'
|
|
||||||
option force_dns '1'
|
option force_dns '1'
|
||||||
list force_dns_port '53'
|
list force_dns_port '53'
|
||||||
list force_dns_port '853'
|
list force_dns_port '853'
|
||||||
|
@ -13,13 +11,12 @@ config main 'config'
|
||||||
# list force_dns_port '4434'
|
# list force_dns_port '4434'
|
||||||
# list force_dns_port '5443'
|
# list force_dns_port '5443'
|
||||||
# list force_dns_port '8443'
|
# list force_dns_port '8443'
|
||||||
option procd_trigger_wan6 '0'
|
|
||||||
|
|
||||||
config https-dns-proxy
|
config https-dns-proxy
|
||||||
option bootstrap_dns '1.1.1.1,1.0.0.1'
|
option bootstrap_dns '1.1.1.1,1.0.0.1'
|
||||||
option resolver_url 'https://cloudflare-dns.com/dns-query'
|
option resolver_url 'https://cloudflare-dns.com/dns-query'
|
||||||
option listen_addr '127.0.0.1'
|
option listen_addr '127.0.0.1'
|
||||||
option listen_port '5053'
|
option listen_port '5054'
|
||||||
option user 'nobody'
|
option user 'nobody'
|
||||||
option group 'nogroup'
|
option group 'nogroup'
|
||||||
|
|
||||||
|
@ -27,6 +24,6 @@ config https-dns-proxy
|
||||||
option bootstrap_dns '8.8.8.8,8.8.4.4'
|
option bootstrap_dns '8.8.8.8,8.8.4.4'
|
||||||
option resolver_url 'https://dns.google/dns-query'
|
option resolver_url 'https://dns.google/dns-query'
|
||||||
option listen_addr '127.0.0.1'
|
option listen_addr '127.0.0.1'
|
||||||
option listen_port '5054'
|
option listen_port '5053'
|
||||||
option user 'nobody'
|
option user 'nobody'
|
||||||
option group 'nogroup'
|
option group 'nogroup'
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/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"
|
|
0
https-dns-proxy/files/https-dns-proxy.hotplug.iface
Normal file → Executable file
0
https-dns-proxy/files/https-dns-proxy.hotplug.iface
Normal file → Executable file
|
@ -1,9 +1,10 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright 2019-2022 Stan Grishin (stangri@melmac.ca)
|
# Copyright 2019-2020 Stan Grishin (stangri@melmac.net)
|
||||||
# shellcheck disable=SC1091,SC3043,SC3060
|
# shellcheck disable=SC2039,SC3043,SC3060
|
||||||
|
PKG_VERSION='dev-test'
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
START=95
|
START=80
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
|
|
||||||
|
@ -14,60 +15,8 @@ else
|
||||||
EXTRA_COMMANDS='version'
|
EXTRA_COMMANDS='version'
|
||||||
fi
|
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 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'
|
dnsmasqConfig=''; forceDNS=''; forceDNSPorts='';
|
||||||
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 0; /etc/init.d/dnsmasq restart >/dev/null 2>&1; }
|
|
||||||
|
|
||||||
version() { echo "$PKG_VERSION"; }
|
version() { echo "$PKG_VERSION"; }
|
||||||
|
|
||||||
|
@ -77,10 +26,11 @@ append_bool() {
|
||||||
local section="$1"
|
local section="$1"
|
||||||
local option="$2"
|
local option="$2"
|
||||||
local value="$3"
|
local value="$3"
|
||||||
local default="${4:-0}"
|
local default="$4"
|
||||||
local _loctmp
|
local _loctmp
|
||||||
|
[ -z "$default" ] && default="0"
|
||||||
config_get_bool _loctmp "$section" "$option" "$default"
|
config_get_bool _loctmp "$section" "$option" "$default"
|
||||||
[ "$_loctmp" -ne 0 ] && xappend "$value"
|
[ "$_loctmp" != "0" ] && xappend "$value"
|
||||||
}
|
}
|
||||||
|
|
||||||
append_parm() {
|
append_parm() {
|
||||||
|
@ -90,280 +40,180 @@ append_parm() {
|
||||||
local default="$4"
|
local default="$4"
|
||||||
local _loctmp
|
local _loctmp
|
||||||
config_get _loctmp "$section" "$option" "$default"
|
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
|
[ -z "$_loctmp" ] && return 0
|
||||||
IFS=" ,"
|
xappend "$switch $_loctmp"
|
||||||
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() {
|
start_instance() {
|
||||||
local cfg="$1" param listen_addr listen_port ipv6_resolvers_only p url iface
|
local cfg="$1" param listen_addr listen_port i
|
||||||
|
|
||||||
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" 'resolver_url' '-r'
|
||||||
|
append_parm "$cfg" 'polling_interval' '-i'
|
||||||
append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
|
append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
|
||||||
append_parm "$cfg" 'listen_port' '-p' "$port"
|
append_parm "$cfg" 'listen_port' '-p' "$p"
|
||||||
append_parm "$cfg" 'dscp_codepoint' '-c'
|
append_parm "$cfg" 'dscp_codepoint' '-c'
|
||||||
append_bootstrap "$cfg" 'bootstrap_dns' '-b' "$DEFAULT_BOOTSTRAP"
|
append_parm "$cfg" 'bootstrap_dns' '-b'
|
||||||
append_parm "$cfg" 'user' '-u' 'nobody'
|
append_parm "$cfg" 'user' '-u' 'nobody'
|
||||||
append_parm "$cfg" 'group' '-g' 'nogroup'
|
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" 'proxy_server' '-t'
|
||||||
append_parm "$cfg" 'logfile' '-l'
|
append_parm "$cfg" 'logfile' '-l'
|
||||||
append_bool "$cfg" 'use_http1' '-x'
|
append_bool "$cfg" 'use_http1' '-x'
|
||||||
append_counter "$cfg" 'verbosity' '-v' '0'
|
config_get_bool ipv6_resolvers_only "$cfg" 'use_ipv6_resolvers_only' '0'
|
||||||
|
config_get verbosity "$cfg" 'verbosity' '0'
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086,SC2154
|
||||||
|
for i in $(seq 1 $verbosity); do
|
||||||
|
xappend '-v'
|
||||||
|
done
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
if [ "$ipv6_resolvers_only" = 0 ]; then
|
||||||
|
xappend '-4'
|
||||||
|
fi
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
procd_set_param command $PROG $param
|
procd_set_param command ${PROG} ${param}
|
||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
procd_set_param respawn
|
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
|
procd_close_instance
|
||||||
|
|
||||||
if [ "$?" ]; then
|
config_get listen_addr "$cfg" 'listen_addr' '127.0.0.1'
|
||||||
config_get listen_addr "$cfg" 'listen_addr' '127.0.0.1'
|
config_get listen_port "$cfg" 'listen_port' "$p"
|
||||||
config_get listen_port "$cfg" 'listen_port' "$port"
|
|
||||||
if [ "$dnsmasq_config_update" = '*' ]; then
|
if [ "$dnsmasqConfig" = "*" ]; then
|
||||||
config_load 'dhcp'
|
config_load 'dhcp'
|
||||||
config_foreach dnsmasq_doh_server 'dnsmasq' 'add' "${listen_addr}" "${listen_port}"
|
config_foreach dnsmasq_add_doh_server 'dnsmasq' "${listen_addr}" "${listen_port}"
|
||||||
elif [ -n "$dnsmasq_config_update" ]; then
|
elif [ -n "$dnsmasqConfig" ]; then
|
||||||
for i in $dnsmasq_config_update; do
|
for i in $dnsmasqConfig; do
|
||||||
if [ -n "$(uci_get 'dhcp' "@dnsmasq[$i]")" ]; then
|
dnsmasq_add_doh_server "@dnsmasq[${i}]" "${listen_addr}" "${listen_port}"
|
||||||
dnsmasq_doh_server "@dnsmasq[$i]" 'add' "${listen_addr}" "${listen_port}"
|
done
|
||||||
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
|
fi
|
||||||
|
p="$((p+1))"
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
is_force_dns_active() { iptables-save 2>/dev/null | grep -q -w -- '--dport 53'; }
|
||||||
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
|
start_service() {
|
||||||
output "Starting $serviceName "
|
local p=5053 c
|
||||||
config_load "$packageName"
|
config_load 'https-dns-proxy'
|
||||||
config_get_bool canary_domains_icloud 'config' 'canary_domains_icloud' '1'
|
config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||||
config_get_bool canary_domains_mozilla 'config' 'canary_domains_mozilla' '1'
|
config_get_bool forceDNS 'config' 'force_dns' '1'
|
||||||
config_get_bool force_dns 'config' 'force_dns' '1'
|
config_get forceDNSPorts 'config' 'force_dns_port' '53 853'
|
||||||
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'
|
dhcp_backup 'create'
|
||||||
config_load "$packageName"
|
config_load 'https-dns-proxy'
|
||||||
config_foreach start_instance "$packageName"
|
config_foreach start_instance 'https-dns-proxy'
|
||||||
if [ -n "$(uci_changes dhcp)" ]; then
|
if [ "$forceDNS" -ne 0 ]; then
|
||||||
uci_commit 'dhcp'
|
procd_open_instance 'main'
|
||||||
dnsmasq_restart
|
procd_set_param command /bin/true
|
||||||
|
procd_set_param stdout 1
|
||||||
|
procd_set_param stderr 1
|
||||||
|
procd_open_data
|
||||||
|
json_add_array firewall
|
||||||
|
for c in $forceDNSPorts; do
|
||||||
|
if netstat -tuln | grep 'LISTEN' | grep ":${c}" >/dev/null 2>&1 || [ "$c" = "53" ]; 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_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
|
||||||
|
json_close_array
|
||||||
|
procd_close_data
|
||||||
|
procd_close_instance
|
||||||
|
fi
|
||||||
|
if [ -n "$(uci -q changes dhcp)" ]; then
|
||||||
|
uci -q commit dhcp
|
||||||
|
[ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
output "\\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service() {
|
stop_service() {
|
||||||
local canaryDomains canary_domains_icloud canary_domains_mozilla
|
config_load 'https-dns-proxy'
|
||||||
local dnsmasq_config_update
|
config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||||
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'
|
dhcp_backup 'restore'
|
||||||
if [ -n "$(uci_changes dhcp)" ]; then
|
if [ -n "$(uci -q changes dhcp)" ]; then
|
||||||
uci_commit 'dhcp'
|
uci -q commit dhcp
|
||||||
dnsmasq_restart || s=1
|
[ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2015
|
|
||||||
[ "$s" -eq 0 ] && output_okn || output_failn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
local wan wan6 i
|
procd_add_config_trigger "config.change" "https-dns-proxy" /etc/init.d/https-dns-proxy reload
|
||||||
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_started() { procd_set_config_changed firewall; }
|
||||||
service_stopped() { procd_set_config_changed firewall; }
|
service_stopped() { procd_set_config_changed firewall; }
|
||||||
restart() { procd_send_signal "$packageName"; rc_procd start_service; }
|
|
||||||
|
|
||||||
dnsmasq_doh_server() {
|
dnsmasq_add_doh_server() {
|
||||||
local cfg="$1" param="$2" address="${3:-127.0.0.1}" port="$4" i
|
local cfg="$1" address="$2" port="$3"
|
||||||
case "$param" in
|
case $address in
|
||||||
add)
|
0.0.0.0|::ffff:0.0.0.0) address='127.0.0.1';;
|
||||||
if [ "$force_dns" -ne 0 ]; then
|
::) address='::1';;
|
||||||
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
|
esac
|
||||||
|
uci -q del_list "dhcp.${cfg}.server=${address}#${port}"
|
||||||
|
uci -q add_list "dhcp.${cfg}.server=${address}#${port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsmasq_create_server_backup() {
|
dnsmasq_create_server_backup() {
|
||||||
local cfg="$1" i
|
local cfg="$1"
|
||||||
[ -n "$(uci_get 'dhcp' "$cfg")" ] || return 1
|
local i
|
||||||
if [ -z "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" ]; then
|
uci -q get "dhcp.${cfg}" >/dev/null || return 1
|
||||||
if [ -z "$(uci_get 'dhcp' "$cfg" 'noresolv')" ]; then
|
if ! uci -q get "dhcp.${cfg}.doh_backup_noresolv" >/dev/null; then
|
||||||
uci_set 'dhcp' "$cfg" 'doh_backup_noresolv' '-1'
|
if [ -z "$(uci -q get "dhcp.${cfg}.noresolv")" ]; then
|
||||||
else
|
uci -q set "dhcp.${cfg}.noresolv=1"
|
||||||
uci_set 'dhcp' "$cfg" 'doh_backup_noresolv' "$(uci_get 'dhcp' "$cfg" noresolv)"
|
uci -q set "dhcp.${cfg}.doh_backup_noresolv=-1"
|
||||||
|
elif [ "$(uci -q get "dhcp.${cfg}.noresolv")" != "1" ]; then
|
||||||
|
uci -q set "dhcp.${cfg}.noresolv=1"
|
||||||
|
uci -q set "dhcp.${cfg}.doh_backup_noresolv=0"
|
||||||
fi
|
fi
|
||||||
uci_set 'dhcp' "$cfg" 'noresolv' 1
|
|
||||||
fi
|
fi
|
||||||
if [ -z "$(uci_get 'dhcp' "$cfg" 'doh_backup_server')" ]; then
|
if ! uci -q get "dhcp.${cfg}.doh_backup_server" >/dev/null; then
|
||||||
if [ -z "$(uci_get 'dhcp' "$cfg" 'server')" ]; then
|
if [ -z "$(uci -q get "dhcp.${cfg}.server")" ]; then
|
||||||
uci_add_list 'dhcp' "$cfg" 'doh_backup_server' ""
|
uci -q add_list "dhcp.${cfg}.doh_backup_server="
|
||||||
fi
|
fi
|
||||||
for i in $(uci_get 'dhcp' "$cfg" 'server'); do
|
for i in $(uci -q get "dhcp.${cfg}.server"); do
|
||||||
uci_add_list 'dhcp' "$cfg" 'doh_backup_server' "$i"
|
uci -q add_list "dhcp.${cfg}.doh_backup_server=$i"
|
||||||
if [ "$i" = "$(echo "$i" | tr -d /\#)" ]; then
|
if [ "$i" = "$(echo "$i" | tr -d /\#)" ]; then
|
||||||
uci_remove_list 'dhcp' "$cfg" 'server' "$i"
|
uci -q del_list "dhcp.${cfg}.server=$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
uci -q del_list "dhcp.${cfg}.server=127.0.0.1#5353"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsmasq_restore_server_backup() {
|
dnsmasq_restore_server_backup() {
|
||||||
local cfg="$1" i
|
local cfg="$1"
|
||||||
[ -n "$(uci_get 'dhcp' "$cfg")" ] || return 0
|
local i
|
||||||
if [ -n "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" ]; then
|
uci -q get "dhcp.${cfg}" >/dev/null || return 0
|
||||||
if [ "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')" = "-1" ]; then
|
if uci -q get "dhcp.${cfg}.doh_backup_noresolv" >/dev/null; then
|
||||||
uci_remove 'dhcp' "$cfg" 'noresolv'
|
if [ "$(uci -q get "dhcp.${cfg}.doh_backup_noresolv")" = "0" ]; then
|
||||||
else
|
uci -q set "dhcp.${cfg}.noresolv=0"
|
||||||
uci_set 'dhcp' "$cfg" 'noresolv' "$(uci_get 'dhcp' "$cfg" 'doh_backup_noresolv')"
|
else
|
||||||
|
uci -q del "dhcp.${cfg}.noresolv"
|
||||||
fi
|
fi
|
||||||
uci_remove 'dhcp' "$cfg" 'doh_backup_noresolv'
|
uci -q del "dhcp.${cfg}.doh_backup_noresolv"
|
||||||
fi
|
fi
|
||||||
if uci_get 'dhcp' "$cfg" 'doh_backup_server' >/dev/null 2>&1; then
|
if uci -q get "dhcp.${cfg}.doh_backup_server" >/dev/null; then
|
||||||
dnsmasq_doh_server "$cfg" 'remove'
|
uci -q del "dhcp.${cfg}.server"
|
||||||
for i in $(uci_get 'dhcp' "$cfg" 'doh_backup_server'); do
|
for i in $(uci -q get "dhcp.${cfg}.doh_backup_server"); do
|
||||||
uci_add_list_if_new 'dhcp' "$cfg" 'server' "$i"
|
uci -q add_list "dhcp.${cfg}.server=$i"
|
||||||
done
|
done
|
||||||
uci_remove 'dhcp' "$cfg" 'doh_backup_server'
|
uci -q del "dhcp.${cfg}.doh_backup_server"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,15 +222,12 @@ dhcp_backup() {
|
||||||
config_load 'dhcp'
|
config_load 'dhcp'
|
||||||
case "$1" in
|
case "$1" in
|
||||||
create)
|
create)
|
||||||
if [ "$dnsmasq_config_update" = "*" ]; then
|
if [ "$dnsmasqConfig" = "*" ]; then
|
||||||
config_foreach dnsmasq_create_server_backup 'dnsmasq'
|
config_foreach dnsmasq_create_server_backup 'dnsmasq'
|
||||||
elif [ -n "$dnsmasq_config_update" ]; then
|
elif [ -n "$dnsmasqConfig" ]; then
|
||||||
for i in $dnsmasq_config_update; do
|
for i in $dnsmasqConfig; do
|
||||||
if [ -n "$(uci_get 'dhcp' "@dnsmasq[$i]")" ]; then
|
dnsmasq_create_server_backup "@dnsmasq[${i}]" || \
|
||||||
dnsmasq_create_server_backup "@dnsmasq[$i]"
|
|
||||||
elif [ -n "$(uci_get 'dhcp' "$i")" ]; then
|
|
||||||
dnsmasq_create_server_backup "$i"
|
dnsmasq_create_server_backup "$i"
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
8
https-dns-proxy/patches/010-cmakelists-remove-cflags.patch → https-dns-proxy/patches/010-fix-cmakelists.patch
Normal file → Executable file
8
https-dns-proxy/patches/010-cmakelists-remove-cflags.patch → https-dns-proxy/patches/010-fix-cmakelists.patch
Normal file → Executable file
|
@ -1,13 +1,13 @@
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -25,9 +25,9 @@ if (NOT CMAKE_INSTALL_BINDIR)
|
@@ -21,9 +21,9 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_INSTALL_BINDIR bin)
|
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
|
-set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
|
||||||
-set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
|
-set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
|
||||||
-set(CMAKE_C_FLAGS_RELEASE "-O2")
|
-set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||||
+#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
|
+#set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing -Wno-variadic-macros")
|
||||||
+#set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
|
+#set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
|
||||||
+#set(CMAKE_C_FLAGS_RELEASE "-O2")
|
+#set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- a/src/options.c
|
|
||||||
+++ b/src/options.c
|
|
||||||
@@ -22,7 +22,7 @@ const char * options_sw_version() {
|
|
||||||
#ifdef SW_VERSION
|
|
||||||
return SW_VERSION;
|
|
||||||
#else
|
|
||||||
- return "2023.01.01-atLeast"; // update date sometimes, like 1-2 times a year
|
|
||||||
+ return "2023-05-25-1"; // update date sometimes, like 1-2 times a year
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
2
https-dns-proxy/test.sh
Normal file → Executable file
2
https-dns-proxy/test.sh
Normal file → Executable file
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
/etc/init.d/"$1" version 2>&1 | grep "$2" && "$1" -V 2>&1 | grep "$2"
|
/etc/init.d/"$1" version 2>&1 | grep "$2"
|
||||||
|
|
0
ipcalc/Makefile
Normal file → Executable file
0
ipcalc/Makefile
Normal file → Executable file
9
iproute2/Makefile
Normal file → Executable file
9
iproute2/Makefile
Normal file → Executable file
|
@ -8,19 +8,17 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=iproute2
|
PKG_NAME:=iproute2
|
||||||
PKG_VERSION:=6.3.0
|
PKG_VERSION:=6.2.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
|
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
|
||||||
PKG_HASH:=dfb2a98db96e7a653cffc6693335a1a466e29a34b6ac528be48f35e1d2766732
|
PKG_HASH:=4d72730200ec5b2aabaa1a2f20553c6748292f065d9a154c7d5e22559df9fd62
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
PKG_BUILD_DEPENDS:=iptables
|
PKG_BUILD_DEPENDS:=iptables
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
|
PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
|
||||||
|
|
||||||
PKG_BUILD_FLAGS:=gc-sections lto
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/kernel.mk
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
include $(INCLUDE_DIR)/nls.mk
|
include $(INCLUDE_DIR)/nls.mk
|
||||||
|
@ -173,7 +171,8 @@ define Build/Configure
|
||||||
> $(PKG_BUILD_DIR)/include/SNAPSHOT.h
|
> $(PKG_BUILD_DIR)/include/SNAPSHOT.h
|
||||||
endef
|
endef
|
||||||
|
|
||||||
TARGET_LDFLAGS += -Wl,--as-needed
|
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
|
||||||
|
TARGET_LDFLAGS += -Wl,--gc-sections -Wl,--as-needed
|
||||||
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
|
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
|
||||||
|
|
||||||
MAKE_FLAGS += \
|
MAKE_FLAGS += \
|
||||||
|
|
2
iproute2/patches/100-configure.patch
Normal file → Executable file
2
iproute2/patches/100-configure.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -36,7 +36,8 @@ int main(int argc, char **argv) {
|
@@ -34,7 +34,8 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
8
iproute2/patches/110-darwin_fixes.patch
Normal file → Executable file
8
iproute2/patches/110-darwin_fixes.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/netem/maketable.c
|
--- a/netem/maketable.c
|
||||||
+++ b/netem/maketable.c
|
+++ b/netem/maketable.c
|
||||||
@@ -11,7 +11,9 @@
|
@@ -10,7 +10,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
--- a/netem/normal.c
|
--- a/netem/normal.c
|
||||||
+++ b/netem/normal.c
|
+++ b/netem/normal.c
|
||||||
@@ -9,8 +9,12 @@
|
@@ -8,8 +8,12 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#define TABLEFACTOR NETEM_DIST_SCALE
|
#define TABLEFACTOR NETEM_DIST_SCALE
|
||||||
--- a/netem/pareto.c
|
--- a/netem/pareto.c
|
||||||
+++ b/netem/pareto.c
|
+++ b/netem/pareto.c
|
||||||
@@ -8,8 +8,12 @@
|
@@ -7,8 +7,12 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
#define TABLESIZE 16384
|
#define TABLESIZE 16384
|
||||||
--- a/netem/paretonormal.c
|
--- a/netem/paretonormal.c
|
||||||
+++ b/netem/paretonormal.c
|
+++ b/netem/paretonormal.c
|
||||||
@@ -15,10 +15,13 @@
|
@@ -14,10 +14,13 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
2
iproute2/patches/115-add-config-xtlibdir.patch
Normal file → Executable file
2
iproute2/patches/115-add-config-xtlibdir.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/tc/Makefile
|
--- a/tc/Makefile
|
||||||
+++ b/tc/Makefile
|
+++ b/tc/Makefile
|
||||||
@@ -127,6 +127,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
|
@@ -128,6 +128,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
|
||||||
ifneq ($(IPT_LIB_DIR),)
|
ifneq ($(IPT_LIB_DIR),)
|
||||||
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
|
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
|
||||||
endif
|
endif
|
||||||
|
|
0
iproute2/patches/120-no_arpd_ifstat_rtacct_lnstat.patch
Normal file → Executable file
0
iproute2/patches/120-no_arpd_ifstat_rtacct_lnstat.patch
Normal file → Executable file
0
iproute2/patches/130-no_netem_tipc_dcb_man_vdpa.patch
Normal file → Executable file
0
iproute2/patches/130-no_netem_tipc_dcb_man_vdpa.patch
Normal file → Executable file
2
iproute2/patches/140-allow_pfifo_fast.patch
Normal file → Executable file
2
iproute2/patches/140-allow_pfifo_fast.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/tc/q_fifo.c
|
--- a/tc/q_fifo.c
|
||||||
+++ b/tc/q_fifo.c
|
+++ b/tc/q_fifo.c
|
||||||
@@ -90,5 +90,6 @@ struct qdisc_util pfifo_head_drop_qdisc_
|
@@ -95,5 +95,6 @@ struct qdisc_util pfifo_head_drop_qdisc_
|
||||||
|
|
||||||
struct qdisc_util pfifo_fast_qdisc_util = {
|
struct qdisc_util pfifo_fast_qdisc_util = {
|
||||||
.id = "pfifo_fast",
|
.id = "pfifo_fast",
|
||||||
|
|
2
iproute2/patches/140-keep_libmnl_optional.patch
Normal file → Executable file
2
iproute2/patches/140-keep_libmnl_optional.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -411,7 +411,7 @@ check_tirpc()
|
@@ -387,7 +387,7 @@ check_selinux()
|
||||||
|
|
||||||
check_mnl()
|
check_mnl()
|
||||||
{
|
{
|
||||||
|
|
2
iproute2/patches/145-keep_libelf_optional.patch
Normal file → Executable file
2
iproute2/patches/145-keep_libelf_optional.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -266,7 +266,7 @@ EOF
|
@@ -255,7 +255,7 @@ EOF
|
||||||
|
|
||||||
check_elf()
|
check_elf()
|
||||||
{
|
{
|
||||||
|
|
2
iproute2/patches/150-keep_libcap_optional.patch
Normal file → Executable file
2
iproute2/patches/150-keep_libcap_optional.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -469,7 +469,7 @@ EOF
|
@@ -445,7 +445,7 @@ EOF
|
||||||
|
|
||||||
check_cap()
|
check_cap()
|
||||||
{
|
{
|
||||||
|
|
0
iproute2/patches/155-keep_tirpc_optional.patch
Normal file → Executable file
0
iproute2/patches/155-keep_tirpc_optional.patch
Normal file → Executable file
0
iproute2/patches/160-libnetlink-pic.patch
Normal file → Executable file
0
iproute2/patches/160-libnetlink-pic.patch
Normal file → Executable file
0
iproute2/patches/170-ip_tiny.patch
Normal file → Executable file
0
iproute2/patches/170-ip_tiny.patch
Normal file → Executable file
8
iproute2/patches/175-reduce-dynamic-syms.patch
Normal file → Executable file
8
iproute2/patches/175-reduce-dynamic-syms.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/tc/Makefile
|
--- a/tc/Makefile
|
||||||
+++ b/tc/Makefile
|
+++ b/tc/Makefile
|
||||||
@@ -113,7 +113,7 @@ LDLIBS += -L. -lm
|
@@ -114,7 +114,7 @@ LDLIBS += -L. -lm
|
||||||
|
|
||||||
ifeq ($(SHARED_LIBS),y)
|
ifeq ($(SHARED_LIBS),y)
|
||||||
LDLIBS += -ldl
|
LDLIBS += -ldl
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TCLIB := tc_core.o
|
TCLIB := tc_core.o
|
||||||
@@ -143,7 +143,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
|
@@ -144,7 +144,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
|
||||||
all: tc $(TCSO)
|
all: tc $(TCSO)
|
||||||
|
|
||||||
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
|
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
libtc.a: $(TCLIB)
|
libtc.a: $(TCLIB)
|
||||||
$(QUIET_AR)$(AR) rcs $@ $^
|
$(QUIET_AR)$(AR) rcs $@ $^
|
||||||
@@ -165,6 +165,7 @@ install: all
|
@@ -166,6 +166,7 @@ install: all
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
|
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
|
||||||
rm -f emp_ematch.tab.*
|
rm -f emp_ematch.tab.*
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
q_atm.so: q_atm.c
|
q_atm.so: q_atm.c
|
||||||
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
|
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
|
||||||
@@ -204,4 +205,16 @@ static-syms.h: $(wildcard *.c)
|
@@ -205,4 +206,16 @@ static-syms.h: $(wildcard *.c)
|
||||||
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
||||||
done > $@
|
done > $@
|
||||||
|
|
||||||
|
|
6
iproute2/patches/180-drop_FAILED_POLICY.patch
Normal file → Executable file
6
iproute2/patches/180-drop_FAILED_POLICY.patch
Normal file → Executable file
|
@ -11,7 +11,7 @@ Subject: [PATCH] add support for dropping with FAILED_POLICY
|
||||||
|
|
||||||
--- a/ip/rtm_map.c
|
--- a/ip/rtm_map.c
|
||||||
+++ b/ip/rtm_map.c
|
+++ b/ip/rtm_map.c
|
||||||
@@ -49,6 +49,8 @@ char *rtnl_rtntype_n2a(int id, char *buf
|
@@ -54,6 +54,8 @@ char *rtnl_rtntype_n2a(int id, char *buf
|
||||||
return "nat";
|
return "nat";
|
||||||
case RTN_XRESOLVE:
|
case RTN_XRESOLVE:
|
||||||
return "xresolve";
|
return "xresolve";
|
||||||
|
@ -20,7 +20,7 @@ Subject: [PATCH] add support for dropping with FAILED_POLICY
|
||||||
default:
|
default:
|
||||||
snprintf(buf, len, "%d", id);
|
snprintf(buf, len, "%d", id);
|
||||||
return buf;
|
return buf;
|
||||||
@@ -84,6 +86,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
|
@@ -89,6 +91,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
|
||||||
res = RTN_UNICAST;
|
res = RTN_UNICAST;
|
||||||
else if (strcmp(arg, "throw") == 0)
|
else if (strcmp(arg, "throw") == 0)
|
||||||
res = RTN_THROW;
|
res = RTN_THROW;
|
||||||
|
@ -31,7 +31,7 @@ Subject: [PATCH] add support for dropping with FAILED_POLICY
|
||||||
if (!end || end == arg || *end || res > 255)
|
if (!end || end == arg || *end || res > 255)
|
||||||
--- a/include/uapi/linux/rtnetlink.h
|
--- a/include/uapi/linux/rtnetlink.h
|
||||||
+++ b/include/uapi/linux/rtnetlink.h
|
+++ b/include/uapi/linux/rtnetlink.h
|
||||||
@@ -265,6 +265,7 @@ enum {
|
@@ -256,6 +256,7 @@ enum {
|
||||||
RTN_THROW, /* Not in this table */
|
RTN_THROW, /* Not in this table */
|
||||||
RTN_NAT, /* Translate this address */
|
RTN_NAT, /* Translate this address */
|
||||||
RTN_XRESOLVE, /* Use external resolver */
|
RTN_XRESOLVE, /* Use external resolver */
|
||||||
|
|
4
iproute2/patches/190-fix-nls-rpath-link.patch
Normal file → Executable file
4
iproute2/patches/190-fix-nls-rpath-link.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -290,7 +290,7 @@ int main(int argc, char **argv) {
|
@@ -279,7 +279,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
local ret=$?
|
local ret=$?
|
||||||
|
|
||||||
rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test
|
rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test
|
||||||
@@ -308,7 +308,7 @@ int main(int argc, char **argv) {
|
@@ -297,7 +297,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
0
iproute2/patches/195-build_variant_ip_tc.patch
Normal file → Executable file
0
iproute2/patches/195-build_variant_ip_tc.patch
Normal file → Executable file
2
iproute2/patches/200-drop_libbsd_dependency.patch
Normal file → Executable file
2
iproute2/patches/200-drop_libbsd_dependency.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -455,14 +455,8 @@ EOF
|
@@ -431,14 +431,8 @@ EOF
|
||||||
if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
|
if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
|
||||||
echo "no"
|
echo "no"
|
||||||
else
|
else
|
||||||
|
|
2
iproute2/patches/300-selinux-configurable.patch
Normal file → Executable file
2
iproute2/patches/300-selinux-configurable.patch
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -385,7 +385,7 @@ check_libbpf()
|
@@ -374,7 +374,7 @@ check_libbpf()
|
||||||
check_selinux()
|
check_selinux()
|
||||||
# SELinux is a compile time option in the ss utility
|
# SELinux is a compile time option in the ss utility
|
||||||
{
|
{
|
||||||
|
|
490
lcd4linux/Config.in
Executable file
490
lcd4linux/Config.in
Executable file
|
@ -0,0 +1,490 @@
|
||||||
|
if PACKAGE_lcd4linux-custom
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libdbus
|
||||||
|
bool
|
||||||
|
|
||||||
|
#config LCD4LINUX_CUSTOM_NEEDS_libftdi
|
||||||
|
# bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libiconv
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libjpeg
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libmpdclient
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libmysqlclient
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libncurses
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libnmeap
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libsqlite3
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
bool
|
||||||
|
|
||||||
|
#config LCD4LINUX_CUSTOM_NEEDS_libX11
|
||||||
|
# bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_ppp
|
||||||
|
bool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_NEEDS_python
|
||||||
|
bool
|
||||||
|
|
||||||
|
|
||||||
|
comment "Drivers ---"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_ASTUSB
|
||||||
|
bool
|
||||||
|
prompt "ASTUSB"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_BeckmannEgle
|
||||||
|
bool
|
||||||
|
prompt "BeckmannEgle"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_BWCT
|
||||||
|
bool
|
||||||
|
prompt "BWCT"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_CrystalFontz
|
||||||
|
bool
|
||||||
|
prompt "CrystalFontz"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_Curses
|
||||||
|
bool
|
||||||
|
prompt "Curses"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libncurses
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_Cwlinux
|
||||||
|
bool
|
||||||
|
prompt "Cwlinux"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_D4D
|
||||||
|
bool
|
||||||
|
prompt "D4D"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_dpf
|
||||||
|
bool
|
||||||
|
prompt "dpf"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_EA232graphic
|
||||||
|
bool
|
||||||
|
prompt "EA232graphic"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_EFN
|
||||||
|
bool
|
||||||
|
prompt "EFN"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_FutabaVFD
|
||||||
|
bool
|
||||||
|
prompt "FutabaVFD"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_FW8888
|
||||||
|
bool
|
||||||
|
prompt "FW8888"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_G15
|
||||||
|
bool
|
||||||
|
prompt "G15"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_GLCD2USB
|
||||||
|
bool
|
||||||
|
prompt "GLCD2USB"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_HD44780
|
||||||
|
bool
|
||||||
|
prompt "HD44780"
|
||||||
|
depends on BROKEN
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_HD44780-I2C
|
||||||
|
bool
|
||||||
|
prompt "HD44780-I2C"
|
||||||
|
depends on BROKEN
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_IRLCD
|
||||||
|
bool
|
||||||
|
prompt "IRLCD"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LCD2USB
|
||||||
|
bool
|
||||||
|
prompt "LCD2USB"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LCDLinux
|
||||||
|
bool
|
||||||
|
prompt "LCDLinux"
|
||||||
|
depends on BROKEN
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LCDTerm
|
||||||
|
bool
|
||||||
|
prompt "LCDTerm"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LEDMatrix
|
||||||
|
bool
|
||||||
|
prompt "LEDMatrix"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LPH7508
|
||||||
|
bool
|
||||||
|
prompt "LPH7508"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LUIse
|
||||||
|
bool
|
||||||
|
prompt "LUIse"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
#select LCD4LINUX_CUSTOM_NEEDS_libluise
|
||||||
|
depends on BROKEN
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_LW_ABP
|
||||||
|
bool
|
||||||
|
prompt "LW_ABP"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_M50530
|
||||||
|
bool
|
||||||
|
prompt "M50530"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_MatrixOrbital
|
||||||
|
bool
|
||||||
|
prompt "MatrixOrbital"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_MatrixOrbitalGX
|
||||||
|
bool
|
||||||
|
prompt "MatrixOrbitalGX"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_mdm166a
|
||||||
|
bool
|
||||||
|
prompt "mdm166a"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_MilfordInstruments
|
||||||
|
bool
|
||||||
|
prompt "MilfordInstruments"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_Newhaven
|
||||||
|
bool
|
||||||
|
prompt "Newhaven"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_Noritake
|
||||||
|
bool
|
||||||
|
prompt "Noritake"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_NULL
|
||||||
|
bool
|
||||||
|
prompt "NULL"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_Pertelian
|
||||||
|
bool
|
||||||
|
prompt "Pertelian"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_PHAnderson
|
||||||
|
bool
|
||||||
|
prompt "PHAnderson"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_PICGraphic
|
||||||
|
bool
|
||||||
|
prompt "PICGraphic"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_picoLCD
|
||||||
|
bool
|
||||||
|
prompt "picoLCD"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_picoLCDGraphic
|
||||||
|
bool
|
||||||
|
prompt "picoLCDGraphic"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_PNG
|
||||||
|
bool
|
||||||
|
prompt "PNG"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_PPM
|
||||||
|
bool
|
||||||
|
prompt "PPM"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_RouterBoard
|
||||||
|
bool
|
||||||
|
prompt "RouterBoard"
|
||||||
|
depends on TARGET_rb532
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_SamsungSPF
|
||||||
|
bool
|
||||||
|
prompt "SamsungSPF"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libjpeg
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_serdisplib
|
||||||
|
bool
|
||||||
|
prompt "serdisplib"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_serdisplib
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_ShuttleVFD
|
||||||
|
bool
|
||||||
|
prompt "ShuttleVFD"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_SimpleLCD
|
||||||
|
bool
|
||||||
|
prompt "SimpleLCD"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_st2205
|
||||||
|
bool
|
||||||
|
prompt "st2205"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_st2205tool
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_T6963
|
||||||
|
bool
|
||||||
|
prompt "T6963"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_TeakLCM
|
||||||
|
bool
|
||||||
|
prompt "TeakLCM"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_TEW673GRU
|
||||||
|
bool
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
depends on TARGET_ar71xx
|
||||||
|
default TARGET_ar71xx
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_Trefon
|
||||||
|
bool
|
||||||
|
prompt "Trefon"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
#config LCD4LINUX_CUSTOM_DRIVER_ULA200
|
||||||
|
# bool
|
||||||
|
# prompt "ULA200"
|
||||||
|
# select LCD4LINUX_CUSTOM_NEEDS_libftdi
|
||||||
|
# select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_USBHUB
|
||||||
|
bool
|
||||||
|
prompt "USBHUB"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_USBLCD
|
||||||
|
bool
|
||||||
|
prompt "USBLCD"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libusb
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_VNC
|
||||||
|
bool
|
||||||
|
prompt "VNC"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libvncserver
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_DRIVER_WincorNixdorf
|
||||||
|
bool
|
||||||
|
prompt "WincorNixdorf"
|
||||||
|
|
||||||
|
#config LCD4LINUX_CUSTOM_DRIVER_X11
|
||||||
|
# bool
|
||||||
|
# prompt "X11"
|
||||||
|
# select LCD4LINUX_CUSTOM_NEEDS_libgd
|
||||||
|
# select LCD4LINUX_CUSTOM_NEEDS_libX11
|
||||||
|
|
||||||
|
|
||||||
|
comment "Plugins ---"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_apm
|
||||||
|
bool
|
||||||
|
prompt "apm"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_asterisk
|
||||||
|
bool
|
||||||
|
prompt "asterisk"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_button_exec
|
||||||
|
bool
|
||||||
|
prompt "button_exec"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_cpuinfo
|
||||||
|
bool
|
||||||
|
prompt "cpuinfo"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_dbus
|
||||||
|
bool
|
||||||
|
prompt "dbus"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libdbus
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_diskstats
|
||||||
|
bool
|
||||||
|
prompt "diskstats"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_dvb
|
||||||
|
bool
|
||||||
|
prompt "dvb"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_event
|
||||||
|
bool
|
||||||
|
prompt "event"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_exec
|
||||||
|
bool
|
||||||
|
prompt "exec"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_fifo
|
||||||
|
bool
|
||||||
|
prompt "fifo"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_file
|
||||||
|
bool
|
||||||
|
prompt "file"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_gps
|
||||||
|
bool
|
||||||
|
prompt "gps"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libnmeap
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_hddtemp
|
||||||
|
bool
|
||||||
|
prompt "hddtemp"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_huawei
|
||||||
|
bool
|
||||||
|
prompt "huawei"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_i2c_sensors
|
||||||
|
bool
|
||||||
|
prompt "i2c_sensors"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_iconv
|
||||||
|
bool
|
||||||
|
prompt "iconv"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libiconv
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_imon
|
||||||
|
bool
|
||||||
|
prompt "imon"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_isdn
|
||||||
|
bool
|
||||||
|
prompt "isdn"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_kvv
|
||||||
|
bool
|
||||||
|
prompt "kvv"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_loadavg
|
||||||
|
bool
|
||||||
|
prompt "loadavg"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_meminfo
|
||||||
|
bool
|
||||||
|
prompt "meminfo"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_mpd
|
||||||
|
bool
|
||||||
|
prompt "mpd"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libmpdclient
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_mpris_dbus
|
||||||
|
bool
|
||||||
|
prompt "mpris_dbus"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libdbus
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_mysql
|
||||||
|
bool
|
||||||
|
prompt "mysql"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libmysqlclient
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_netdev
|
||||||
|
bool
|
||||||
|
prompt "netdev"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_netinfo
|
||||||
|
bool
|
||||||
|
prompt "netinfo"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_pop3
|
||||||
|
bool
|
||||||
|
prompt "pop3"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_ppp
|
||||||
|
bool
|
||||||
|
prompt "ppp"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_ppp
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_proc_stat
|
||||||
|
bool
|
||||||
|
prompt "proc_stat"
|
||||||
|
default y
|
||||||
|
|
||||||
|
#config LCD4LINUX_CUSTOM_PLUGIN_python
|
||||||
|
# bool
|
||||||
|
# prompt "python"
|
||||||
|
# select LCD4LINUX_CUSTOM_NEEDS_python
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_qnaplog
|
||||||
|
bool
|
||||||
|
prompt "qnaplog"
|
||||||
|
select LCD4LINUX_CUSTOM_NEEDS_libsqlite3
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_seti
|
||||||
|
bool
|
||||||
|
prompt "seti"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_statfs
|
||||||
|
bool
|
||||||
|
prompt "statfs"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_uname
|
||||||
|
bool
|
||||||
|
prompt "uname"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_uptime
|
||||||
|
bool
|
||||||
|
prompt "uptime"
|
||||||
|
default y
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_w1retap
|
||||||
|
bool
|
||||||
|
prompt "w1retap"
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_wireless
|
||||||
|
bool
|
||||||
|
prompt "wireless"
|
||||||
|
depends on BROKEN
|
||||||
|
|
||||||
|
config LCD4LINUX_CUSTOM_PLUGIN_xmms
|
||||||
|
bool
|
||||||
|
prompt "xmms"
|
||||||
|
|
||||||
|
endif
|
306
lcd4linux/Makefile
Executable file
306
lcd4linux/Makefile
Executable file
|
@ -0,0 +1,306 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007-2015 OpenWrt.org
|
||||||
|
# Copyright (C) 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=lcd4linux
|
||||||
|
PKG_REV:=f13470faf00e52d1458f2a88d498716240edc272
|
||||||
|
PKG_VERSION:=r$(PKG_REV)
|
||||||
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
|
#PKG_SOURCE_URL:=https://ssl.bulix.org/svn/lcd4linux/trunk/
|
||||||
|
PKG_SOURCE_URL:=https://github.com/redblue-pkt/lcd4linux.git
|
||||||
|
#PKG_SOURCE_SUBDIR:=lcd4linux-$(PKG_VERSION)
|
||||||
|
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
|
||||||
|
LCD4LINUX_DRIVERS:= \
|
||||||
|
ASTUSB \
|
||||||
|
BeckmannEgle \
|
||||||
|
BWCT \
|
||||||
|
CrystalFontz \
|
||||||
|
Curses \
|
||||||
|
Cwlinux \
|
||||||
|
D4D \
|
||||||
|
DPF \
|
||||||
|
EA232graphic \
|
||||||
|
EFN \
|
||||||
|
FutabaVFD \
|
||||||
|
FW8888 \
|
||||||
|
GLCD2USB \
|
||||||
|
IRLCD \
|
||||||
|
$(if $(CONFIG_BROKEN),HD44780) \
|
||||||
|
$(if $(CONFIG_BROKEN),HD44780-I2C) \
|
||||||
|
LCD2USB \
|
||||||
|
$(if $(CONFIG_BROKEN),LCDLinux) \
|
||||||
|
LCDTerm \
|
||||||
|
LEDMatrix \
|
||||||
|
LPH7508 \
|
||||||
|
$(if $(CONFIG_BROKEN),LUIse) \
|
||||||
|
LW_ABP \
|
||||||
|
M50530 \
|
||||||
|
MatrixOrbital \
|
||||||
|
MatrixOrbitalGX \
|
||||||
|
MilfordInstruments \
|
||||||
|
Newhaven \
|
||||||
|
Noritake \
|
||||||
|
NULL \
|
||||||
|
Pertelian \
|
||||||
|
PHAnderson \
|
||||||
|
PICGraphic \
|
||||||
|
picoLCD \
|
||||||
|
picoLCDGraphic \
|
||||||
|
PNG \
|
||||||
|
PPM \
|
||||||
|
$(if $(CONFIG_TARGET_rb532),RouterBoard) \
|
||||||
|
$(if $(CONFIG_BROKEN),SamsungSPF) \
|
||||||
|
ShuttleVFD \
|
||||||
|
SimpleLCD \
|
||||||
|
st2205 \
|
||||||
|
T6963 \
|
||||||
|
TeakLCM \
|
||||||
|
$(if $(CONFIG_TARGET_ar71xx),TEW673GRU) \
|
||||||
|
Trefon \
|
||||||
|
USBHUB \
|
||||||
|
USBLCD \
|
||||||
|
VNC \
|
||||||
|
WincorNixdorf \
|
||||||
|
serdisplib \
|
||||||
|
# G15 \
|
||||||
|
# ULA200 \
|
||||||
|
# X11 \
|
||||||
|
|
||||||
|
LCD4LINUX_PLUGINS:= \
|
||||||
|
apm \
|
||||||
|
asterisk \
|
||||||
|
button_exec \
|
||||||
|
cpuinfo \
|
||||||
|
dbus \
|
||||||
|
diskstats \
|
||||||
|
dvb \
|
||||||
|
event \
|
||||||
|
exec \
|
||||||
|
fifo \
|
||||||
|
file \
|
||||||
|
gps \
|
||||||
|
hddtemp \
|
||||||
|
huawei \
|
||||||
|
i2c_sensors \
|
||||||
|
iconv \
|
||||||
|
imon \
|
||||||
|
isdn \
|
||||||
|
kvv \
|
||||||
|
loadavg \
|
||||||
|
netdev \
|
||||||
|
netinfo \
|
||||||
|
meminfo \
|
||||||
|
mpris_dbus \
|
||||||
|
netdev \
|
||||||
|
pop3 \
|
||||||
|
ppp \
|
||||||
|
proc_stat \
|
||||||
|
qnaplog \
|
||||||
|
seti \
|
||||||
|
statfs \
|
||||||
|
uname \
|
||||||
|
uptime \
|
||||||
|
w1retap \
|
||||||
|
$(if $(CONFIG_BROKEN),wireless) \
|
||||||
|
xmms \
|
||||||
|
# mpd \
|
||||||
|
# mysql \
|
||||||
|
# python \
|
||||||
|
|
||||||
|
PKG_FIXUP:=autoreconf
|
||||||
|
PKG_INSTALL:=1
|
||||||
|
|
||||||
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
|
||||||
|
PKG_BUILD_DEPENDS:= \
|
||||||
|
# ppp \
|
||||||
|
# libftdi \
|
||||||
|
# libX11 \
|
||||||
|
# python \
|
||||||
|
|
||||||
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
$(patsubst %,CONFIG_LCD4LINUX_CUSTOM_DRIVER_%,$(LCD4LINUX_DRIVERS)) \
|
||||||
|
$(patsubst %,CONFIG_LCD4LINUX_CUSTOM_PLUGIN_%,$(LCD4LINUX_PLUGINS)) \
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(INCLUDE_DIR)/nls.mk
|
||||||
|
|
||||||
|
define Package/lcd4linux/Default
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
|
||||||
|
TITLE:=LCD display utility
|
||||||
|
URL:=http://lcd4linux.bulix.org/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/lcd4linux/Default/description
|
||||||
|
LCD4Linux is a small program that grabs information from the kernel and
|
||||||
|
some subsystems and displays it on an external liquid crystal display.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Package/lcd4linux-custom
|
||||||
|
$(call Package/lcd4linux/Default)
|
||||||
|
DEPENDS:= \
|
||||||
|
+LCD4LINUX_CUSTOM_NEEDS_libdbus:libdbus \
|
||||||
|
+LCD4LINUX_CUSTOM_NEEDS_libgd:libgd \
|
||||||
|
$(if $(ICONV_FULL),+LCD4LINUX_CUSTOM_NEEDS_libiconv:libiconv-full) \
|
||||||
|
+LCD4LINUX_CUSTOM_NEEDS_libjpeg:libjpeg \
|
||||||
|
+LCD4LINUX_CUSTOM_NEEDS_libncurses:libncurses \
|
||||||
|
+LCD4LINUX_CUSTOM_NEEDS_libsqlite3:libsqlite3 \
|
||||||
|
+LCD4LINUX_CUSTOM_NEEDS_libusb:libusb-compat \
|
||||||
|
# +LCD4LINUX_CUSTOM_NEEDS_libmpdclient:libmpdclient \
|
||||||
|
# +LCD4LINUX_CUSTOM_NEEDS_libmysqlclient:libmysqlclient \
|
||||||
|
# +LCD4LINUX_CUSTOM_NEEDS_libftdi:libftdi \
|
||||||
|
# +LCD4LINUX_CUSTOM_NEEDS_libX11:libX11 \
|
||||||
|
# +LCD4LINUX_CUSTOM_NEEDS_python:python
|
||||||
|
MENU:=1
|
||||||
|
PROVIDES:=lcd4linux
|
||||||
|
VARIANT=custom
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/lcd4linux-custom/config
|
||||||
|
source "$(SOURCE)/Config.in"
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/lcd4linux-custom/description
|
||||||
|
$(call Package/lcd4linux/Default/description)
|
||||||
|
.
|
||||||
|
This package contains a customized version of LCD4Linux.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Package/lcd4linux-full
|
||||||
|
$(call Package/lcd4linux/Default)
|
||||||
|
DEPENDS:= \
|
||||||
|
+libdbus \
|
||||||
|
+libgd \
|
||||||
|
$(if $(ICONV_FULL),+libiconv-full) \
|
||||||
|
+libncurses \
|
||||||
|
+libsqlite3 \
|
||||||
|
+libusb-compat \
|
||||||
|
+serdisplib
|
||||||
|
# +libmpdclient \
|
||||||
|
# +libmysqlclient \
|
||||||
|
# +libftdi \
|
||||||
|
# +libX11 \
|
||||||
|
# +python
|
||||||
|
PROVIDES:=lcd4linux
|
||||||
|
VARIANT=full
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/lcd4linux-full/description
|
||||||
|
$(call Package/lcd4linux/Default/description)
|
||||||
|
.
|
||||||
|
This package contains a version of LCD4Linux built with all supported
|
||||||
|
drivers and plugins.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGURE_ARGS+= \
|
||||||
|
--disable-rpath \
|
||||||
|
|
||||||
|
EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
|
||||||
|
|
||||||
|
ifeq ($(BUILD_VARIANT),custom)
|
||||||
|
|
||||||
|
LCD4LINUX_CUSTOM_DRIVERS:= $(strip $(foreach c, $(LCD4LINUX_DRIVERS), \
|
||||||
|
$(if $(CONFIG_LCD4LINUX_CUSTOM_DRIVER_$(c)),$(c),) \
|
||||||
|
))
|
||||||
|
ifeq ($(LCD4LINUX_CUSTOM_DRIVERS),)
|
||||||
|
LCD4LINUX_CUSTOM_DRIVERS:=Sample
|
||||||
|
endif
|
||||||
|
|
||||||
|
LCD4LINUX_CUSTOM_PLUGINS:= $(strip $(foreach c, $(LCD4LINUX_PLUGINS), \
|
||||||
|
$(if $(CONFIG_LCD4LINUX_CUSTOM_PLUGIN_$(c)),$(c)) \
|
||||||
|
))
|
||||||
|
ifeq ($(LCD4LINUX_CUSTOM_PLUGINS),)
|
||||||
|
LCD4LINUX_CUSTOM_PLUGINS:=sample
|
||||||
|
endif
|
||||||
|
|
||||||
|
CONFIGURE_ARGS+= \
|
||||||
|
--with-drivers="$(LCD4LINUX_CUSTOM_DRIVERS)" \
|
||||||
|
--with-plugins="$(LCD4LINUX_CUSTOM_PLUGINS)" \
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libiconv),)
|
||||||
|
CONFIGURE_ARGS+= --with-libiconv-prefix="$(ICONV_PREFIX)"
|
||||||
|
else
|
||||||
|
CONFIGURE_ARGS+= --without-libiconv-prefix
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libmysqlclient),)
|
||||||
|
EXTRA_LDFLAGS+= -L$(STAGING_DIR)/usr/lib/mysql
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_python),)
|
||||||
|
# CONFIGURE_ARGS+= --with-python
|
||||||
|
# else
|
||||||
|
CONFIGURE_ARGS+= --without-python
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libX11),)
|
||||||
|
# CONFIGURE_ARGS+= --with-x
|
||||||
|
# else
|
||||||
|
CONFIGURE_ARGS+= --without-x
|
||||||
|
# endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_VARIANT),full)
|
||||||
|
|
||||||
|
LCD4LINUX_FULL_DRIVERS:= $(strip $(foreach c, $(LCD4LINUX_DRIVERS), \
|
||||||
|
$(c) \
|
||||||
|
))
|
||||||
|
|
||||||
|
LCD4LINUX_FULL_PLUGINS:= $(strip $(foreach c, $(LCD4LINUX_PLUGINS), \
|
||||||
|
$(c) \
|
||||||
|
))
|
||||||
|
|
||||||
|
CONFIGURE_ARGS+= \
|
||||||
|
--with-drivers="$(LCD4LINUX_FULL_DRIVERS)" \
|
||||||
|
--with-plugins="$(LCD4LINUX_FULL_PLUGINS)" \
|
||||||
|
--with-libiconv-prefix="$(ICONV_PREFIX)" \
|
||||||
|
--without-python \
|
||||||
|
--without-x \
|
||||||
|
|
||||||
|
EXTRA_LDFLAGS+= -L$(STAGING_DIR)/usr/lib/mysql
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
define Package/lcd4linux/conffiles
|
||||||
|
/etc/lcd4linux.conf
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/lcd4linux/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/bin/lcd4linux $(1)/usr/bin/
|
||||||
|
$(INSTALL_DIR) $(1)/etc
|
||||||
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/lcd4linux.conf.sample $(1)/etc/lcd4linux.conf
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/lcd4linux.init $(1)/etc/init.d/lcd4linux
|
||||||
|
$(SED) "s|^\(Display 'GLCD2USB'\)|#\1|g" \
|
||||||
|
-e "s|^\(Layout 'TestLayer'\)|#\1|g" \
|
||||||
|
-e "s|^#\(Display 'Image'\)|\1|g" \
|
||||||
|
-e "s|^#\(Layout 'Default'\)|\1|g" \
|
||||||
|
$(1)/etc/lcd4linux.conf
|
||||||
|
endef
|
||||||
|
|
||||||
|
Package/lcd4linux-custom/conffiles = $(Package/lcd4linux/conffiles)
|
||||||
|
Package/lcd4linux-custom/install = $(Package/lcd4linux/install)
|
||||||
|
|
||||||
|
Package/lcd4linux-full/conffiles = $(Package/lcd4linux/conffiles)
|
||||||
|
Package/lcd4linux-full/install = $(Package/lcd4linux/install)
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,lcd4linux-custom))
|
||||||
|
$(eval $(call BuildPackage,lcd4linux-full))
|
15
lcd4linux/files/lcd4linux.init
Executable file
15
lcd4linux/files/lcd4linux.init
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2007-2015 OpenWrt.org
|
||||||
|
|
||||||
|
START=98
|
||||||
|
|
||||||
|
SERVICE_USE_PID=1
|
||||||
|
|
||||||
|
start() {
|
||||||
|
service_start /usr/bin/lcd4linux -o /tmp/lcd4linux.png -q
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
service_stop /usr/bin/lcd4linux
|
||||||
|
}
|
||||||
|
|
11
lcd4linux/patches/120-remove-as-needed-linker-option.patch
Executable file
11
lcd4linux/patches/120-remove-as-needed-linker-option.patch
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -18,7 +18,7 @@ ACLOCAL_AMFLAGS=-I m4
|
||||||
|
# use this for lots of warnings
|
||||||
|
#AM_CFLAGS = -D_GNU_SOURCE -std=c99 -m64 -Wall -W -pedantic -Wno-variadic-macros -fno-strict-aliasing
|
||||||
|
|
||||||
|
-lcd4linux_LDFLAGS ="-Wl,--as-needed"
|
||||||
|
+lcd4linux_LDFLAGS =
|
||||||
|
lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
|
||||||
|
lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
|
||||||
|
|
22
lcd4linux/patches/140-no_repnop_T6963.patch
Executable file
22
lcd4linux/patches/140-no_repnop_T6963.patch
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
--- a/drv_T6963.c
|
||||||
|
+++ b/drv_T6963.c
|
||||||
|
@@ -114,7 +114,9 @@ static void drv_T6_status1(void)
|
||||||
|
/* wait for STA0=1 and STA1=1 */
|
||||||
|
n = 0;
|
||||||
|
do {
|
||||||
|
+#if 0
|
||||||
|
rep_nop();
|
||||||
|
+#endif
|
||||||
|
if (++n > 1000) {
|
||||||
|
debug("hang in status1");
|
||||||
|
bug = 1;
|
||||||
|
@@ -150,7 +152,9 @@ static void drv_T6_status2(void)
|
||||||
|
/* wait for STA3=1 */
|
||||||
|
n = 0;
|
||||||
|
do {
|
||||||
|
+#if 0
|
||||||
|
rep_nop();
|
||||||
|
+#endif
|
||||||
|
if (++n > 1000) {
|
||||||
|
debug("hang in status2");
|
||||||
|
bug = 1;
|
2624
lcd4linux/patches/150-addlibmpdclient.patch
Executable file
2624
lcd4linux/patches/150-addlibmpdclient.patch
Executable file
File diff suppressed because it is too large
Load diff
24
lcd4linux/patches/160-uinput_defs.patch
Executable file
24
lcd4linux/patches/160-uinput_defs.patch
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
--- a/drv_G15.c
|
||||||
|
+++ b/drv_G15.c
|
||||||
|
@@ -42,6 +42,7 @@
|
||||||
|
|
||||||
|
#include <usb.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
+#include <linux/version.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <linux/uinput.h>
|
||||||
|
|
||||||
|
@@ -269,8 +270,13 @@ void drv_G15_initKeyHandling(char *devic
|
||||||
|
}
|
||||||
|
memset(&device, 0, sizeof(device));
|
||||||
|
strncpy(device.name, "G15 Keys", UINPUT_MAX_NAME_SIZE);
|
||||||
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
||||||
|
device.id.bustype = BUS_USB;
|
||||||
|
device.id.version = 4;
|
||||||
|
+#else
|
||||||
|
+ device.idbus = BUS_USB;
|
||||||
|
+ device.idversion = 4;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY);
|
||||||
|
|
195
lcd4linux/patches/170-add-generic-spidev-driver.patch
Executable file
195
lcd4linux/patches/170-add-generic-spidev-driver.patch
Executable file
|
@ -0,0 +1,195 @@
|
||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -71,6 +71,8 @@ drv_generic_i2c.c \
|
||||||
|
drv_generic_i2c.h \
|
||||||
|
drv_generic_keypad.c \
|
||||||
|
drv_generic_keypad.h \
|
||||||
|
+drv_generic_spidev.c \
|
||||||
|
+drv_generic_spidev.h \
|
||||||
|
drv_ASTUSB.c \
|
||||||
|
drv_BeckmannEgle.c \
|
||||||
|
drv_BWCT.c \
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drv_generic_spidev.c
|
||||||
|
@@ -0,0 +1,89 @@
|
||||||
|
+/* $Id$
|
||||||
|
+ * $URL$
|
||||||
|
+ *
|
||||||
|
+ * generic driver helper for displays connected via SPI bus
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
+ *
|
||||||
|
+ * This file is part of LCD4Linux.
|
||||||
|
+ *
|
||||||
|
+ * LCD4Linux is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU General Public License as published by
|
||||||
|
+ * the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
+ * any later version.
|
||||||
|
+ *
|
||||||
|
+ * LCD4Linux is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+ * GNU General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU General Public License
|
||||||
|
+ * along with this program; if not, write to the Free Software
|
||||||
|
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "config.h"
|
||||||
|
+
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/ioctl.h>
|
||||||
|
+
|
||||||
|
+#include "debug.h"
|
||||||
|
+#include "qprintf.h"
|
||||||
|
+#include "cfg.h"
|
||||||
|
+#include "drv_generic_spidev.h"
|
||||||
|
+
|
||||||
|
+static char *generic_spidev_section = "";
|
||||||
|
+static char *generic_spidev_driver = "";
|
||||||
|
+static int generic_spidev_fd;
|
||||||
|
+
|
||||||
|
+int drv_generic_spidev_open(const char *section, const char *driver)
|
||||||
|
+{
|
||||||
|
+ char *spidev;
|
||||||
|
+
|
||||||
|
+ udelay_init();
|
||||||
|
+
|
||||||
|
+ generic_spidev_section = (char *) section;
|
||||||
|
+ generic_spidev_driver = (char *) driver;
|
||||||
|
+
|
||||||
|
+ spidev = cfg_get(generic_spidev_section, "Port", NULL);
|
||||||
|
+
|
||||||
|
+ info("%s: initializing SPI device %s", generic_spidev_driver, spidev);
|
||||||
|
+ generic_spidev_fd = open(spidev, O_WRONLY);
|
||||||
|
+ if (generic_spidev_fd < 0) {
|
||||||
|
+ error("%s: unable to open SPI device %s!\n", generic_spidev_driver, spidev);
|
||||||
|
+ goto exit_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ exit_error:
|
||||||
|
+ free(spidev);
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int drv_generic_spidev_close(void)
|
||||||
|
+{
|
||||||
|
+ close(generic_spidev_fd);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int drv_generic_spidev_transfer(const int count, struct spi_ioc_transfer *tr)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = ioctl(generic_spidev_fd, SPI_IOC_MESSAGE(count), tr);
|
||||||
|
+ if (ret < count) {
|
||||||
|
+ error("%s: can't send SPI message! (%s)\n",
|
||||||
|
+ generic_spidev_driver, strerror(errno));
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drv_generic_spidev.h
|
||||||
|
@@ -0,0 +1,54 @@
|
||||||
|
+/* $Id$
|
||||||
|
+ * $URL$
|
||||||
|
+ *
|
||||||
|
+ * generic driver helper for displays connected via SPI bus
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
+ * Copyright (C) 2012 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
|
||||||
|
+ *
|
||||||
|
+ * This file is part of LCD4Linux.
|
||||||
|
+ *
|
||||||
|
+ * LCD4Linux is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU General Public License as published by
|
||||||
|
+ * the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
+ * any later version.
|
||||||
|
+ *
|
||||||
|
+ * LCD4Linux is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+ * GNU General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU General Public License
|
||||||
|
+ * along with this program; if not, write to the Free Software
|
||||||
|
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ *
|
||||||
|
+ * exported fuctions:
|
||||||
|
+ *
|
||||||
|
+ * int drv_generic_spidev_open (const char *section, const char *driver)
|
||||||
|
+ * reads 'Port' entry from config and opens
|
||||||
|
+ * the SPI device
|
||||||
|
+ * returns 0 if ok, -1 on failure
|
||||||
|
+ *
|
||||||
|
+ * int drv_generic_spidev_close (void)
|
||||||
|
+ * closes SPI device
|
||||||
|
+ * returns 0 if ok, -1 on failure
|
||||||
|
+ *
|
||||||
|
+ * void drv_generic_spidev_transfer (int count, struct spi_ioc_transfer *tr)
|
||||||
|
+ * transfer data to/from the SPI device
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef _DRV_GENERIC_SPIDEV_H_
|
||||||
|
+#define _DRV_GENERIC_SPIDEV_H_
|
||||||
|
+
|
||||||
|
+#include <linux/spi/spidev.h>
|
||||||
|
+
|
||||||
|
+int drv_generic_spidev_open(const char *section, const char *driver);
|
||||||
|
+int drv_generic_spidev_close(void);
|
||||||
|
+int drv_generic_spidev_transfer(const int count, struct spi_ioc_transfer *tr);
|
||||||
|
+
|
||||||
|
+#endif /* _DRV_GENERIC_SPIDEV_H_ */
|
||||||
|
--- a/drivers.m4
|
||||||
|
+++ b/drivers.m4
|
||||||
|
@@ -301,6 +301,7 @@ PARPORT="no"
|
||||||
|
SERIAL="no"
|
||||||
|
I2C="no"
|
||||||
|
KEYPAD="no"
|
||||||
|
+SPIDEV="no"
|
||||||
|
|
||||||
|
# generic libraries
|
||||||
|
LIBUSB="no"
|
||||||
|
@@ -936,6 +937,12 @@ if test "$LIBJPEG" = "yes"; then
|
||||||
|
DRVLIBS="$DRVLIBS -ljpeg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
+# generic spidev driver
|
||||||
|
+if test "$SPIDEV" = "yes"; then
|
||||||
|
+ DRIVERS="$DRIVERS drv_generic_spidev.o"
|
||||||
|
+ AC_DEFINE(WITH_SPIDEV, 1, [SPIDEV driver])
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
# libusb
|
||||||
|
if test "$LIBUSB" = "yes"; then
|
||||||
|
DRVLIBS="$DRVLIBS -lusb"
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -115,6 +115,9 @@ AC_ARG_WITH(outb,
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([asm/io.h] [linux/parport.h linux/ppdev.h], [has_parport="true"], [has_parport="false"])
|
||||||
|
|
||||||
|
+# check for spidev
|
||||||
|
+AC_CHECK_HEADERS([linux/spi/spidev.h], [has_spidev="true"], [has_spidev="false"])
|
||||||
|
+
|
||||||
|
# drivers
|
||||||
|
sinclude(drivers.m4)
|
||||||
|
|
20
lcd4linux/patches/173-glcd2usb-bigendian-fix.patch
Executable file
20
lcd4linux/patches/173-glcd2usb-bigendian-fix.patch
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
--- a/drv_GLCD2USB.c
|
||||||
|
+++ b/drv_GLCD2USB.c
|
||||||
|
@@ -48,6 +48,7 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <usb.h>
|
||||||
|
+#include <endian.h>
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
#include "cfg.h"
|
||||||
|
@@ -487,6 +488,9 @@ static int drv_GLCD2USB_start(const char
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ buffer.display_info.width = le16toh(buffer.display_info.width);
|
||||||
|
+ buffer.display_info.height = le16toh(buffer.display_info.height);
|
||||||
|
+
|
||||||
|
info("%s: display name = %s", Name, buffer.display_info.name);
|
||||||
|
info("%s: display resolution = %d * %d", Name, buffer.display_info.width, buffer.display_info.height);
|
||||||
|
info("%s: display flags: %x", Name, buffer.display_info.flags);
|
0
libell/Makefile
Normal file → Executable file
0
libell/Makefile
Normal file → Executable file
|
@ -1,94 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (C) 2016 Velocloud Inc.
|
|
||||||
# Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=libmbim
|
|
||||||
PKG_SOURCE_VERSION:=1.29.2
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
|
|
||||||
#PKG_MIRROR_HASH:=0b0b46016738fc22355d5a58c8a2d1b2f04906c49c51a50b57a09640d13b00b7
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
include $(INCLUDE_DIR)/nls.mk
|
|
||||||
include $(INCLUDE_DIR)/meson.mk
|
|
||||||
|
|
||||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections -fno-merge-all-constants -fmerge-constants
|
|
||||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
|
||||||
|
|
||||||
MESON_ARGS += \
|
|
||||||
-Dintrospection=false \
|
|
||||||
-Dman=false \
|
|
||||||
-Dbash_completion=false \
|
|
||||||
-Db_lto=true
|
|
||||||
|
|
||||||
define Package/libmbim
|
|
||||||
SECTION:=libs
|
|
||||||
CATEGORY:=Libraries
|
|
||||||
DEPENDS:=+glib2
|
|
||||||
TITLE:=Helper library and utils to talk to MBIM enabled modems
|
|
||||||
URL:=https://www.freedesktop.org/wiki/Software/libmbim
|
|
||||||
LICENSE:=LGPL-2.0-or-later
|
|
||||||
LICENSE_FILES:=COPYING.LIB
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/libmbim/description
|
|
||||||
Helper library to talk to MBIM enabled modems.
|
|
||||||
Add mbim-utils for extra utilities.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/mbim-utils
|
|
||||||
SECTION:=utils
|
|
||||||
CATEGORY:=Utilities
|
|
||||||
DEPENDS:=+libmbim
|
|
||||||
TITLE:=Utilities to talk to MBIM enabled modems
|
|
||||||
URL:=https://www.freedesktop.org/wiki/Software/libmbim
|
|
||||||
LICENSE:=GPL-2.0-or-later
|
|
||||||
LICENSE_FILES:=COPYING
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/InstallDev
|
|
||||||
$(INSTALL_DIR) $(1)/usr/include
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/include/libmbim-glib \
|
|
||||||
$(1)/usr/include/
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/lib/libmbim*.so* \
|
|
||||||
$(1)/usr/lib/
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/mbim-glib.pc \
|
|
||||||
$(1)/usr/lib/pkgconfig
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/libmbim/install
|
|
||||||
$(INSTALL_DIR) \
|
|
||||||
$(1)/usr/lib \
|
|
||||||
$(1)/usr/libexec
|
|
||||||
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/lib/libmbim*.so.* \
|
|
||||||
$(1)/usr/lib/
|
|
||||||
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/mbim-proxy $(1)/usr/libexec/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/mbim-utils/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbimcli $(1)/usr/bin/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbim-network $(1)/usr/bin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,libmbim))
|
|
||||||
$(eval $(call BuildPackage,mbim-utils))
|
|
|
@ -1,31 +0,0 @@
|
||||||
menu "Configuration"
|
|
||||||
depends on PACKAGE_libqmi
|
|
||||||
|
|
||||||
config LIBQMI_WITH_MBIM_QMUX
|
|
||||||
bool "Include MBIM QMUX service support"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Compile libqmi with QMI-over-MBIM support
|
|
||||||
|
|
||||||
config LIBQMI_WITH_QRTR_GLIB
|
|
||||||
bool "Include QRTR support"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Compile libqmi with QRTR support
|
|
||||||
|
|
||||||
choice
|
|
||||||
prompt "Select QMI message collection to build"
|
|
||||||
default LIBQMI_COLLECTION_BASIC
|
|
||||||
|
|
||||||
config LIBQMI_COLLECTION_MINIMAL
|
|
||||||
depends on !MODEMMANAGER_WITH_QMI
|
|
||||||
bool "minimal"
|
|
||||||
|
|
||||||
config LIBQMI_COLLECTION_BASIC
|
|
||||||
bool "basic (default)"
|
|
||||||
|
|
||||||
config LIBQMI_COLLECTION_FULL
|
|
||||||
bool "full"
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
endmenu
|
|
111
libqmi/Makefile
111
libqmi/Makefile
|
@ -1,111 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (C) 2016 Velocloud Inc.
|
|
||||||
# Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=libqmi
|
|
||||||
PKG_SOURCE_VERSION:=1.33.3
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
|
|
||||||
#PKG_MIRROR_HASH:=711d16d75a6a9afaefcf2be1bc845a4a6181dff786dfbd079e41e91279a0be91
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
include $(INCLUDE_DIR)/nls.mk
|
|
||||||
include $(INCLUDE_DIR)/meson.mk
|
|
||||||
|
|
||||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections -fno-merge-all-constants -fmerge-constants
|
|
||||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
|
||||||
|
|
||||||
define Package/libqmi/config
|
|
||||||
source "$(SOURCE)/Config.in"
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/libqmi
|
|
||||||
SECTION:=libs
|
|
||||||
CATEGORY:=Libraries
|
|
||||||
DEPENDS:= \
|
|
||||||
+glib2 \
|
|
||||||
+LIBQMI_WITH_MBIM_QMUX:libmbim \
|
|
||||||
+LIBQMI_WITH_QRTR_GLIB:libqrtr-glib
|
|
||||||
TITLE:=Helper library to talk to QMI enabled modems
|
|
||||||
URL:=https://www.freedesktop.org/wiki/Software/libqmi
|
|
||||||
LICENSE:=LGPL-2.0-or-later
|
|
||||||
LICENSE_FILES:=COPYING.LIB
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/libqmi/description
|
|
||||||
Helper library talk to QMI enabled modems.
|
|
||||||
Add qmi-utils for extra utilities.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/qmi-utils
|
|
||||||
SECTION:=utils
|
|
||||||
CATEGORY:=Utilities
|
|
||||||
DEPENDS:=+libqmi
|
|
||||||
TITLE:=Utilities to talk to QMI enabled modems
|
|
||||||
URL:=https://www.freedesktop.org/wiki/Software/libqmi
|
|
||||||
LICENSE:=GPL-2.0-or-later
|
|
||||||
LICENSE_FILES:=COPYING
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/libqmi-utils/description
|
|
||||||
Utils to talk to QMI enabled modems
|
|
||||||
endef
|
|
||||||
|
|
||||||
MESON_ARGS += \
|
|
||||||
-Dudev=false \
|
|
||||||
-Dintrospection=false \
|
|
||||||
-Dman=false \
|
|
||||||
-Dbash_completion=false \
|
|
||||||
-Db_lto=true \
|
|
||||||
-Dmbim_qmux=$(if $(CONFIG_LIBQMI_WITH_MBIM_QMUX),true,false) \
|
|
||||||
-Dqrtr=$(if $(CONFIG_LIBQMI_WITH_QRTR_GLIB),true,false) \
|
|
||||||
-Dcollection=$(if $(CONFIG_LIBQMI_COLLECTION_MINIMAL),minimal\
|
|
||||||
,$(if $(CONFIG_LIBQMI_COLLECTION_BASIC),basic,full))
|
|
||||||
|
|
||||||
define Build/InstallDev
|
|
||||||
$(INSTALL_DIR) $(1)/usr/include
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/include/libqmi-glib \
|
|
||||||
$(1)/usr/include/
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/lib/libqmi*.so* \
|
|
||||||
$(1)/usr/lib/
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/qmi-glib.pc \
|
|
||||||
$(1)/usr/lib/pkgconfig
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/libqmi/install
|
|
||||||
$(INSTALL_DIR) \
|
|
||||||
$(1)/usr/lib \
|
|
||||||
$(1)/usr/libexec
|
|
||||||
|
|
||||||
$(CP) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/lib/libqmi*.so.* \
|
|
||||||
$(1)/usr/lib/
|
|
||||||
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/qmi-proxy $(1)/usr/libexec/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/qmi-utils/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qmicli $(1)/usr/bin/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qmi-network $(1)/usr/bin/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qmi-firmware-update $(1)/usr/bin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,libqmi))
|
|
||||||
$(eval $(call BuildPackage,qmi-utils))
|
|
57
luci-app-adguardhome/Makefile
Executable file
57
luci-app-adguardhome/Makefile
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
# Copyright (C) 2018-2019 Lienol
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=luci-app-adguardhome
|
||||||
|
PKG_MAINTAINER:=<https://github.com/rufengsuixing/luci-app-adguardhome>
|
||||||
|
|
||||||
|
LUCI_TITLE:=LuCI app for AdGuardHome
|
||||||
|
LUCI_PKGARCH:=all
|
||||||
|
LUCI_DEPENDS:=+ca-certs +curl +wget-ssl +PACKAGE_$(PKG_NAME)_INCLUDE_binary:adguardhome
|
||||||
|
LUCI_DESCRIPTION:=LuCI support for AdGuardHome
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/config
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_binary
|
||||||
|
bool "Include Binary File"
|
||||||
|
default y
|
||||||
|
endef
|
||||||
|
|
||||||
|
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_binary
|
||||||
|
|
||||||
|
define Package/luci-app-adguardhome/conffiles
|
||||||
|
/usr/share/AdGuardHome/links.txt
|
||||||
|
/etc/config/AdGuardHome
|
||||||
|
/etc/AdGuardHome.yaml
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/luci-app-adguardhome/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
/etc/init.d/AdGuardHome enable >/dev/null 2>&1
|
||||||
|
enable=$(uci get AdGuardHome.AdGuardHome.enabled 2>/dev/null)
|
||||||
|
if [ "$enable" == "1" ]; then
|
||||||
|
/etc/init.d/AdGuardHome reload
|
||||||
|
fi
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
rm -f /tmp/luci-modulecache/*
|
||||||
|
exit 0
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/luci-app-adguardhome/prerm
|
||||||
|
#!/bin/sh
|
||||||
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
|
/etc/init.d/AdGuardHome disable
|
||||||
|
/etc/init.d/AdGuardHome stop
|
||||||
|
uci -q batch <<-EOF >/dev/null 2>&1
|
||||||
|
delete ucitrack.@AdGuardHome[-1]
|
||||||
|
commit ucitrack
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
endef
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
130
luci-app-adguardhome/luasrc/controller/AdGuardHome.lua
Executable file
130
luci-app-adguardhome/luasrc/controller/AdGuardHome.lua
Executable file
|
@ -0,0 +1,130 @@
|
||||||
|
module("luci.controller.AdGuardHome",package.seeall)
|
||||||
|
local fs=require"nixio.fs"
|
||||||
|
local http=require"luci.http"
|
||||||
|
local uci=require"luci.model.uci".cursor()
|
||||||
|
function index()
|
||||||
|
local page = entry({"admin", "services", "AdGuardHome"},alias("admin", "services", "AdGuardHome", "base"),_("AdGuard Home"))
|
||||||
|
page.order = 10
|
||||||
|
page.dependent = true
|
||||||
|
page.acl_depends = { "luci-app-adguardhome" }
|
||||||
|
entry({"admin","services","AdGuardHome","base"},cbi("AdGuardHome/base"),_("Base Setting"),1).leaf = true
|
||||||
|
entry({"admin","services","AdGuardHome","log"},form("AdGuardHome/log"),_("Log"),2).leaf = true
|
||||||
|
entry({"admin","services","AdGuardHome","manual"},cbi("AdGuardHome/manual"),_("Manual Config"),3).leaf = true
|
||||||
|
entry({"admin","services","AdGuardHome","status"},call("act_status")).leaf=true
|
||||||
|
entry({"admin", "services", "AdGuardHome", "check"}, call("check_update"))
|
||||||
|
entry({"admin", "services", "AdGuardHome", "doupdate"}, call("do_update"))
|
||||||
|
entry({"admin", "services", "AdGuardHome", "getlog"}, call("get_log"))
|
||||||
|
entry({"admin", "services", "AdGuardHome", "dodellog"}, call("do_dellog"))
|
||||||
|
entry({"admin", "services", "AdGuardHome", "reloadconfig"}, call("reload_config"))
|
||||||
|
entry({"admin", "services", "AdGuardHome", "gettemplateconfig"}, call("get_template_config"))
|
||||||
|
end
|
||||||
|
function get_template_config()
|
||||||
|
local b
|
||||||
|
local d=""
|
||||||
|
for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do
|
||||||
|
b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$")
|
||||||
|
if (b~=nil) then
|
||||||
|
d=d.." - "..b.."\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local f=io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+")
|
||||||
|
local tbl = {}
|
||||||
|
local a=""
|
||||||
|
while (1) do
|
||||||
|
a=f:read("*l")
|
||||||
|
if (a=="#bootstrap_dns") then
|
||||||
|
a=d
|
||||||
|
elseif (a=="#upstream_dns") then
|
||||||
|
a=d
|
||||||
|
elseif (a==nil) then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
table.insert(tbl, a)
|
||||||
|
end
|
||||||
|
f:close()
|
||||||
|
http.prepare_content("text/plain; charset=utf-8")
|
||||||
|
http.write(table.concat(tbl, "\n"))
|
||||||
|
end
|
||||||
|
function reload_config()
|
||||||
|
fs.remove("/tmp/AdGuardHometmpconfig.yaml")
|
||||||
|
http.prepare_content("application/json")
|
||||||
|
http.write('')
|
||||||
|
end
|
||||||
|
function act_status()
|
||||||
|
local e={}
|
||||||
|
local binpath=uci:get("AdGuardHome","AdGuardHome","binpath")
|
||||||
|
e.running=luci.sys.call("pgrep "..binpath.." >/dev/null")==0
|
||||||
|
e.redirect=(fs.readfile("/var/run/AdGredir")=="1")
|
||||||
|
http.prepare_content("application/json")
|
||||||
|
http.write_json(e)
|
||||||
|
end
|
||||||
|
function do_update()
|
||||||
|
fs.writefile("/var/run/lucilogpos","0")
|
||||||
|
http.prepare_content("application/json")
|
||||||
|
http.write('')
|
||||||
|
local arg
|
||||||
|
if luci.http.formvalue("force") == "1" then
|
||||||
|
arg="force"
|
||||||
|
else
|
||||||
|
arg=""
|
||||||
|
end
|
||||||
|
if fs.access("/var/run/update_core") then
|
||||||
|
if arg=="force" then
|
||||||
|
luci.sys.exec("kill $(pgrep /usr/share/AdGuardHome/update_core.sh) ; sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 &")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
luci.sys.exec("sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 &")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function get_log()
|
||||||
|
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile")
|
||||||
|
if (logfile==nil) then
|
||||||
|
http.write("no log available\n")
|
||||||
|
return
|
||||||
|
elseif (logfile=="syslog") then
|
||||||
|
if not fs.access("/var/run/AdGuardHomesyslog") then
|
||||||
|
luci.sys.exec("(/usr/share/AdGuardHome/getsyslog.sh &); sleep 1;")
|
||||||
|
end
|
||||||
|
logfile="/tmp/AdGuardHometmp.log"
|
||||||
|
fs.writefile("/var/run/AdGuardHomesyslog","1")
|
||||||
|
elseif not fs.access(logfile) then
|
||||||
|
http.write("")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
http.prepare_content("text/plain; charset=utf-8")
|
||||||
|
local fdp
|
||||||
|
if fs.access("/var/run/lucilogreload") then
|
||||||
|
fdp=0
|
||||||
|
fs.remove("/var/run/lucilogreload")
|
||||||
|
else
|
||||||
|
fdp=tonumber(fs.readfile("/var/run/lucilogpos")) or 0
|
||||||
|
end
|
||||||
|
local f=io.open(logfile, "r+")
|
||||||
|
f:seek("set",fdp)
|
||||||
|
local a=f:read(2048000) or ""
|
||||||
|
fdp=f:seek()
|
||||||
|
fs.writefile("/var/run/lucilogpos",tostring(fdp))
|
||||||
|
f:close()
|
||||||
|
http.write(a)
|
||||||
|
end
|
||||||
|
function do_dellog()
|
||||||
|
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile")
|
||||||
|
fs.writefile(logfile,"")
|
||||||
|
http.prepare_content("application/json")
|
||||||
|
http.write('')
|
||||||
|
end
|
||||||
|
function check_update()
|
||||||
|
http.prepare_content("text/plain; charset=utf-8")
|
||||||
|
local fdp=tonumber(fs.readfile("/var/run/lucilogpos")) or 0
|
||||||
|
local f=io.open("/tmp/AdGuardHome_update.log", "r+")
|
||||||
|
f:seek("set",fdp)
|
||||||
|
local a=f:read(2048000) or ""
|
||||||
|
fdp=f:seek()
|
||||||
|
fs.writefile("/var/run/lucilogpos",tostring(fdp))
|
||||||
|
f:close()
|
||||||
|
if fs.access("/var/run/update_core") then
|
||||||
|
http.write(a)
|
||||||
|
else
|
||||||
|
http.write(a.."\0")
|
||||||
|
end
|
||||||
|
end
|
304
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua
Executable file
304
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua
Executable file
|
@ -0,0 +1,304 @@
|
||||||
|
require("luci.sys")
|
||||||
|
require("luci.util")
|
||||||
|
require("io")
|
||||||
|
local m,s,o,o1
|
||||||
|
local fs=require"nixio.fs"
|
||||||
|
local uci=require"luci.model.uci".cursor()
|
||||||
|
local configpath=uci:get("AdGuardHome","AdGuardHome","configpath") or "/etc/AdGuardHome.yaml"
|
||||||
|
local binpath=uci:get("AdGuardHome","AdGuardHome","binpath") or "/usr/bin/AdGuardHome"
|
||||||
|
httpport=uci:get("AdGuardHome","AdGuardHome","httpport") or "3000"
|
||||||
|
m = Map("AdGuardHome", "AdGuard Home")
|
||||||
|
m.description = translate("Free and open source, powerful network-wide ads & trackers blocking DNS server.")
|
||||||
|
m:section(SimpleSection).template = "AdGuardHome/AdGuardHome_status"
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "AdGuardHome")
|
||||||
|
s.anonymous=true
|
||||||
|
s.addremove=false
|
||||||
|
---- enable
|
||||||
|
o = s:option(Flag, "enabled", translate("Enable"))
|
||||||
|
o.default = 0
|
||||||
|
o.optional = false
|
||||||
|
---- httpport
|
||||||
|
o =s:option(Value,"httpport",translate("Browser management port"))
|
||||||
|
o.placeholder=3000
|
||||||
|
o.default=3000
|
||||||
|
o.datatype="port"
|
||||||
|
o.optional = false
|
||||||
|
o.description = translate("<input type=\"button\" style=\"width:210px;border-color:Teal; text-align:center;font-weight:bold;color:Green;\" value=\"AdGuardHome Web:"..httpport.."\" onclick=\"window.open('http://'+window.location.hostname+':"..httpport.."/')\"/>")
|
||||||
|
---- update warning not safe
|
||||||
|
local binmtime=uci:get("AdGuardHome","AdGuardHome","binmtime") or "0"
|
||||||
|
local e=""
|
||||||
|
if not fs.access(configpath) then
|
||||||
|
e=e.." "..translate("no config")
|
||||||
|
end
|
||||||
|
if not fs.access(binpath) then
|
||||||
|
e=e.." "..translate("no core")
|
||||||
|
else
|
||||||
|
local version=uci:get("AdGuardHome","AdGuardHome","version")
|
||||||
|
local testtime=fs.stat(binpath,"mtime")
|
||||||
|
if testtime~=tonumber(binmtime) or version==nil then
|
||||||
|
local tmp=luci.sys.exec(binpath.." --version | grep -m 1 -E 'v[0-9.]+' -o ")
|
||||||
|
version=string.sub(tmp, 1)
|
||||||
|
if version=="" then version="core error" end
|
||||||
|
uci:set("AdGuardHome","AdGuardHome","version",version)
|
||||||
|
uci:set("AdGuardHome","AdGuardHome","binmtime",testtime)
|
||||||
|
uci:save("AdGuardHome")
|
||||||
|
end
|
||||||
|
e=version..e
|
||||||
|
end
|
||||||
|
o=s:option(Button,"restart",translate("Update"))
|
||||||
|
o.inputtitle=translate("Update core version")
|
||||||
|
o.template = "AdGuardHome/AdGuardHome_check"
|
||||||
|
o.showfastconfig=(not fs.access(configpath))
|
||||||
|
o.description=string.format(translate("core version:").."<strong><font id=\"updateversion\" color=\"green\">%s </font></strong>",e)
|
||||||
|
---- port warning not safe
|
||||||
|
local port=luci.sys.exec("awk '/ port:/{printf($2);exit;}' "..configpath.." 2>nul")
|
||||||
|
if (port=="") then port="?" end
|
||||||
|
---- Redirect
|
||||||
|
o = s:option(ListValue, "redirect", port..translate("Redirect"), translate("AdGuardHome redirect mode"))
|
||||||
|
o.placeholder = "none"
|
||||||
|
o:value("none", translate("none"))
|
||||||
|
o:value("dnsmasq-upstream", translate("Run as dnsmasq upstream server"))
|
||||||
|
o:value("redirect", translate("Redirect 53 port to AdGuardHome"))
|
||||||
|
o:value("exchange", translate("Use port 53 replace dnsmasq"))
|
||||||
|
o.default = "none"
|
||||||
|
o.optional = true
|
||||||
|
---- bin path
|
||||||
|
o = s:option(Value, "binpath", translate("Bin Path"), translate("AdGuardHome Bin path if no bin will auto download"))
|
||||||
|
o.default = "/usr/bin/AdGuardHome"
|
||||||
|
o.datatype = "string"
|
||||||
|
o.optional = false
|
||||||
|
o.rmempty=false
|
||||||
|
o.validate=function(self, value)
|
||||||
|
if value=="" then return nil end
|
||||||
|
if fs.stat(value,"type")=="dir" then
|
||||||
|
fs.rmdir(value)
|
||||||
|
end
|
||||||
|
if fs.stat(value,"type")=="dir" then
|
||||||
|
if (m.message) then
|
||||||
|
m.message =m.message.."\nerror!bin path is a dir"
|
||||||
|
else
|
||||||
|
m.message ="error!bin path is a dir"
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
--- upx
|
||||||
|
o = s:option(ListValue, "upxflag", translate("use upx to compress bin after download"))
|
||||||
|
o:value("", translate("none"))
|
||||||
|
o:value("-1", translate("compress faster"))
|
||||||
|
o:value("-9", translate("compress better"))
|
||||||
|
o:value("--best", translate("compress best(can be slow for big files)"))
|
||||||
|
o:value("--brute", translate("try all available compression methods & filters [slow]"))
|
||||||
|
o:value("--ultra-brute", translate("try even more compression variants [very slow]"))
|
||||||
|
o.default = ""
|
||||||
|
o.description=translate("bin use less space,but may have compatibility issues")
|
||||||
|
o.rmempty = true
|
||||||
|
---- config path
|
||||||
|
o = s:option(Value, "configpath", translate("Config Path"), translate("AdGuardHome config path"))
|
||||||
|
o.default = "/etc/AdGuardHome.yaml"
|
||||||
|
o.datatype = "string"
|
||||||
|
o.optional = false
|
||||||
|
o.rmempty=false
|
||||||
|
o.validate=function(self, value)
|
||||||
|
if value==nil then return nil end
|
||||||
|
if fs.stat(value,"type")=="dir" then
|
||||||
|
fs.rmdir(value)
|
||||||
|
end
|
||||||
|
if fs.stat(value,"type")=="dir" then
|
||||||
|
if m.message then
|
||||||
|
m.message =m.message.."\nerror!config path is a dir"
|
||||||
|
else
|
||||||
|
m.message ="error!config path is a dir"
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
---- work dir
|
||||||
|
o = s:option(Value, "workdir", translate("Work dir"), translate("AdGuardHome work dir include rules,audit log and database"))
|
||||||
|
o.default = "/etc/AdGuardHome"
|
||||||
|
o.datatype = "string"
|
||||||
|
o.optional = false
|
||||||
|
o.rmempty=false
|
||||||
|
o.validate=function(self, value)
|
||||||
|
if value=="" then return nil end
|
||||||
|
if fs.stat(value,"type")=="reg" then
|
||||||
|
if m.message then
|
||||||
|
m.message =m.message.."\nerror!work dir is a file"
|
||||||
|
else
|
||||||
|
m.message ="error!work dir is a file"
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if string.sub(value, -1)=="/" then
|
||||||
|
return string.sub(value, 1, -2)
|
||||||
|
else
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
---- log file
|
||||||
|
o = s:option(Value, "logfile", translate("Runtime log file"), translate("AdGuardHome runtime Log file if 'syslog': write to system log;if empty no log"))
|
||||||
|
o.datatype = "string"
|
||||||
|
o.rmempty = true
|
||||||
|
o.validate=function(self, value)
|
||||||
|
if fs.stat(value,"type")=="dir" then
|
||||||
|
fs.rmdir(value)
|
||||||
|
end
|
||||||
|
if fs.stat(value,"type")=="dir" then
|
||||||
|
if m.message then
|
||||||
|
m.message =m.message.."\nerror!log file is a dir"
|
||||||
|
else
|
||||||
|
m.message ="error!log file is a dir"
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
---- debug
|
||||||
|
o = s:option(Flag, "verbose", translate("Verbose log"))
|
||||||
|
o.default = 0
|
||||||
|
o.optional = true
|
||||||
|
---- gfwlist
|
||||||
|
local a=luci.sys.call("grep -m 1 -q programadd "..configpath)
|
||||||
|
if (a==0) then
|
||||||
|
a="Added"
|
||||||
|
else
|
||||||
|
a="Not added"
|
||||||
|
end
|
||||||
|
o=s:option(Button,"gfwdel",translate("Del gfwlist"),translate(a))
|
||||||
|
o.optional = true
|
||||||
|
o.inputtitle=translate("Del")
|
||||||
|
o.write=function()
|
||||||
|
luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh del 2>&1")
|
||||||
|
luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome"))
|
||||||
|
end
|
||||||
|
o=s:option(Button,"gfwadd",translate("Add gfwlist"),translate(a))
|
||||||
|
o.optional = true
|
||||||
|
o.inputtitle=translate("Add")
|
||||||
|
o.write=function()
|
||||||
|
luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh 2>&1")
|
||||||
|
luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome"))
|
||||||
|
end
|
||||||
|
o = s:option(Value, "gfwupstream", translate("Gfwlist upstream dns server"), translate("Gfwlist domain upstream dns service")..translate(a))
|
||||||
|
o.default = "tcp://208.67.220.220:5353"
|
||||||
|
o.datatype = "string"
|
||||||
|
o.optional = true
|
||||||
|
---- chpass
|
||||||
|
o = s:option(Value, "hashpass", translate("Change browser management password"), translate("Press load culculate model and culculate finally save/apply"))
|
||||||
|
o.default = ""
|
||||||
|
o.datatype = "string"
|
||||||
|
o.template = "AdGuardHome/AdGuardHome_chpass"
|
||||||
|
o.optional = true
|
||||||
|
---- upgrade protect
|
||||||
|
o = s:option(MultiValue, "upprotect", translate("Keep files when system upgrade"))
|
||||||
|
o:value("$binpath",translate("core bin"))
|
||||||
|
o:value("$configpath",translate("config file"))
|
||||||
|
o:value("$logfile",translate("log file"))
|
||||||
|
o:value("$workdir/data/sessions.db",translate("sessions.db"))
|
||||||
|
o:value("$workdir/data/stats.db",translate("stats.db"))
|
||||||
|
o:value("$workdir/data/querylog.json",translate("querylog.json"))
|
||||||
|
o:value("$workdir/data/filters",translate("filters"))
|
||||||
|
o.widget = "checkbox"
|
||||||
|
o.default = nil
|
||||||
|
o.optional=true
|
||||||
|
---- wait net on boot
|
||||||
|
o = s:option(Flag, "waitonboot", translate("On boot when network ok restart"))
|
||||||
|
o.default = 1
|
||||||
|
o.optional = true
|
||||||
|
---- backup workdir on shutdown
|
||||||
|
local workdir=uci:get("AdGuardHome","AdGuardHome","workdir") or "/etc/AdGuardHome"
|
||||||
|
o = s:option(MultiValue, "backupfile", translate("Backup workdir files when shutdown"))
|
||||||
|
o1 = s:option(Value, "backupwdpath", translate("Backup workdir path"))
|
||||||
|
local name
|
||||||
|
o:value("filters","filters")
|
||||||
|
o:value("stats.db","stats.db")
|
||||||
|
o:value("querylog.json","querylog.json")
|
||||||
|
o:value("sessions.db","sessions.db")
|
||||||
|
o1:depends ("backupfile", "filters")
|
||||||
|
o1:depends ("backupfile", "stats.db")
|
||||||
|
o1:depends ("backupfile", "querylog.json")
|
||||||
|
o1:depends ("backupfile", "sessions.db")
|
||||||
|
for name in fs.glob(workdir.."/data/*")
|
||||||
|
do
|
||||||
|
name=fs.basename (name)
|
||||||
|
if name~="filters" and name~="stats.db" and name~="querylog.json" and name~="sessions.db" then
|
||||||
|
o:value(name,name)
|
||||||
|
o1:depends ("backupfile", name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
o.widget = "checkbox"
|
||||||
|
o.default = nil
|
||||||
|
o.optional=false
|
||||||
|
o.description=translate("Will be restore when workdir/data is empty")
|
||||||
|
----backup workdir path
|
||||||
|
|
||||||
|
o1.default = "/etc/AdGuardHome"
|
||||||
|
o1.datatype = "string"
|
||||||
|
o1.optional = false
|
||||||
|
o1.validate=function(self, value)
|
||||||
|
if fs.stat(value,"type")=="reg" then
|
||||||
|
if m.message then
|
||||||
|
m.message =m.message.."\nerror!backup dir is a file"
|
||||||
|
else
|
||||||
|
m.message ="error!backup dir is a file"
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if string.sub(value,-1)=="/" then
|
||||||
|
return string.sub(value, 1, -2)
|
||||||
|
else
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
----Crontab
|
||||||
|
o = s:option(MultiValue, "crontab", translate("Crontab task"),translate("Please change time and args in crontab"))
|
||||||
|
o:value("autoupdate",translate("Auto update core"))
|
||||||
|
o:value("cutquerylog",translate("Auto tail querylog"))
|
||||||
|
o:value("cutruntimelog",translate("Auto tail runtime log"))
|
||||||
|
o:value("autohost",translate("Auto update ipv6 hosts and restart adh"))
|
||||||
|
o:value("autogfw",translate("Auto update gfwlist and restart adh"))
|
||||||
|
o.widget = "checkbox"
|
||||||
|
o.default = nil
|
||||||
|
o.optional=true
|
||||||
|
|
||||||
|
----downloadpath
|
||||||
|
o = s:option(TextValue, "downloadlinks",translate("Download links for update"))
|
||||||
|
o.optional = false
|
||||||
|
o.rows = 4
|
||||||
|
o.wrap = "soft"
|
||||||
|
o.cfgvalue = function(self, section)
|
||||||
|
return fs.readfile("/usr/share/AdGuardHome/links.txt")
|
||||||
|
end
|
||||||
|
o.write = function(self, section, value)
|
||||||
|
fs.writefile("/usr/share/AdGuardHome/links.txt", value:gsub("\r\n", "\n"))
|
||||||
|
end
|
||||||
|
fs.writefile("/var/run/lucilogpos","0")
|
||||||
|
function m.on_commit(map)
|
||||||
|
if (fs.access("/var/run/AdGserverdis")) then
|
||||||
|
io.popen("/etc/init.d/AdGuardHome reload &")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ucitracktest=uci:get("AdGuardHome","AdGuardHome","ucitracktest")
|
||||||
|
if ucitracktest=="1" then
|
||||||
|
return
|
||||||
|
elseif ucitracktest=="0" then
|
||||||
|
io.popen("/etc/init.d/AdGuardHome reload &")
|
||||||
|
else
|
||||||
|
if (fs.access("/var/run/AdGlucitest")) then
|
||||||
|
uci:set("AdGuardHome","AdGuardHome","ucitracktest","0")
|
||||||
|
io.popen("/etc/init.d/AdGuardHome reload &")
|
||||||
|
else
|
||||||
|
fs.writefile("/var/run/AdGlucitest","")
|
||||||
|
if (ucitracktest=="2") then
|
||||||
|
uci:set("AdGuardHome","AdGuardHome","ucitracktest","1")
|
||||||
|
else
|
||||||
|
uci:set("AdGuardHome","AdGuardHome","ucitracktest","2")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
uci:save("AdGuardHome")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return m
|
16
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua
Executable file
16
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/log.lua
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
local fs=require"nixio.fs"
|
||||||
|
local uci=require"luci.model.uci".cursor()
|
||||||
|
local f,t
|
||||||
|
f=SimpleForm("logview")
|
||||||
|
f.reset = false
|
||||||
|
f.submit = false
|
||||||
|
t=f:field(TextValue,"conf")
|
||||||
|
t.rmempty=true
|
||||||
|
t.rows=20
|
||||||
|
t.template="AdGuardHome/log"
|
||||||
|
t.readonly="readonly"
|
||||||
|
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile") or ""
|
||||||
|
t.timereplace=(logfile~="syslog" and logfile~="" )
|
||||||
|
t.pollcheck=logfile~=""
|
||||||
|
fs.writefile("/var/run/lucilogreload","")
|
||||||
|
return f
|
97
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua
Executable file
97
luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua
Executable file
|
@ -0,0 +1,97 @@
|
||||||
|
local m, s, o
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
local uci=require"luci.model.uci".cursor()
|
||||||
|
local sys=require"luci.sys"
|
||||||
|
require("string")
|
||||||
|
require("io")
|
||||||
|
require("table")
|
||||||
|
function gen_template_config()
|
||||||
|
local b
|
||||||
|
local d=""
|
||||||
|
for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do
|
||||||
|
b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$")
|
||||||
|
if (b~=nil) then
|
||||||
|
d=d.." - "..b.."\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local f=io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+")
|
||||||
|
local tbl = {}
|
||||||
|
local a=""
|
||||||
|
while (1) do
|
||||||
|
a=f:read("*l")
|
||||||
|
if (a=="#bootstrap_dns") then
|
||||||
|
a=d
|
||||||
|
elseif (a=="#upstream_dns") then
|
||||||
|
a=d
|
||||||
|
elseif (a==nil) then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
table.insert(tbl, a)
|
||||||
|
end
|
||||||
|
f:close()
|
||||||
|
return table.concat(tbl, "\n")
|
||||||
|
end
|
||||||
|
m = Map("AdGuardHome")
|
||||||
|
local configpath = uci:get("AdGuardHome","AdGuardHome","configpath")
|
||||||
|
local binpath = uci:get("AdGuardHome","AdGuardHome","binpath")
|
||||||
|
s = m:section(TypedSection, "AdGuardHome")
|
||||||
|
s.anonymous=true
|
||||||
|
s.addremove=false
|
||||||
|
--- config
|
||||||
|
o = s:option(TextValue, "escconf")
|
||||||
|
o.rows = 66
|
||||||
|
o.wrap = "off"
|
||||||
|
o.rmempty = true
|
||||||
|
o.cfgvalue = function(self, section)
|
||||||
|
return fs.readfile("/tmp/AdGuardHometmpconfig.yaml") or fs.readfile(configpath) or gen_template_config() or ""
|
||||||
|
end
|
||||||
|
o.validate=function(self, value)
|
||||||
|
fs.writefile("/tmp/AdGuardHometmpconfig.yaml", value:gsub("\r\n", "\n"))
|
||||||
|
if fs.access(binpath) then
|
||||||
|
if (sys.call(binpath.." -c /tmp/AdGuardHometmpconfig.yaml --check-config 2> /tmp/AdGuardHometest.log")==0) then
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome","manual"))
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
o.write = function(self, section, value)
|
||||||
|
fs.move("/tmp/AdGuardHometmpconfig.yaml",configpath)
|
||||||
|
end
|
||||||
|
o.remove = function(self, section, value)
|
||||||
|
fs.writefile(configpath, "")
|
||||||
|
end
|
||||||
|
--- js and reload button
|
||||||
|
o = s:option(DummyValue, "")
|
||||||
|
o.anonymous=true
|
||||||
|
o.template = "AdGuardHome/yamleditor"
|
||||||
|
if not fs.access(binpath) then
|
||||||
|
o.description=translate("WARNING!!! no bin found apply config will not be test")
|
||||||
|
end
|
||||||
|
--- log
|
||||||
|
if (fs.access("/tmp/AdGuardHometmpconfig.yaml")) then
|
||||||
|
local c=fs.readfile("/tmp/AdGuardHometest.log")
|
||||||
|
if (c~="") then
|
||||||
|
o = s:option(TextValue, "")
|
||||||
|
o.readonly=true
|
||||||
|
o.rows = 5
|
||||||
|
o.rmempty = true
|
||||||
|
o.name=""
|
||||||
|
o.cfgvalue = function(self, section)
|
||||||
|
return fs.readfile("/tmp/AdGuardHometest.log")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function m.on_commit(map)
|
||||||
|
local ucitracktest=uci:get("AdGuardHome","AdGuardHome","ucitracktest")
|
||||||
|
if ucitracktest=="1" then
|
||||||
|
return
|
||||||
|
elseif ucitracktest=="0" then
|
||||||
|
io.popen("/etc/init.d/AdGuardHome reload &")
|
||||||
|
else
|
||||||
|
fs.writefile("/var/run/AdGlucitest","")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return m
|
78
luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm
Executable file
78
luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm
Executable file
|
@ -0,0 +1,78 @@
|
||||||
|
<%+cbi/valueheader%>
|
||||||
|
<%local fs=require"nixio.fs"%>
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:Update core version%>" onclick=" return apply_update() "/>
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_forceupdate_button" value="<%:Force update%>" onclick=" return apply_forceupdate()" style="display:none"/>
|
||||||
|
<% if self.showfastconfig then %>
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" id="to_configpage" value="<%:Fast config%>" onclick="location.href='<%=url([[admin]], [[services]], [[AdGuardHome]], [[manual]])%>'"/>
|
||||||
|
<%end%>
|
||||||
|
<div id="logview" style="display:none">
|
||||||
|
<input type="checkbox" id="reversetag" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;"><%:reverse%></input>
|
||||||
|
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:block;" data-update="change" rows="5" cols="60" readonly="readonly" > </textarea>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
var updatebtn = document.getElementById('apply_update_button');
|
||||||
|
var forceupdatebtn = document.getElementById('apply_forceupdate_button');
|
||||||
|
var islogreverse = false;
|
||||||
|
function apply_forceupdate(){
|
||||||
|
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',{ force: 1 },function(x, data){}
|
||||||
|
);
|
||||||
|
updatebtn.disabled = true;
|
||||||
|
poll_check();
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function reverselog(){
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
|
||||||
|
if (islogreverse){
|
||||||
|
islogreverse=false;
|
||||||
|
}else{
|
||||||
|
islogreverse=true;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function apply_update(){
|
||||||
|
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',null,function(x, data){}
|
||||||
|
);
|
||||||
|
updatebtn.disabled = true;
|
||||||
|
updatebtn.value = '<%:Check...%>';
|
||||||
|
forceupdatebtn.style.display="inline"
|
||||||
|
poll_check();
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function poll_check(){
|
||||||
|
var tag = document.getElementById('logview');
|
||||||
|
tag.style.display="block"
|
||||||
|
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[check]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
if (x.responseText && lv) {
|
||||||
|
if (x.responseText=="\u0000"){
|
||||||
|
for(j = 0,len=this.XHR._q.length; j < len; j++) {
|
||||||
|
if (this.XHR._q[j].url == '<%=url([[admin]], [[services]], [[AdGuardHome]], [[check]])%>'){
|
||||||
|
this.XHR._q.splice(j,1);
|
||||||
|
updatebtn.disabled = false;
|
||||||
|
updatebtn.value = '<%:Updated%>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (islogreverse){
|
||||||
|
lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
|
||||||
|
}else{
|
||||||
|
lv.innerHTML += x.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);}
|
||||||
|
<% if fs.access("/var/run/update_core") then %>
|
||||||
|
updatebtn.disabled = true;
|
||||||
|
updatebtn.value = '<%:Check...%>';
|
||||||
|
forceupdatebtn.style.display="inline"
|
||||||
|
poll_check();
|
||||||
|
<%elseif fs.access("/var/run/update_core_error") then %>
|
||||||
|
poll_check();
|
||||||
|
<%end%>
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<%+cbi/valuefooter%>
|
49
luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm
Executable file
49
luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
<%+cbi/valueheader%>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
function chpass(btn)
|
||||||
|
{
|
||||||
|
btn.disabled = true;
|
||||||
|
btn.value = '<%:loading...%>';
|
||||||
|
if (typeof bcryptloaded == 'undefined' ){
|
||||||
|
var theHead = document.getElementsByTagName('head').item(0);
|
||||||
|
//创建脚本的dom对象实例
|
||||||
|
var myScript = document.createElement('script');
|
||||||
|
myScript.src = '<%=resource%>/twin-bcrypt.min.js'; //指定脚本路径
|
||||||
|
myScript.type = 'text/javascript'; //指定脚本类型
|
||||||
|
myScript.defer = true; //程序下载完后再解析和执行
|
||||||
|
theHead.appendChild(myScript);
|
||||||
|
bcryptloaded=1;
|
||||||
|
btn.value = '<%:Culculate%>';
|
||||||
|
btn.disabled = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var lv = document.getElementById('cbid.AdGuardHome.AdGuardHome.hashpass');
|
||||||
|
if (lv.value != ""){
|
||||||
|
var hash = TwinBcrypt.hashSync(lv.value);
|
||||||
|
lv.value=hash;
|
||||||
|
btn.value = '<%:Please save/apply%>';
|
||||||
|
}else{
|
||||||
|
btn.value = '<%:is empty%>';
|
||||||
|
btn.disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<input data-update="change"<%=
|
||||||
|
attr("id", cbid) ..
|
||||||
|
attr("name", cbid) ..
|
||||||
|
attr("type", self.password and "password" or "text") ..
|
||||||
|
attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
|
||||||
|
attr("value", self:cfgvalue(section) or self.default) ..
|
||||||
|
ifattr(self.size, "size") ..
|
||||||
|
ifattr(self.placeholder, "placeholder") ..
|
||||||
|
ifattr(self.readonly, "readonly") ..
|
||||||
|
ifattr(self.maxlength, "maxlength") ..
|
||||||
|
ifattr(self.datatype, "data-type", self.datatype) ..
|
||||||
|
ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
|
||||||
|
ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
|
||||||
|
ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
|
||||||
|
%> />
|
||||||
|
<% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" id="cbid.AdGuardHome.AdGuardHome.applychpass" value="<%:Load culculate model%>" onclick="return chpass(this)"/>
|
||||||
|
<%+cbi/valuefooter%>
|
27
luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm
Executable file
27
luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[status]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var tb = document.getElementById('AdGuardHome_status');
|
||||||
|
if (data && tb) {
|
||||||
|
if (data.running) {
|
||||||
|
tb.innerHTML = '<em><b><font color=green>AdGuardHome <%:RUNNING%></font></b></em>';
|
||||||
|
} else {
|
||||||
|
tb.innerHTML = '<em><b><font color=red>AdGuardHome <%:NOT RUNNING%></font></b></em>';
|
||||||
|
}
|
||||||
|
if (data.redirect)
|
||||||
|
{
|
||||||
|
tb.innerHTML+='<em><b><font color=green><%:Redirected%></font></b></em>'
|
||||||
|
} else {
|
||||||
|
tb.innerHTML+='<em><b><font color=red><%:Not redirect%></font></b></em>'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="AdGuardHome_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
111
luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm
Executable file
111
luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm
Executable file
|
@ -0,0 +1,111 @@
|
||||||
|
<%+cbi/valueheader%>
|
||||||
|
<input type="checkbox" name="NAME" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;" checked><%:reverse%></input>
|
||||||
|
<%if self.timereplace then%>
|
||||||
|
<input type="checkbox" name="NAME" value="localtime" onclick=" return chlogtime()" style="vertical-align:middle;height: auto;" checked><%:localtime%></input><br>
|
||||||
|
<%end%>
|
||||||
|
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" > </textarea>
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:dellog%>" onclick=" return apply_del_log() "/>
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:download log%>" style=" display:inline;" onclick=" return download_log()" />
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
var islogreverse = true;
|
||||||
|
var isutc2local = <%=tostring(self.timereplace)%>;
|
||||||
|
function createAndDownloadFile(fileName, content) {
|
||||||
|
var aTag = document.createElement('a');
|
||||||
|
var blob = new Blob([content]);
|
||||||
|
aTag.download = fileName;
|
||||||
|
aTag.href = URL.createObjectURL(blob);
|
||||||
|
aTag.click();
|
||||||
|
URL.revokeObjectURL(blob);
|
||||||
|
}
|
||||||
|
function download_log(){
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
var dt = new Date();
|
||||||
|
var timestamp = (dt.getMonth()+1)+"-"+dt.getDate()+"-"+dt.getHours()+"_"+dt.getMinutes();
|
||||||
|
createAndDownloadFile("AdGuardHome"+timestamp+".log",lv.innerHTML)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function apply_del_log(){
|
||||||
|
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[dodellog]])%>',null,function(x, data){
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
lv.innerHTML="";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function chlogtime(){
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
if (isutc2local){
|
||||||
|
lv.innerHTML=line_toUTC(lv.innerHTML).join('\n');
|
||||||
|
isutc2local=false;
|
||||||
|
}else{
|
||||||
|
lv.innerHTML=line_tolocal(lv.innerHTML).join('\n');
|
||||||
|
isutc2local=true;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function reverselog(){
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
|
||||||
|
if (islogreverse){
|
||||||
|
islogreverse=false;
|
||||||
|
}else{
|
||||||
|
islogreverse=true;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
function p(s) {
|
||||||
|
return s < 10 ? '0' + s: s;
|
||||||
|
}
|
||||||
|
function line_tolocal(str){
|
||||||
|
var strt=new Array();
|
||||||
|
str.trim().split('\n').forEach(function(v, i) {
|
||||||
|
var dt = new Date(v.substring(0,19)+" UTC");
|
||||||
|
if (dt != "Invalid Date"){
|
||||||
|
strt[i]=dt.getFullYear()+"/"+p(dt.getMonth()+1)+"/"+p(dt.getDate())+" "+p(dt.getHours())+":"+p(dt.getMinutes())+":"+p(dt.getSeconds())+v.substring(19);
|
||||||
|
}else{
|
||||||
|
strt[i]=v;}})
|
||||||
|
return strt
|
||||||
|
}
|
||||||
|
function line_toUTC(str){
|
||||||
|
var strt=new Array();
|
||||||
|
str.trim().split('\n').forEach(function(v, i) {
|
||||||
|
var dt = new Date(v.substring(0,19))
|
||||||
|
if (dt != "Invalid Date"){
|
||||||
|
strt[i]=dt.getUTCFullYear()+"/"+p(dt.getUTCMonth()+1)+"/"+p(dt.getUTCDate())+" "+p(dt.getUTCHours())+":"+p(dt.getUTCMinutes())+":"+p(dt.getUTCSeconds())+v.substring(19);
|
||||||
|
}else{
|
||||||
|
strt[i]=v;}})
|
||||||
|
return strt
|
||||||
|
}
|
||||||
|
function poll_check(){
|
||||||
|
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[getlog]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
if (x.responseText && lv) {
|
||||||
|
if (isutc2local)
|
||||||
|
{
|
||||||
|
var lines=line_toUTC(x.responseText);
|
||||||
|
if (islogreverse){
|
||||||
|
lv.innerHTML = lines.reverse().join('\n')+lv.innerHTML;
|
||||||
|
}else{
|
||||||
|
lv.innerHTML += lines.join('\n');
|
||||||
|
}
|
||||||
|
lv.innerHTML=line_tolocal(lv.innerHTML).join('\n');
|
||||||
|
}else{
|
||||||
|
if (islogreverse){
|
||||||
|
lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
|
||||||
|
}else{
|
||||||
|
lv.innerHTML += x.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);}
|
||||||
|
<%if self.pollcheck then%>
|
||||||
|
poll_check();
|
||||||
|
<%else%>
|
||||||
|
var lv = document.getElementById('cbid.logview.1.conf');
|
||||||
|
lv.innerHTML="<%:Please add log path in config to enable log%>"
|
||||||
|
<%end%>
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<%+cbi/valuefooter%>
|
39
luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm
Executable file
39
luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
<%+cbi/valueheader%>
|
||||||
|
<script src="/luci-static/resources/codemirror/lib/codemirror.js"></script>
|
||||||
|
<link rel="stylesheet" href="/luci-static/resources/codemirror/lib/codemirror.css"/>
|
||||||
|
<script src="/luci-static/resources/codemirror/mode/yaml/yaml.js"></script>
|
||||||
|
<link rel="stylesheet" href="/luci-static/resources/codemirror/theme/dracula.css"/>
|
||||||
|
<link rel="stylesheet" href="/luci-static/resources/codemirror/addon/fold/foldgutter.css"/>
|
||||||
|
<script src="/luci-static/resources/codemirror/addon/fold/foldcode.js"></script>
|
||||||
|
<script src="/luci-static/resources/codemirror/addon/fold/foldgutter.js"></script>
|
||||||
|
<script src="/luci-static/resources/codemirror/addon/fold/indent-fold.js"></script>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
var editor = CodeMirror.fromTextArea(document.getElementById("cbid.AdGuardHome.AdGuardHome.escconf"), {
|
||||||
|
mode: "text/yaml", //实现groovy代码高亮
|
||||||
|
styleActiveLine: true,
|
||||||
|
lineNumbers: true, //显示行号
|
||||||
|
theme: "dracula", //设置主题
|
||||||
|
lineWrapping: true, //代码折叠
|
||||||
|
foldGutter: true,
|
||||||
|
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
||||||
|
matchBrackets: true //括号匹配
|
||||||
|
}
|
||||||
|
);
|
||||||
|
function reload_config(){
|
||||||
|
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[reloadconfig]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
location.reload();
|
||||||
|
});}
|
||||||
|
function use_template(){
|
||||||
|
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[gettemplateconfig]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
editor.setValue(x.responseText)
|
||||||
|
});}
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<%fs=require"nixio.fs"%>
|
||||||
|
<%if fs.access("/tmp/AdGuardHometmpconfig.yaml") then%>
|
||||||
|
<input type="button" id="apply_update_button" value="<%:Reload Config%>" onclick=" return reload_config() "/>
|
||||||
|
<%end%>
|
||||||
|
<input type="button" id="template_button" value="<%:Use template%>" onclick=" return use_template() "/>
|
||||||
|
<%+cbi/valuefooter%>
|
1
luci-app-adguardhome/po/zh-cn
Executable file
1
luci-app-adguardhome/po/zh-cn
Executable file
|
@ -0,0 +1 @@
|
||||||
|
zh_Hans
|
408
luci-app-adguardhome/po/zh_Hans/adguardhome.po
Executable file
408
luci-app-adguardhome/po/zh_Hans/adguardhome.po
Executable file
|
@ -0,0 +1,408 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Last-Translator: Automatically generated\n"
|
||||||
|
"Language-Team: none\n"
|
||||||
|
"Language: zh_Hans\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:27
|
||||||
|
msgid ""
|
||||||
|
"<input type=\"button\" style=\"width:210px;border-color:Teal; text-align:"
|
||||||
|
"center;font-weight:bold;color:Green;\" value=\"AdGuardHome Web:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:6
|
||||||
|
msgid "AdGuard Home"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:67
|
||||||
|
msgid "AdGuardHome Bin path if no bin will auto download"
|
||||||
|
msgstr "AdGuardHome 执行文件路径 如果没有执行文件将自动下载"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:99
|
||||||
|
msgid "AdGuardHome config path"
|
||||||
|
msgstr "AdGuardHome 配置文件路径"
|
||||||
|
|
||||||
|
#
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:58
|
||||||
|
msgid "AdGuardHome redirect mode"
|
||||||
|
msgstr "AdGuardHome重定向模式"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:142
|
||||||
|
msgid ""
|
||||||
|
"AdGuardHome runtime Log file if 'syslog': write to system log;if empty no log"
|
||||||
|
msgstr "AdGuardHome 运行日志 如果填syslog将写入系统日志;如果空则不记录日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:120
|
||||||
|
msgid "AdGuardHome work dir include rules,audit log and database"
|
||||||
|
msgstr "AdGuardHome 工作目录包含规则,审计日志和数据库"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:179
|
||||||
|
msgid "Add"
|
||||||
|
msgstr "添加"
|
||||||
|
|
||||||
|
# hide div
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:177
|
||||||
|
msgid "Add gfwlist"
|
||||||
|
msgstr "加入gfw列表"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:259
|
||||||
|
msgid "Auto tail querylog"
|
||||||
|
msgstr "自动截短查询日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:260
|
||||||
|
msgid "Auto tail runtime log"
|
||||||
|
msgstr "自动截短运行日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:258
|
||||||
|
msgid "Auto update core"
|
||||||
|
msgstr "自动升级核心"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:262
|
||||||
|
msgid "Auto update gfwlist and restart adh"
|
||||||
|
msgstr "自动更新gfw列表并重启adh"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:261
|
||||||
|
msgid "Auto update ipv6 hosts and restart adh"
|
||||||
|
msgstr "自动更新ipv6主机并重启adh"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:212
|
||||||
|
msgid "Backup workdir files when shutdown"
|
||||||
|
msgstr "在关机时备份工作目录文件"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:213
|
||||||
|
msgid "Backup workdir path"
|
||||||
|
msgstr "工作目录备份路径"
|
||||||
|
|
||||||
|
# /cgi-bin/luci/admin/services/AdGuardHome
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:7
|
||||||
|
msgid "Base Setting"
|
||||||
|
msgstr "基础设置"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:67
|
||||||
|
msgid "Bin Path"
|
||||||
|
msgstr "执行文件路径"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:22
|
||||||
|
msgid "Browser management port"
|
||||||
|
msgstr "网页管理端口"
|
||||||
|
|
||||||
|
# hide div
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:189
|
||||||
|
msgid "Change browser management password"
|
||||||
|
msgstr "改变网页登录密码"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:37
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:70
|
||||||
|
msgid "Check..."
|
||||||
|
msgstr "检查中..."
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:25
|
||||||
|
msgid "Collecting data..."
|
||||||
|
msgstr "获取数据中..."
|
||||||
|
|
||||||
|
#
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:99
|
||||||
|
msgid "Config Path"
|
||||||
|
msgstr "配置文件路径"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:257
|
||||||
|
msgid "Crontab task"
|
||||||
|
msgstr "计划任务"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:16
|
||||||
|
msgid "Culculate"
|
||||||
|
msgstr "计算"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:172
|
||||||
|
msgid "Del"
|
||||||
|
msgstr "删除"
|
||||||
|
|
||||||
|
# hide div
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:170
|
||||||
|
msgid "Del gfwlist"
|
||||||
|
msgstr "删除gfw列表"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:268
|
||||||
|
msgid "Download links for update"
|
||||||
|
msgstr "升级用的下载链接"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:18
|
||||||
|
msgid "Enable"
|
||||||
|
msgstr "启用"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:6
|
||||||
|
msgid "Fast config"
|
||||||
|
msgstr "快速配置"
|
||||||
|
|
||||||
|
# button hide
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:4
|
||||||
|
msgid "Force update"
|
||||||
|
msgstr "强制更新"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:11
|
||||||
|
msgid ""
|
||||||
|
"Free and open source, powerful network-wide ads & trackers blocking DNS "
|
||||||
|
"server."
|
||||||
|
msgstr "免费开源,功能强大的全网络广告和跟踪程序拦截DNS服务器"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:184
|
||||||
|
msgid "Gfwlist domain upstream dns service"
|
||||||
|
msgstr "gfw列表域名上游服务器"
|
||||||
|
|
||||||
|
# hide div
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:184
|
||||||
|
msgid "Gfwlist upstream dns server"
|
||||||
|
msgstr "gfw列表上游服务器"
|
||||||
|
|
||||||
|
#
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:195
|
||||||
|
msgid "Keep files when system upgrade"
|
||||||
|
msgstr "系统升级时保留文件"
|
||||||
|
|
||||||
|
# #button change
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:48
|
||||||
|
msgid "Load culculate model"
|
||||||
|
msgstr "载入计算模块"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:8
|
||||||
|
msgid "Log"
|
||||||
|
msgstr "日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:9
|
||||||
|
msgid "Manual Config"
|
||||||
|
msgstr "手动设置"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:9
|
||||||
|
msgid "NOT RUNNING"
|
||||||
|
msgstr "未运行"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:15
|
||||||
|
msgid "Not redirect"
|
||||||
|
msgstr "未重定向"
|
||||||
|
|
||||||
|
#
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:207
|
||||||
|
msgid "On boot when network ok restart"
|
||||||
|
msgstr "开机后网络准备好时重启"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:106
|
||||||
|
msgid "Please add log path in config to enable log"
|
||||||
|
msgstr "请在设置里填写日志路径以启用日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:257
|
||||||
|
msgid "Please change time and args in crontab"
|
||||||
|
msgstr "请在计划任务中修改时间和参数"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:24
|
||||||
|
msgid "Please save/apply"
|
||||||
|
msgstr "请提交"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:189
|
||||||
|
msgid "Press load culculate model and culculate finally save/apply"
|
||||||
|
msgstr "按载入计算模块 然后计算 最后保存/提交"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:7
|
||||||
|
msgid "RUNNING"
|
||||||
|
msgstr "运行中"
|
||||||
|
|
||||||
|
#
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:58
|
||||||
|
msgid "Redirect"
|
||||||
|
msgstr "重定向"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:62
|
||||||
|
msgid "Redirect 53 port to AdGuardHome"
|
||||||
|
msgstr "重定向53端口到AdGuardHome"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:13
|
||||||
|
msgid "Redirected"
|
||||||
|
msgstr "已重定向"
|
||||||
|
|
||||||
|
# hide button
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm:36
|
||||||
|
msgid "Reload Config"
|
||||||
|
msgstr "重新载入配置"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:47
|
||||||
|
msgid "Reveal/hide password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:61
|
||||||
|
msgid "Run as dnsmasq upstream server"
|
||||||
|
msgstr "作为dnsmasq的上游服务器"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:142
|
||||||
|
msgid "Runtime log file"
|
||||||
|
msgstr "运行日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:49
|
||||||
|
msgid "Update"
|
||||||
|
msgstr "更新"
|
||||||
|
|
||||||
|
# button change
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:50
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:3
|
||||||
|
msgid "Update core version"
|
||||||
|
msgstr "更新核心版本"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:54
|
||||||
|
msgid "Updated"
|
||||||
|
msgstr "已更新"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:63
|
||||||
|
msgid "Use port 53 replace dnsmasq"
|
||||||
|
msgstr "使用53端口替换dnsmasq"
|
||||||
|
|
||||||
|
# /cgi-bin/luci//admin/services/AdGuardHome/manual/
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm:38
|
||||||
|
msgid "Use template"
|
||||||
|
msgstr "使用模板"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:160
|
||||||
|
msgid "Verbose log"
|
||||||
|
msgstr "详细日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua:71
|
||||||
|
msgid "WARNING!!! no bin found apply config will not be test"
|
||||||
|
msgstr "警告!!!未找到执行文件,提交配置将不会进行校验"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:234
|
||||||
|
msgid "Will be restore when workdir/data is empty"
|
||||||
|
msgstr "在工作目录/data为空的时候恢复"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:120
|
||||||
|
msgid "Work dir"
|
||||||
|
msgstr "工作目录"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:96
|
||||||
|
msgid "bin use less space,but may have compatibility issues"
|
||||||
|
msgstr "减小执行文件空间占用,但是可能压缩后有兼容性问题"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:92
|
||||||
|
msgid "compress best(can be slow for big files)"
|
||||||
|
msgstr "最好的压缩(大文件可能慢)"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:91
|
||||||
|
msgid "compress better"
|
||||||
|
msgstr "更好的压缩"
|
||||||
|
|
||||||
|
# inlist
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:90
|
||||||
|
msgid "compress faster"
|
||||||
|
msgstr "快速压缩"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:197
|
||||||
|
msgid "config file"
|
||||||
|
msgstr "配置文件"
|
||||||
|
|
||||||
|
# checkbox
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:196
|
||||||
|
msgid "core bin"
|
||||||
|
msgstr "核心执行文件"
|
||||||
|
|
||||||
|
#
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:53
|
||||||
|
msgid "core version:"
|
||||||
|
msgstr "核心版本:"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:7
|
||||||
|
msgid "dellog"
|
||||||
|
msgstr "删除日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:8
|
||||||
|
msgid "download log"
|
||||||
|
msgstr "下载日志"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:202
|
||||||
|
msgid "filters"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:26
|
||||||
|
msgid "is empty"
|
||||||
|
msgstr "为空"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:6
|
||||||
|
msgid "loading..."
|
||||||
|
msgstr "载入中"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:4
|
||||||
|
msgid "localtime"
|
||||||
|
msgstr "本地时间"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:198
|
||||||
|
msgid "log file"
|
||||||
|
msgstr "日志文件"
|
||||||
|
|
||||||
|
# description change
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:32
|
||||||
|
msgid "no config"
|
||||||
|
msgstr "没有配置文件"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:35
|
||||||
|
msgid "no core"
|
||||||
|
msgstr "没有核心"
|
||||||
|
|
||||||
|
# inlist
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:60
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:89
|
||||||
|
msgid "none"
|
||||||
|
msgstr "无"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:201
|
||||||
|
msgid "querylog.json"
|
||||||
|
msgstr "审计日志.json"
|
||||||
|
|
||||||
|
# /cgi-bin/luci/admin/services/AdGuardHome/log/
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:9
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:2
|
||||||
|
msgid "reverse"
|
||||||
|
msgstr "逆序"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:199
|
||||||
|
msgid "sessions.db"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:200
|
||||||
|
msgid "stats.db"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:93
|
||||||
|
msgid "try all available compression methods & filters [slow]"
|
||||||
|
msgstr "尝试所有可能的压缩方法和过滤器[慢]"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:94
|
||||||
|
msgid "try even more compression variants [very slow]"
|
||||||
|
msgstr "尝试更多变体压缩手段[很慢]"
|
||||||
|
|
||||||
|
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:88
|
||||||
|
msgid "use upx to compress bin after download"
|
||||||
|
msgstr "下载后使用upx压缩执行文件"
|
||||||
|
|
||||||
|
#~ msgid "Added"
|
||||||
|
#~ msgstr "已添加"
|
||||||
|
|
||||||
|
#~ msgid "Not added"
|
||||||
|
#~ msgstr "未添加"
|
||||||
|
|
||||||
|
# unused
|
||||||
|
#~ msgid "Change browser management username"
|
||||||
|
#~ msgstr "改变网页登录用户名"
|
||||||
|
|
||||||
|
#~ msgid "Username"
|
||||||
|
#~ msgstr "用户名"
|
||||||
|
|
||||||
|
#~ msgid "Check Config"
|
||||||
|
#~ msgstr "检查配置"
|
||||||
|
|
||||||
|
#~ msgid "unknown"
|
||||||
|
#~ msgstr "未知"
|
||||||
|
|
||||||
|
#~ msgid "Keep database when system upgrade"
|
||||||
|
#~ msgstr "系统升级时保留数据"
|
||||||
|
|
||||||
|
#~ msgid "Boot delay until network ok"
|
||||||
|
#~ msgstr "开机时直到网络准备好再启动"
|
11
luci-app-adguardhome/root/etc/config/AdGuardHome
Executable file
11
luci-app-adguardhome/root/etc/config/AdGuardHome
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
config AdGuardHome 'AdGuardHome'
|
||||||
|
option enabled '0'
|
||||||
|
option httpport '3000'
|
||||||
|
option redirect 'none'
|
||||||
|
option configpath '/etc/AdGuardHome.yaml'
|
||||||
|
option workdir '/etc/AdGuardHome'
|
||||||
|
option logfile '/tmp/AdGuardHome.log'
|
||||||
|
option verbose '0'
|
||||||
|
option binpath '/usr/bin/AdGuardHome'
|
||||||
|
option upxflag ''
|
||||||
|
|
642
luci-app-adguardhome/root/etc/init.d/AdGuardHome
Executable file
642
luci-app-adguardhome/root/etc/init.d/AdGuardHome
Executable file
|
@ -0,0 +1,642 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
START=95
|
||||||
|
STOP=01
|
||||||
|
|
||||||
|
CONFIGURATION=AdGuardHome
|
||||||
|
CRON_FILE=/etc/crontabs/root
|
||||||
|
|
||||||
|
extra_command "do_redirect" "0 or 1"
|
||||||
|
extra_command "testbackup" "backup or restore"
|
||||||
|
extra_command "test_crontab"
|
||||||
|
extra_command "force_reload"
|
||||||
|
extra_command "isrunning"
|
||||||
|
|
||||||
|
set_forward_dnsmasq()
|
||||||
|
{
|
||||||
|
local PORT="$1"
|
||||||
|
addr="127.0.0.1#$PORT"
|
||||||
|
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
||||||
|
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
|
||||||
|
uci add_list dhcp.@dnsmasq[0].server=$addr
|
||||||
|
for server in $OLD_SERVER; do
|
||||||
|
if [ "$server" = "$addr" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# uci add_list dhcp.@dnsmasq[0].server=$server
|
||||||
|
done
|
||||||
|
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
|
||||||
|
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||||
|
uci commit dhcp
|
||||||
|
/etc/init.d/dnsmasq restart
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_forward_dnsmasq()
|
||||||
|
{
|
||||||
|
local OLD_PORT="$1"
|
||||||
|
addr="127.0.0.1#$OLD_PORT"
|
||||||
|
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
||||||
|
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
|
||||||
|
addrlist="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
||||||
|
if [ -z "$addrlist" ] ; then
|
||||||
|
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto 2>/dev/null
|
||||||
|
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
|
||||||
|
fi
|
||||||
|
uci commit dhcp
|
||||||
|
/etc/init.d/dnsmasq restart
|
||||||
|
}
|
||||||
|
|
||||||
|
set_iptable()
|
||||||
|
{
|
||||||
|
local ipv6_server=$1
|
||||||
|
local tcp_server=$2
|
||||||
|
uci -q batch <<-EOF >/dev/null 2>&1
|
||||||
|
delete firewall.AdGuardHome
|
||||||
|
set firewall.AdGuardHome=include
|
||||||
|
set firewall.AdGuardHome.type=script
|
||||||
|
set firewall.AdGuardHome.path=/usr/share/AdGuardHome/firewall.start
|
||||||
|
set firewall.AdGuardHome.reload=1
|
||||||
|
commit firewall
|
||||||
|
EOF
|
||||||
|
|
||||||
|
IPS="`ifconfig | grep "inet addr" | grep -v ":127" | grep "Bcast" | awk '{print $2}' | awk -F : '{print $2}'`"
|
||||||
|
for IP in $IPS
|
||||||
|
do
|
||||||
|
if [ "$tcp_server" == "1" ]; then
|
||||||
|
iptables -t nat -A PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$ipv6_server" == 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
IPS="`ifconfig | grep "inet6 addr" | grep -v " fe80::" | grep -v " ::1" | grep "Global" | awk '{print $3}'`"
|
||||||
|
for IP in $IPS
|
||||||
|
do
|
||||||
|
if [ "$tcp_server" == "1" ]; then
|
||||||
|
ip6tables -t nat -A PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
ip6tables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
clear_iptable()
|
||||||
|
{
|
||||||
|
uci -q batch <<-EOF >/dev/null 2>&1
|
||||||
|
delete firewall.AdGuardHome
|
||||||
|
commit firewall
|
||||||
|
EOF
|
||||||
|
local OLD_PORT="$1"
|
||||||
|
local ipv6_server=$2
|
||||||
|
IPS="`ifconfig | grep "inet addr" | grep -v ":127" | grep "Bcast" | awk '{print $2}' | awk -F : '{print $2}'`"
|
||||||
|
for IP in $IPS
|
||||||
|
do
|
||||||
|
iptables -t nat -D PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||||
|
iptables -t nat -D PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$ipv6_server" == 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo "warn ip6tables nat mod is needed"
|
||||||
|
IPS="`ifconfig | grep "inet6 addr" | grep -v " fe80::" | grep -v " ::1" | grep "Global" | awk '{print $3}'`"
|
||||||
|
for IP in $IPS
|
||||||
|
do
|
||||||
|
ip6tables -t nat -D PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||||
|
ip6tables -t nat -D PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "$CONFIGURATION"
|
||||||
|
[ "$(uci get AdGuardHome.AdGuardHome.redirect)" == "redirect" ] && procd_add_reload_trigger firewall
|
||||||
|
}
|
||||||
|
|
||||||
|
isrunning(){
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
_isrunning
|
||||||
|
local r=$?
|
||||||
|
([ "$r" == "0" ] && echo "running") || ([ "$r" == "1" ] && echo "not run" ) || echo "no bin"
|
||||||
|
return $r
|
||||||
|
}
|
||||||
|
|
||||||
|
_isrunning(){
|
||||||
|
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||||
|
[ ! -f "$binpath" ] && return 2
|
||||||
|
pgrep $binpath 2>&1 >/dev/null && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
force_reload(){
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
_isrunning && procd_send_signal "$CONFIGURATION" || start
|
||||||
|
}
|
||||||
|
|
||||||
|
get_tz()
|
||||||
|
{
|
||||||
|
SET_TZ=""
|
||||||
|
|
||||||
|
if [ -e "/etc/localtime" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
for tzfile in /etc/TZ /var/etc/TZ
|
||||||
|
do
|
||||||
|
if [ ! -e "$tzfile" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
tz="`cat $tzfile 2>/dev/null`"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$tz" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
SET_TZ=$tz
|
||||||
|
}
|
||||||
|
|
||||||
|
rm_port53()
|
||||||
|
{
|
||||||
|
local AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
|
||||||
|
dnsmasq_port=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
|
||||||
|
if [ -z "$dnsmasq_port" ]; then
|
||||||
|
dnsmasq_port="53"
|
||||||
|
fi
|
||||||
|
if [ "$dnsmasq_port" == "$AdGuardHome_PORT" ]; then
|
||||||
|
if [ "$dnsmasq_port" == "53" ]; then
|
||||||
|
dnsmasq_port="1745"
|
||||||
|
fi
|
||||||
|
elif [ "$dnsmasq_port" == "53" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
config_editor "dns.port" "$dnsmasq_port" "$configpath"
|
||||||
|
uci set dhcp.@dnsmasq[0].port="53"
|
||||||
|
uci commit dhcp
|
||||||
|
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||||
|
killall -9 $binpath
|
||||||
|
/etc/init.d/dnsmasq restart
|
||||||
|
}
|
||||||
|
|
||||||
|
use_port53()
|
||||||
|
{
|
||||||
|
local AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
|
||||||
|
dnsmasq_port=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
|
||||||
|
if [ -z "$dnsmasq_port" ]; then
|
||||||
|
dnsmasq_port="53"
|
||||||
|
fi
|
||||||
|
if [ "$dnsmasq_port" == "$AdGuardHome_PORT" ]; then
|
||||||
|
if [ "$dnsmasq_port" == "53" ]; then
|
||||||
|
AdGuardHome_PORT="1745"
|
||||||
|
fi
|
||||||
|
elif [ "$AdGuardHome_PORT" == "53" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
config_editor "dns.port" "53" "$configpath"
|
||||||
|
uci set dhcp.@dnsmasq[0].port="$AdGuardHome_PORT"
|
||||||
|
uci commit dhcp
|
||||||
|
/etc/init.d/dnsmasq reload
|
||||||
|
}
|
||||||
|
|
||||||
|
do_redirect()
|
||||||
|
{
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
_do_redirect $1
|
||||||
|
}
|
||||||
|
|
||||||
|
_do_redirect()
|
||||||
|
{
|
||||||
|
local section="$CONFIGURATION"
|
||||||
|
args=""
|
||||||
|
ipv6_server=1
|
||||||
|
tcp_server=0
|
||||||
|
enabled=$1
|
||||||
|
if [ "$enabled" == "1" ]; then
|
||||||
|
echo -n "1">/var/run/AdGredir
|
||||||
|
else
|
||||||
|
echo -n "0">/var/run/AdGredir
|
||||||
|
fi
|
||||||
|
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
||||||
|
AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
|
||||||
|
if [ ! -s "$configpath" ]; then
|
||||||
|
cp -f /usr/share/AdGuardHome/AdGuardHome_template.yaml $configpath
|
||||||
|
fi
|
||||||
|
if [ -z "$AdGuardHome_PORT" ]; then
|
||||||
|
AdGuardHome_PORT="0"
|
||||||
|
fi
|
||||||
|
config_get "redirect" "$section" "redirect" "none"
|
||||||
|
config_get "old_redirect" "$section" "old_redirect" "none"
|
||||||
|
config_get "old_port" "$section" "old_port" "0"
|
||||||
|
config_get "old_enabled" "$section" "old_enabled" "0"
|
||||||
|
uci get dhcp.@dnsmasq[0].port >/dev/null 2>&1 || uci set dhcp.@dnsmasq[0].port="53" >/dev/null 2>&1
|
||||||
|
if [ "$old_enabled" = "1" -a "$old_redirect" == "exchange" ]; then
|
||||||
|
AdGuardHome_PORT=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$old_redirect" != "$redirect" ] || [ "$old_port" != "$AdGuardHome_PORT" ] || [ "$old_enabled" = "1" -a "$enabled" = "0" ]; then
|
||||||
|
if [ "$old_redirect" != "none" ]; then
|
||||||
|
if [ "$old_redirect" == "redirect" -a "$old_port" != "0" ]; then
|
||||||
|
clear_iptable "$old_port" "$ipv6_server"
|
||||||
|
elif [ "$old_redirect" == "dnsmasq-upstream" ]; then
|
||||||
|
stop_forward_dnsmasq "$old_port"
|
||||||
|
elif [ "$old_redirect" == "exchange" ]; then
|
||||||
|
rm_port53
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ "$old_enabled" = "1" -a "$enabled" = "1" ]; then
|
||||||
|
if [ "$old_redirect" == "redirect" -a "$old_port" != "0" ]; then
|
||||||
|
clear_iptable "$old_port" "$ipv6_server"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
uci delete AdGuardHome.@AdGuardHome[0].old_redirect 2>/dev/null
|
||||||
|
uci delete AdGuardHome.@AdGuardHome[0].old_port 2>/dev/null
|
||||||
|
uci delete AdGuardHome.@AdGuardHome[0].old_enabled 2>/dev/null
|
||||||
|
uci add_list AdGuardHome.@AdGuardHome[0].old_redirect="$redirect" 2>/dev/null
|
||||||
|
uci add_list AdGuardHome.@AdGuardHome[0].old_port="$AdGuardHome_PORT" 2>/dev/null
|
||||||
|
uci add_list AdGuardHome.@AdGuardHome[0].old_enabled="$enabled" 2>/dev/null
|
||||||
|
uci commit AdGuardHome
|
||||||
|
[ "$enabled" == "0" ] && return 1
|
||||||
|
if [ "$AdGuardHome_PORT" == "0" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "$redirect" = "redirect" ]; then
|
||||||
|
set_iptable $ipv6_server $tcp_server
|
||||||
|
elif [ "$redirect" = "dnsmasq-upstream" ]; then
|
||||||
|
set_forward_dnsmasq "$AdGuardHome_PORT"
|
||||||
|
elif [ "$redirect" == "exchange" -a "$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)" == "53" ]; then
|
||||||
|
use_port53
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_filesystem()
|
||||||
|
{
|
||||||
|
# print out path filesystem
|
||||||
|
echo $1 | awk '
|
||||||
|
BEGIN{
|
||||||
|
while (("mount"| getline ret) > 0)
|
||||||
|
{
|
||||||
|
split(ret,d);
|
||||||
|
fs[d[3]]=d[5];
|
||||||
|
m=index(d[1],":")
|
||||||
|
if (m==0)
|
||||||
|
{
|
||||||
|
pt[d[3]]=d[1]
|
||||||
|
}else{
|
||||||
|
pt[d[3]]=substr(d[1],m+1)
|
||||||
|
}}}{
|
||||||
|
split($0,d,"/");
|
||||||
|
if ("/" in fs)
|
||||||
|
{
|
||||||
|
result1=fs["/"];
|
||||||
|
}
|
||||||
|
if ("/" in pt)
|
||||||
|
{
|
||||||
|
result2=pt["/"];
|
||||||
|
}
|
||||||
|
for (i=2;i<=length(d);i++)
|
||||||
|
{
|
||||||
|
p[i]=p[i-1]"/"d[i];
|
||||||
|
if (p[i] in fs)
|
||||||
|
{
|
||||||
|
result1=fs[p[i]];
|
||||||
|
result2=pt[p[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result2 in fs){
|
||||||
|
result=fs[result2]}
|
||||||
|
else{
|
||||||
|
result=result1}
|
||||||
|
print(result);}'
|
||||||
|
}
|
||||||
|
|
||||||
|
config_editor()
|
||||||
|
{
|
||||||
|
awk -v yaml="$1" -v value="$2" -v file="$3" -v ro="$4" '
|
||||||
|
BEGIN{split(yaml,part,"\.");s="";i=1;l=length(part);}
|
||||||
|
{
|
||||||
|
if (match($0,s""part[i]":"))
|
||||||
|
{
|
||||||
|
if (i==l)
|
||||||
|
{
|
||||||
|
split($0,t,": ");
|
||||||
|
if (ro==""){
|
||||||
|
system("sed -i '\''"FNR"c \\"t[1]": "value"'\'' "file);
|
||||||
|
}else{
|
||||||
|
print(t[2]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
s=s"[- ]{2}";
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}' $3
|
||||||
|
}
|
||||||
|
|
||||||
|
boot_service() {
|
||||||
|
rm /var/run/AdGserverdis >/dev/null 2>&1
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
config_get waitonboot $CONFIGURATION waitonboot "0"
|
||||||
|
config_get_bool enabled $CONFIGURATION enabled 0
|
||||||
|
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||||
|
[ -f "$binpath" ] && start_service
|
||||||
|
if [ "$enabled" == "1" ] && [ "$waitonboot" == "1" ]; then
|
||||||
|
procd_open_instance "waitnet"
|
||||||
|
procd_set_param command "/usr/share/AdGuardHome/waitnet.sh"
|
||||||
|
procd_close_instance
|
||||||
|
echo "no net start pinging"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testbackup(){
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
if [ "$1" == "backup" ]; then
|
||||||
|
backup
|
||||||
|
elif [ "$1" == "restore" ]; then
|
||||||
|
restore
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restore()
|
||||||
|
{
|
||||||
|
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||||
|
config_get backupwdpath $CONFIGURATION backupwdpath "/etc/AdGuardHome"
|
||||||
|
cp -u -r -f $backupwdpath/data $workdir
|
||||||
|
}
|
||||||
|
|
||||||
|
backup() {
|
||||||
|
config_get backupwdpath $CONFIGURATION backupwdpath "/etc/AdGuardHome"
|
||||||
|
mkdir -p $backupwdpath/data
|
||||||
|
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||||
|
config_get backupfile $CONFIGURATION backupfile ""
|
||||||
|
for one in $backupfile;
|
||||||
|
do
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
if [ -d "$backupwdpath/data/$one" ]; then
|
||||||
|
cpret=$(cp -u -r -f $workdir/data/$one $backupwdpath/data 2>&1)
|
||||||
|
else
|
||||||
|
cpret=$(cp -u -r -f $workdir/data/$one $backupwdpath/data/$one 2>&1)
|
||||||
|
fi
|
||||||
|
echo "$cpret"
|
||||||
|
echo "$cpret" | grep "no space left on device"
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
echo "磁盘已满,删除log重试中"
|
||||||
|
del_querylog && continue
|
||||||
|
rm -f -r $backupwdpath/data/filters
|
||||||
|
rm -f -r $workdir/data/filters && continue
|
||||||
|
echo "backup failed"
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
# Reading config
|
||||||
|
rm /var/run/AdGserverdis >/dev/null 2>&1
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
# update password
|
||||||
|
config_get hashpass $CONFIGURATION hashpass ""
|
||||||
|
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
|
||||||
|
if [ -n "$hashpass" ]; then
|
||||||
|
config_editor "users.password" "$hashpass" "$configpath"
|
||||||
|
uci set $CONFIGURATION.$CONFIGURATION.hashpass=""
|
||||||
|
fi
|
||||||
|
local enabled
|
||||||
|
config_get_bool enabled $CONFIGURATION enabled 0
|
||||||
|
# update crontab
|
||||||
|
do_crontab
|
||||||
|
if [ "$enabled" == "0" ]; then
|
||||||
|
_do_redirect 0
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
#what need to do before reload
|
||||||
|
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||||
|
|
||||||
|
config_get backupfile $CONFIGURATION backupfile ""
|
||||||
|
mkdir -p $workdir/data
|
||||||
|
if [ -n "$backupfile" ] && [ ! -d "$workdir/data" ]; then
|
||||||
|
restore
|
||||||
|
fi
|
||||||
|
# for overlay data-stk-oo not suppport
|
||||||
|
local cwdfs=$(get_filesystem $workdir)
|
||||||
|
echo "workdir is a $cwdfs filesystem"
|
||||||
|
if [ "$cwdfs" == "jffs2" ]; then
|
||||||
|
echo "fs error ln db to tmp $workdir $cwdfs"
|
||||||
|
logger "AdGuardHome" "warning db redirect to tmp"
|
||||||
|
touch $workdir/data/stats.db
|
||||||
|
if [ ! -L $workdir/data/stats.db ]; then
|
||||||
|
mv -f $workdir/data/stats.db /tmp/stats.db 2>/dev/null
|
||||||
|
ln -s /tmp/stats.db $workdir/data/stats.db 2>/dev/null
|
||||||
|
fi
|
||||||
|
touch $workdir/data/sessions.db
|
||||||
|
if [ ! -L $workdir/data/sessions.db ]; then
|
||||||
|
mv -f $workdir/data/sessions.db /tmp/sessions.db 2>/dev/null
|
||||||
|
ln -s /tmp/sessions.db $workdir/data/sessions.db 2>/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
local ADDITIONAL_ARGS=""
|
||||||
|
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
|
||||||
|
|
||||||
|
mkdir -p ${binpath%/*}
|
||||||
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -c $configpath"
|
||||||
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -w $workdir"
|
||||||
|
config_get httpport $CONFIGURATION httpport 3000
|
||||||
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -p $httpport"
|
||||||
|
|
||||||
|
# hack to save config file when upgrade system
|
||||||
|
config_get upprotect $CONFIGURATION upprotect ""
|
||||||
|
eval upprotect=${upprotect// /\\\\n}
|
||||||
|
echo -e "$upprotect">/lib/upgrade/keep.d/luci-app-adguardhome
|
||||||
|
|
||||||
|
config_get logfile $CONFIGURATION logfile ""
|
||||||
|
if [ -n "$logfile" ]; then
|
||||||
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -l $logfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$binpath" ]; then
|
||||||
|
_do_redirect 0
|
||||||
|
/usr/share/AdGuardHome/update_core.sh 2>&1 >/tmp/AdGuardHome_update.log &
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_get_bool verbose $CONFIGURATION verbose 0
|
||||||
|
if [ "$verbose" -eq 1 ]; then
|
||||||
|
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
procd_open_instance
|
||||||
|
get_tz
|
||||||
|
if [ -n "$SET_TZ" ]; then
|
||||||
|
procd_set_param env TZ="$SET_TZ"
|
||||||
|
fi
|
||||||
|
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
||||||
|
procd_set_param limits core="unlimited" nofile="65535 65535"
|
||||||
|
procd_set_param stderr 1
|
||||||
|
procd_set_param command $binpath $ADDITIONAL_ARGS
|
||||||
|
procd_set_param file "$configpath" "/etc/hosts" "/etc/config/AdGuardHome"
|
||||||
|
procd_close_instance
|
||||||
|
if [ -f "$configpath" ]; then
|
||||||
|
_do_redirect 1
|
||||||
|
else
|
||||||
|
_do_redirect 0
|
||||||
|
config_get "redirect" "AdGuardHome" "redirect" "none"
|
||||||
|
if [ "$redirect" != "none" ]; then
|
||||||
|
procd_open_instance "waitconfig"
|
||||||
|
procd_set_param command "/usr/share/AdGuardHome/watchconfig.sh"
|
||||||
|
procd_close_instance
|
||||||
|
echo "no config start watching"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "AdGuardHome service enabled"
|
||||||
|
echo "luci enable switch=$enabled"
|
||||||
|
(sleep 10 && [ -z "$(pgrep $binpath)" ] && logger "AdGuardHome" "no process in 10s cancel redirect" && _do_redirect 0 )&
|
||||||
|
if [[ "`uci get bypass.@global[0].global_server 2>/dev/null`" && "`uci get bypass.@global[0].adguardhome 2>/dev/null`" == 1 && "$(uci get dhcp.@dnsmasq[0].port)" == "53" ]]; then
|
||||||
|
uci -q set AdGuardHome.AdGuardHome.redirect='exchange'
|
||||||
|
uci commit AdGuardHome
|
||||||
|
do_redirect 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service()
|
||||||
|
{
|
||||||
|
rm /var/run/AdGlucitest >/dev/null 2>&1
|
||||||
|
echo "AdGuardHome reloading"
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
del_querylog(){
|
||||||
|
local btarget=$(ls $backupwdpath/data | grep -F "querylog.json" | sort -r | head -n 1)
|
||||||
|
local wtarget=$(ls $workdir/data | grep -F "querylog.json" | sort -r | head -n 1)
|
||||||
|
if [ "$btarget"x == "$wtarget"x ]; then
|
||||||
|
[ -z "$btarget" ] && return 1
|
||||||
|
rm -f $workdir/data/$wtarget
|
||||||
|
rm -f $backupwdpath/data/$btarget
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if [ "$btarget" \> "$wtarget" ]; then
|
||||||
|
rm -f $backupwdpath/data/$btarget
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
rm -f $workdir/data/$wtarget
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service()
|
||||||
|
{
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
_do_redirect 0
|
||||||
|
do_crontab
|
||||||
|
if [ "$1" != "nobackup" ]; then
|
||||||
|
config_get backupfile $CONFIGURATION backupfile "0"
|
||||||
|
if [ -n "$backupfile" ]; then
|
||||||
|
backup
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "AdGuardHome service disabled"
|
||||||
|
touch /var/run/AdGserverdis
|
||||||
|
}
|
||||||
|
|
||||||
|
boot() {
|
||||||
|
rc_procd boot_service "$@"
|
||||||
|
if eval "type service_started" 2>/dev/null >/dev/null; then
|
||||||
|
service_started
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_crontab(){
|
||||||
|
config_load "${CONFIGURATION}"
|
||||||
|
do_crontab
|
||||||
|
}
|
||||||
|
|
||||||
|
do_crontab(){
|
||||||
|
config_get_bool enabled $CONFIGURATION enabled 0
|
||||||
|
config_get crontab $CONFIGURATION crontab ""
|
||||||
|
local findstr default cronenable replace commit
|
||||||
|
local cronreload=0
|
||||||
|
local commit=0
|
||||||
|
findstr="/usr/share/AdGuardHome/update_core.sh"
|
||||||
|
default="30 3 * * * /usr/share/AdGuardHome/update_core.sh 2>&1"
|
||||||
|
[ "$enabled" == "0" ] || [ "${crontab//autoupdate/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||||
|
crontab_editor
|
||||||
|
|
||||||
|
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
|
||||||
|
config_get lastworkdir $CONFIGURATION lastworkdir "/etc/AdGuardHome"
|
||||||
|
findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* \$(uci get AdGuardHome.AdGuardHome.workdir)/data/querylog.json"
|
||||||
|
#[ -n "$lastworkdir" ] && findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* $lastworkdir/data/querylog.json" && [ "$lastworkdir" != "$workdir" ] && replace="${lastworkdir//\//\\/}/${workdir//\//\\/}"
|
||||||
|
default="0 * * * * /usr/share/AdGuardHome/tailto.sh 2000 \$(uci get AdGuardHome.AdGuardHome.workdir)/data/querylog.json"
|
||||||
|
[ "$enabled" == "0" ] || [ "${crontab//cutquerylog/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||||
|
crontab_editor
|
||||||
|
#[ "$lastworkdir" != "$workdir" ] && uci set AdGuardHome.AdGuardHome.lastworkdir="$workdir" && commit=1
|
||||||
|
|
||||||
|
config_get logfile $CONFIGURATION logfile ""
|
||||||
|
config_get lastlogfile $CONFIGURATION lastlogfile ""
|
||||||
|
findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* \$(uci get AdGuardHome.AdGuardHome.logfile)"
|
||||||
|
default="30 3 * * * /usr/share/AdGuardHome/tailto.sh 2000 \$(uci get AdGuardHome.AdGuardHome.logfile)"
|
||||||
|
#[ -n "$lastlogfile" ] && findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* $lastlogfile" && [ -n "$logfile" ] && [ "$lastlogfile" != "$logfile" ] && replace="${lastlogfile//\//\\/}/${logfile//\//\\/}"
|
||||||
|
[ "$logfile" == "syslog" ] || [ "$logfile" == "" ] || [ "$enabled" == "0" ] || [ "${crontab//cutruntimelog/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||||
|
crontab_editor
|
||||||
|
#[ -n "$logfile" ] && [ "$lastlogfile" != "$logfile" ] && uci set AdGuardHome.AdGuardHome.lastlogfile="$logfile" && commit=1
|
||||||
|
|
||||||
|
findstr="/usr/share/AdGuardHome/addhost.sh"
|
||||||
|
default="0 * * * * /usr/share/AdGuardHome/addhost.sh"
|
||||||
|
[ "$enabled" == "0" ] || [ "${crontab//autohost/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||||
|
crontab_editor
|
||||||
|
[ "$cronenable" == "0" ] && /usr/share/AdGuardHome/addhost.sh "del" "noreload" || /usr/share/AdGuardHome/addhost.sh "" "noreload"
|
||||||
|
|
||||||
|
findstr="/usr/share/AdGuardHome/gfw2adg.sh"
|
||||||
|
default="30 3 * * * /usr/share/AdGuardHome/gfw2adg.sh"
|
||||||
|
[ "$enabled" == "0" ] || [ "${crontab//autogfw/}" == "$crontab" ] && cronenable=0 || cronenable=1
|
||||||
|
crontab_editor
|
||||||
|
[ "$cronreload" -gt 0 ] && /etc/init.d/cron restart
|
||||||
|
#[ "$commit" -gt 0 ] && uci commit AdGuardHome
|
||||||
|
}
|
||||||
|
|
||||||
|
crontab_editor(){
|
||||||
|
#usage input:
|
||||||
|
#findstr=
|
||||||
|
#default=
|
||||||
|
#cronenable=
|
||||||
|
#replace="${last//\//\\/}/${now//\//\\/}"
|
||||||
|
#output:cronreload:if >1 please /etc/init.d/cron restart manual
|
||||||
|
local testline reload
|
||||||
|
local line="$(grep "$findstr" $CRON_FILE)"
|
||||||
|
[ -n "$replace" ] && [ -n "$line" ] && eval testline="\${line//$replace}" && [ "$testline" != "$line" ] && line="$testline" && reload="1" && replace=""
|
||||||
|
if [ "${line:0:1}" != "#" ]; then
|
||||||
|
if [ $cronenable -eq 1 ]; then
|
||||||
|
[ -z "$line" ] && line="$default" && reload="1"
|
||||||
|
if [ -n "$reload" ]; then
|
||||||
|
sed -i "\,$findstr,d" $CRON_FILE
|
||||||
|
echo "$line" >> $CRON_FILE
|
||||||
|
cronreload=$((cronreload+1))
|
||||||
|
fi
|
||||||
|
elif [ -n "$line" ]; then
|
||||||
|
sed -i "\,$findstr,d" $CRON_FILE
|
||||||
|
echo "#$line" >> $CRON_FILE
|
||||||
|
cronreload=$((cronreload+1))
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $cronenable -eq 1 ]; then
|
||||||
|
sed -i "\,$findstr,d" $CRON_FILE
|
||||||
|
echo "${line:1}" >> $CRON_FILE
|
||||||
|
cronreload=$((cronreload+1))
|
||||||
|
elif [ -z "$reload" ]; then
|
||||||
|
sed -i "\,$findstr,d" $CRON_FILE
|
||||||
|
echo "$line" >> $CRON_FILE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
15
luci-app-adguardhome/root/etc/uci-defaults/40_luci-AdGuardHome
Executable file
15
luci-app-adguardhome/root/etc/uci-defaults/40_luci-AdGuardHome
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null 2>&1
|
||||||
|
delete ucitrack.@AdGuardHome[-1]
|
||||||
|
add ucitrack AdGuardHome
|
||||||
|
set ucitrack.@AdGuardHome[-1].init=AdGuardHome
|
||||||
|
commit ucitrack
|
||||||
|
delete AdGuardHome.AdGuardHome.ucitracktest
|
||||||
|
/etc/init.d/AdGuardHome restart
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
|
||||||
|
chmod +x /etc/init.d/AdGuardHome /usr/share/AdGuardHome/*
|
||||||
|
exit 0
|
131
luci-app-adguardhome/root/usr/share/AdGuardHome/AdGuardHome_template.yaml
Executable file
131
luci-app-adguardhome/root/usr/share/AdGuardHome/AdGuardHome_template.yaml
Executable file
|
@ -0,0 +1,131 @@
|
||||||
|
bind_host: 0.0.0.0
|
||||||
|
bind_port: 3000
|
||||||
|
beta_bind_port: 0
|
||||||
|
users:
|
||||||
|
- name: root
|
||||||
|
password: $2y$10$dwn0hTYoECQMZETBErGlzOId2VANOVsPHsuH13TM/8KnysM5Dh/ve
|
||||||
|
auth_attempts: 5
|
||||||
|
block_auth_min: 15
|
||||||
|
http_proxy: ""
|
||||||
|
language: zh-cn
|
||||||
|
debug_pprof: false
|
||||||
|
web_session_ttl: 720
|
||||||
|
dns:
|
||||||
|
bind_hosts:
|
||||||
|
- 0.0.0.0
|
||||||
|
port: 1745
|
||||||
|
statistics_interval: 30
|
||||||
|
querylog_enabled: true
|
||||||
|
querylog_file_enabled: true
|
||||||
|
querylog_interval: 6h
|
||||||
|
querylog_size_memory: 1000
|
||||||
|
anonymize_client_ip: false
|
||||||
|
protection_enabled: true
|
||||||
|
blocking_mode: default
|
||||||
|
blocking_ipv4: ""
|
||||||
|
blocking_ipv6: ""
|
||||||
|
blocked_response_ttl: 60
|
||||||
|
parental_block_host: family-block.dns.adguard.com
|
||||||
|
safebrowsing_block_host: standard-block.dns.adguard.com
|
||||||
|
ratelimit: 0
|
||||||
|
ratelimit_whitelist: []
|
||||||
|
refuse_any: false
|
||||||
|
upstream_dns:
|
||||||
|
- 223.5.5.5
|
||||||
|
upstream_dns_file: ""
|
||||||
|
bootstrap_dns:
|
||||||
|
- 119.29.29.29
|
||||||
|
- 223.5.5.5
|
||||||
|
all_servers: false
|
||||||
|
fastest_addr: false
|
||||||
|
fastest_timeout: 1s
|
||||||
|
allowed_clients: []
|
||||||
|
disallowed_clients: []
|
||||||
|
blocked_hosts:
|
||||||
|
- version.bind
|
||||||
|
- id.server
|
||||||
|
- hostname.bind
|
||||||
|
trusted_proxies:
|
||||||
|
- 127.0.0.0/8
|
||||||
|
- ::1/128
|
||||||
|
cache_size: 4194304
|
||||||
|
cache_ttl_min: 0
|
||||||
|
cache_ttl_max: 0
|
||||||
|
cache_optimistic: true
|
||||||
|
bogus_nxdomain: []
|
||||||
|
aaaa_disabled: false
|
||||||
|
enable_dnssec: false
|
||||||
|
edns_client_subnet: false
|
||||||
|
max_goroutines: 300
|
||||||
|
ipset: []
|
||||||
|
filtering_enabled: true
|
||||||
|
filters_update_interval: 24
|
||||||
|
parental_enabled: false
|
||||||
|
safesearch_enabled: false
|
||||||
|
safebrowsing_enabled: false
|
||||||
|
safebrowsing_cache_size: 1048576
|
||||||
|
safesearch_cache_size: 1048576
|
||||||
|
parental_cache_size: 1048576
|
||||||
|
cache_time: 30
|
||||||
|
rewrites: []
|
||||||
|
blocked_services: []
|
||||||
|
upstream_timeout: 10s
|
||||||
|
local_domain_name: lan
|
||||||
|
resolve_clients: true
|
||||||
|
use_private_ptr_resolvers: true
|
||||||
|
local_ptr_upstreams: []
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
server_name: ""
|
||||||
|
force_https: false
|
||||||
|
port_https: 443
|
||||||
|
port_dns_over_tls: 853
|
||||||
|
port_dns_over_quic: 784
|
||||||
|
port_dnscrypt: 0
|
||||||
|
dnscrypt_config_file: ""
|
||||||
|
allow_unencrypted_doh: false
|
||||||
|
strict_sni_check: false
|
||||||
|
certificate_chain: ""
|
||||||
|
private_key: ""
|
||||||
|
certificate_path: ""
|
||||||
|
private_key_path: ""
|
||||||
|
filters:
|
||||||
|
- enabled: true
|
||||||
|
url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
|
||||||
|
name: AdGuard DNS filter
|
||||||
|
id: 1628750870
|
||||||
|
- enabled: true
|
||||||
|
url: https://anti-ad.net/easylist.txt
|
||||||
|
name: 'CHN: anti-AD'
|
||||||
|
id: 1628750871
|
||||||
|
whitelist_filters: []
|
||||||
|
user_rules: []
|
||||||
|
dhcp:
|
||||||
|
enabled: false
|
||||||
|
interface_name: ""
|
||||||
|
dhcpv4:
|
||||||
|
gateway_ip: ""
|
||||||
|
subnet_mask: ""
|
||||||
|
range_start: ""
|
||||||
|
range_end: ""
|
||||||
|
lease_duration: 86400
|
||||||
|
icmp_timeout_msec: 1000
|
||||||
|
options: []
|
||||||
|
dhcpv6:
|
||||||
|
range_start: ""
|
||||||
|
lease_duration: 86400
|
||||||
|
ra_slaac_only: false
|
||||||
|
ra_allow_slaac: false
|
||||||
|
clients: []
|
||||||
|
log_compress: false
|
||||||
|
log_localtime: false
|
||||||
|
log_max_backups: 0
|
||||||
|
log_max_size: 100
|
||||||
|
log_max_age: 3
|
||||||
|
log_file: ""
|
||||||
|
verbose: false
|
||||||
|
os:
|
||||||
|
group: ""
|
||||||
|
user: ""
|
||||||
|
rlimit_nofile: 0
|
||||||
|
schema_version: 12
|
35
luci-app-adguardhome/root/usr/share/AdGuardHome/addhost.sh
Executable file
35
luci-app-adguardhome/root/usr/share/AdGuardHome/addhost.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
checkmd5(){
|
||||||
|
local nowmd5=$(md5sum /etc/hosts)
|
||||||
|
nowmd5=${nowmd5%% *}
|
||||||
|
local lastmd5=$(uci get AdGuardHome.AdGuardHome.hostsmd5 2>/dev/null)
|
||||||
|
if [ "$nowmd5" != "$lastmd5" ]; then
|
||||||
|
uci set AdGuardHome.AdGuardHome.hostsmd5="$nowmd5"
|
||||||
|
uci commit AdGuardHome
|
||||||
|
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' /etc/hosts && checkmd5 "$2" && exit 0
|
||||||
|
/usr/bin/awk 'BEGIN{
|
||||||
|
while ((getline < "/tmp/dhcp.leases") > 0)
|
||||||
|
{
|
||||||
|
a[$2]=$4;
|
||||||
|
}
|
||||||
|
while (("ip -6 neighbor show | grep -v fe80" | getline) > 0)
|
||||||
|
{
|
||||||
|
if (a[$5]) {print $1" "a[$5] >"/tmp/tmphost"; }
|
||||||
|
}
|
||||||
|
print "#programaddend" >"/tmp/tmphost";
|
||||||
|
}'
|
||||||
|
grep programaddstart /etc/hosts >/dev/null 2>&1
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
sed -i '/programaddstart/,/programaddend/c\#programaddstart' /etc/hosts
|
||||||
|
sed -i '/programaddstart/'r/tmp/tmphost /etc/hosts
|
||||||
|
else
|
||||||
|
echo "#programaddstart" >>/etc/hosts
|
||||||
|
cat /tmp/tmphost >> /etc/hosts
|
||||||
|
fi
|
||||||
|
rm /tmp/tmphost
|
||||||
|
checkmd5 "$2"
|
8
luci-app-adguardhome/root/usr/share/AdGuardHome/firewall.start
Executable file
8
luci-app-adguardhome/root/usr/share/AdGuardHome/firewall.start
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
AdGuardHome_enable=$(uci get AdGuardHome.AdGuardHome.enabled)
|
||||||
|
redirect=$(uci get AdGuardHome.AdGuardHome.redirect)
|
||||||
|
|
||||||
|
if [ $AdGuardHome_enable -eq 1 -a "$redirect" == "redirect" ]; then
|
||||||
|
/etc/init.d/AdGuardHome do_redirect 1
|
||||||
|
fi
|
20
luci-app-adguardhome/root/usr/share/AdGuardHome/getsyslog.sh
Executable file
20
luci-app-adguardhome/root/usr/share/AdGuardHome/getsyslog.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
logread -e AdGuardHome > /tmp/AdGuardHometmp.log
|
||||||
|
logread -e AdGuardHome -f >> /tmp/AdGuardHometmp.log &
|
||||||
|
pid=$!
|
||||||
|
echo "1">/var/run/AdGuardHomesyslog
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
sleep 12
|
||||||
|
watchdog=$(cat /var/run/AdGuardHomesyslog)
|
||||||
|
if [ "$watchdog"x == "0"x ]; then
|
||||||
|
kill $pid
|
||||||
|
rm /tmp/AdGuardHometmp.log
|
||||||
|
rm /var/run/AdGuardHomesyslog
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "0">/var/run/AdGuardHomesyslog
|
||||||
|
fi
|
||||||
|
done
|
89
luci-app-adguardhome/root/usr/share/AdGuardHome/gfw2adg.sh
Executable file
89
luci-app-adguardhome/root/usr/share/AdGuardHome/gfw2adg.sh
Executable file
|
@ -0,0 +1,89 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
|
||||||
|
checkmd5(){
|
||||||
|
local nowmd5=$(md5sum /tmp/adguard.list 2>/dev/null)
|
||||||
|
nowmd5=${nowmd5%% *}
|
||||||
|
local lastmd5=$(uci get AdGuardHome.AdGuardHome.gfwlistmd5 2>/dev/null)
|
||||||
|
if [ "$nowmd5" != "$lastmd5" ]; then
|
||||||
|
uci set AdGuardHome.AdGuardHome.gfwlistmd5="$nowmd5"
|
||||||
|
uci commit AdGuardHome
|
||||||
|
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configpath=$(uci get AdGuardHome.AdGuardHome.configpath 2>/dev/null)
|
||||||
|
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' $configpath && checkmd5 "$2" && exit 0
|
||||||
|
gfwupstream=$(uci get AdGuardHome.AdGuardHome.gfwupstream 2>/dev/null)
|
||||||
|
if [ -z $gfwupstream ]; then
|
||||||
|
gfwupstream="tcp://208.67.220.220:5353"
|
||||||
|
fi
|
||||||
|
if [ ! -f "$configpath" ]; then
|
||||||
|
echo "please make a config first"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O- | base64 -d > /tmp/gfwlist.txt
|
||||||
|
cat /tmp/gfwlist.txt | awk -v upst="$gfwupstream" 'BEGIN{getline;}{
|
||||||
|
s1=substr($0,1,1);
|
||||||
|
if (s1=="!")
|
||||||
|
{next;}
|
||||||
|
if (s1=="@"){
|
||||||
|
$0=substr($0,3);
|
||||||
|
s1=substr($0,1,1);
|
||||||
|
white=1;}
|
||||||
|
else{
|
||||||
|
white=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s1=="|")
|
||||||
|
{s2=substr($0,2,1);
|
||||||
|
if (s2=="|")
|
||||||
|
{
|
||||||
|
$0=substr($0,3);
|
||||||
|
split($0,d,"/");
|
||||||
|
$0=d[1];
|
||||||
|
}else{
|
||||||
|
split($0,d,"/");
|
||||||
|
$0=d[3];
|
||||||
|
}}
|
||||||
|
else{
|
||||||
|
split($0,d,"/");
|
||||||
|
$0=d[1];
|
||||||
|
}
|
||||||
|
star=index($0,"*");
|
||||||
|
if (star!=0)
|
||||||
|
{
|
||||||
|
$0=substr($0,star+1);
|
||||||
|
dot=index($0,".");
|
||||||
|
if (dot!=0)
|
||||||
|
$0=substr($0,dot+1);
|
||||||
|
else
|
||||||
|
next;
|
||||||
|
s1=substr($0,1,1);
|
||||||
|
}
|
||||||
|
if (s1==".")
|
||||||
|
{fin=substr($0,2);}
|
||||||
|
else{fin=$0;}
|
||||||
|
if (index(fin,".")==0) next;
|
||||||
|
if (index(fin,"%")!=0) next;
|
||||||
|
if (index(fin,":")!=0) next;
|
||||||
|
match(fin,"^[0-9\.]+")
|
||||||
|
if (RSTART==1 && RLENGTH==length(fin)) {print "ipset add gfwlist "fin>"/tmp/doipset.sh";next;}
|
||||||
|
if (fin=="" || finl==fin) next;
|
||||||
|
finl=fin;
|
||||||
|
if (white==0)
|
||||||
|
{print(" - '\''[/"fin"/]"upst"'\''");}
|
||||||
|
else{
|
||||||
|
print(" - '\''[/"fin"/]#'\''");}
|
||||||
|
}END{print(" - '\''[/programaddend/]#'\''")}' > /tmp/adguard.list
|
||||||
|
grep programaddstart $configpath
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
sed -i '/programaddstart/,/programaddend/c\ - '\''\[\/programaddstart\/\]#'\''' $configpath
|
||||||
|
sed -i '/programaddstart/'r/tmp/adguard.list $configpath
|
||||||
|
else
|
||||||
|
sed -i '1i\ - '\''[/programaddstart/]#'\''' /tmp/adguard.list
|
||||||
|
sed -i '/upstream_dns:/'r/tmp/adguard.list $configpath
|
||||||
|
fi
|
||||||
|
checkmd5 "$2"
|
||||||
|
rm -f /tmp/gfwlist.txt /tmp/adguard.list
|
3
luci-app-adguardhome/root/usr/share/AdGuardHome/links.txt
Executable file
3
luci-app-adguardhome/root/usr/share/AdGuardHome/links.txt
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_${Arch}.tar.gz
|
||||||
|
https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz
|
||||||
|
https://static.adguard.com/adguardhome/release/AdGuardHome_linux_${Arch}.tar.gz
|
5
luci-app-adguardhome/root/usr/share/AdGuardHome/tailto.sh
Executable file
5
luci-app-adguardhome/root/usr/share/AdGuardHome/tailto.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
tail -n $1 "$2" > /var/run/tailtmp
|
||||||
|
cat /var/run/tailtmp > "$2"
|
||||||
|
rm /var/run/tailtmp
|
236
luci-app-adguardhome/root/usr/share/AdGuardHome/update_core.sh
Executable file
236
luci-app-adguardhome/root/usr/share/AdGuardHome/update_core.sh
Executable file
|
@ -0,0 +1,236 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
binpath=$(uci get AdGuardHome.AdGuardHome.binpath)
|
||||||
|
if [ -z "$binpath" ]; then
|
||||||
|
uci set AdGuardHome.AdGuardHome.binpath="/tmp/AdGuardHome/AdGuardHome"
|
||||||
|
binpath="/tmp/AdGuardHome/AdGuardHome"
|
||||||
|
fi
|
||||||
|
mkdir -p ${binpath%/*}
|
||||||
|
upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null)
|
||||||
|
|
||||||
|
check_if_already_running(){
|
||||||
|
running_tasks="$(ps |grep "AdGuardHome" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||||
|
[ "${running_tasks}" -gt "2" ] && echo -e "\nA task is already running." && EXIT 2
|
||||||
|
}
|
||||||
|
|
||||||
|
check_wgetcurl(){
|
||||||
|
which curl && downloader="curl -L -k --retry 2 --connect-timeout 20 -o" && return
|
||||||
|
which wget-ssl && downloader="wget-ssl --no-check-certificate -t 2 -T 20 -O" && return
|
||||||
|
[ -z "$1" ] && opkg update || (echo error opkg && EXIT 1)
|
||||||
|
[ -z "$1" ] && (opkg remove wget wget-nossl --force-depends ; opkg install wget ; check_wgetcurl 1 ;return)
|
||||||
|
[ "$1" == "1" ] && (opkg install curl ; check_wgetcurl 2 ; return)
|
||||||
|
echo error curl and wget && EXIT 1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_latest_version(){
|
||||||
|
check_wgetcurl
|
||||||
|
latest_ver="$($downloader - https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E 'v[0-9.]+' -o 2>/dev/null)"
|
||||||
|
if [ -z "${latest_ver}" ]; then
|
||||||
|
echo -e "\nFailed to check latest version, please try again later." && EXIT 1
|
||||||
|
fi
|
||||||
|
now_ver="$($binpath -c /dev/null --check-config 2>&1| grep -m 1 -E 'v[0-9.]+' -o)"
|
||||||
|
if [ "${latest_ver}"x != "${now_ver}"x ] || [ "$1" == "force" ]; then
|
||||||
|
echo -e "Local version: ${now_ver}., cloud version: ${latest_ver}."
|
||||||
|
doupdate_core
|
||||||
|
else
|
||||||
|
echo -e "\nLocal version: ${now_ver}, cloud version: ${latest_ver}."
|
||||||
|
echo -e "You're already using the latest version."
|
||||||
|
if [ ! -z "$upxflag" ]; then
|
||||||
|
filesize=$(ls -l $binpath | awk '{ print $5 }')
|
||||||
|
if [ $filesize -gt 8000000 ]; then
|
||||||
|
echo -e "start upx may take a long time"
|
||||||
|
doupx
|
||||||
|
mkdir -p "/tmp/AdGuardHomeupdate/AdGuardHome" >/dev/null 2>&1
|
||||||
|
rm -fr /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/}
|
||||||
|
/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $binpath -o /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/}
|
||||||
|
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
||||||
|
/etc/init.d/AdGuardHome stop nobackup
|
||||||
|
rm $binpath
|
||||||
|
mv -f /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/} $binpath
|
||||||
|
/etc/init.d/AdGuardHome start
|
||||||
|
echo -e "finished"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
EXIT 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
doupx(){
|
||||||
|
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
|
||||||
|
case $Archt in
|
||||||
|
"i386")
|
||||||
|
Arch="i386"
|
||||||
|
;;
|
||||||
|
"i686")
|
||||||
|
Arch="i386"
|
||||||
|
echo -e "i686 use $Arch may have bug"
|
||||||
|
;;
|
||||||
|
"x86")
|
||||||
|
Arch="amd64"
|
||||||
|
;;
|
||||||
|
"mipsel")
|
||||||
|
Arch="mipsel"
|
||||||
|
;;
|
||||||
|
"mips64el")
|
||||||
|
Arch="mips64el"
|
||||||
|
Arch="mipsel"
|
||||||
|
echo -e "mips64el use $Arch may have bug"
|
||||||
|
;;
|
||||||
|
"mips")
|
||||||
|
Arch="mips"
|
||||||
|
;;
|
||||||
|
"mips64")
|
||||||
|
Arch="mips64"
|
||||||
|
Arch="mips"
|
||||||
|
echo -e "mips64 use $Arch may have bug"
|
||||||
|
;;
|
||||||
|
"arm")
|
||||||
|
Arch="arm"
|
||||||
|
;;
|
||||||
|
"armeb")
|
||||||
|
Arch="armeb"
|
||||||
|
;;
|
||||||
|
"aarch64")
|
||||||
|
Arch="arm64"
|
||||||
|
;;
|
||||||
|
"powerpc")
|
||||||
|
Arch="powerpc"
|
||||||
|
;;
|
||||||
|
"powerpc64")
|
||||||
|
Arch="powerpc64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "error not support $Archt if you can use offical release please issue a bug"
|
||||||
|
EXIT 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
upx_latest_ver="$($downloader - https://api.github.com/repos/upx/upx/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E '[0-9.]+' -o 2>/dev/null)"
|
||||||
|
$downloader /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz "https://github.com/upx/upx/releases/download/v${upx_latest_ver}/upx-${upx_latest_ver}-${Arch}_linux.tar.xz" 2>&1
|
||||||
|
#tar xvJf
|
||||||
|
which xz || (opkg list | grep ^xz || opkg update && opkg install xz) || (echo "xz download fail" && EXIT 1)
|
||||||
|
mkdir -p /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
||||||
|
xz -d -c /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz| tar -x -C "/tmp" >/dev/null 2>&1
|
||||||
|
if [ ! -e "/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx" ]; then
|
||||||
|
echo -e "Failed to download upx."
|
||||||
|
EXIT 1
|
||||||
|
fi
|
||||||
|
rm /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz
|
||||||
|
}
|
||||||
|
|
||||||
|
doupdate_core(){
|
||||||
|
echo -e "Updating core..."
|
||||||
|
mkdir -p "/tmp/AdGuardHomeupdate"
|
||||||
|
rm -rf /tmp/AdGuardHomeupdate/* >/dev/null 2>&1
|
||||||
|
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
|
||||||
|
case $Archt in
|
||||||
|
"i386")
|
||||||
|
Arch="386"
|
||||||
|
;;
|
||||||
|
"i686")
|
||||||
|
Arch="386"
|
||||||
|
;;
|
||||||
|
"x86")
|
||||||
|
Arch="amd64"
|
||||||
|
;;
|
||||||
|
"mipsel")
|
||||||
|
Arch="mipsle"
|
||||||
|
;;
|
||||||
|
"mips64el")
|
||||||
|
Arch="mips64le"
|
||||||
|
Arch="mipsle"
|
||||||
|
echo -e "mips64el use $Arch may have bug"
|
||||||
|
;;
|
||||||
|
"mips")
|
||||||
|
Arch="mips"
|
||||||
|
;;
|
||||||
|
"mips64")
|
||||||
|
Arch="mips64"
|
||||||
|
Arch="mips"
|
||||||
|
echo -e "mips64 use $Arch may have bug"
|
||||||
|
;;
|
||||||
|
"arm")
|
||||||
|
Arch="arm"
|
||||||
|
;;
|
||||||
|
"aarch64")
|
||||||
|
Arch="arm64"
|
||||||
|
;;
|
||||||
|
"powerpc")
|
||||||
|
Arch="ppc"
|
||||||
|
echo -e "error not support $Archt"
|
||||||
|
EXIT 1
|
||||||
|
;;
|
||||||
|
"powerpc64")
|
||||||
|
Arch="ppc64"
|
||||||
|
echo -e "error not support $Archt"
|
||||||
|
EXIT 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "error not support $Archt if you can use offical release please issue a bug"
|
||||||
|
EXIT 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo -e "start download"
|
||||||
|
grep -v "^#" /usr/share/AdGuardHome/links.txt >/tmp/run/AdHlinks.txt
|
||||||
|
while read link
|
||||||
|
do
|
||||||
|
eval link="$link"
|
||||||
|
$downloader /tmp/AdGuardHomeupdate/${link##*/} "$link" 2>&1
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "download failed try another download"
|
||||||
|
rm -f /tmp/AdGuardHomeupdate/${link##*/}
|
||||||
|
else
|
||||||
|
local success="1"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < "/tmp/run/AdHlinks.txt"
|
||||||
|
rm /tmp/run/AdHlinks.txt
|
||||||
|
[ -z "$success" ] && echo "no download success" && EXIT 1
|
||||||
|
if [ "${link##*.}" == "gz" ]; then
|
||||||
|
tar -zxf "/tmp/AdGuardHomeupdate/${link##*/}" -C "/tmp/AdGuardHomeupdate/"
|
||||||
|
if [ ! -e "/tmp/AdGuardHomeupdate/AdGuardHome" ]; then
|
||||||
|
echo -e "Failed to download core."
|
||||||
|
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
||||||
|
EXIT 1
|
||||||
|
fi
|
||||||
|
downloadbin="/tmp/AdGuardHomeupdate/AdGuardHome/AdGuardHome"
|
||||||
|
else
|
||||||
|
downloadbin="/tmp/AdGuardHomeupdate/${link##*/}"
|
||||||
|
fi
|
||||||
|
chmod 755 $downloadbin
|
||||||
|
echo -e "download success start copy"
|
||||||
|
if [ -n "$upxflag" ]; then
|
||||||
|
echo -e "start upx may take a long time"
|
||||||
|
doupx
|
||||||
|
/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $downloadbin
|
||||||
|
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
||||||
|
fi
|
||||||
|
echo -e "start copy"
|
||||||
|
/etc/init.d/AdGuardHome stop nobackup
|
||||||
|
rm "$binpath"
|
||||||
|
mv -f "$downloadbin" "$binpath"
|
||||||
|
if [ "$?" == "1" ]; then
|
||||||
|
echo "mv failed maybe not enough space please use upx or change bin to /tmp/AdGuardHome"
|
||||||
|
EXIT 1
|
||||||
|
fi
|
||||||
|
/etc/init.d/AdGuardHome start
|
||||||
|
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
||||||
|
echo -e "Succeeded in updating core."
|
||||||
|
echo -e "Local version: ${latest_ver}, cloud version: ${latest_ver}.\n"
|
||||||
|
EXIT 0
|
||||||
|
}
|
||||||
|
|
||||||
|
EXIT(){
|
||||||
|
rm /var/run/update_core 2>/dev/null
|
||||||
|
[ "$1" != "0" ] && touch /var/run/update_core_error
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
main(){
|
||||||
|
check_if_already_running
|
||||||
|
check_latest_version $1
|
||||||
|
}
|
||||||
|
trap "EXIT 1" SIGTERM SIGINT
|
||||||
|
touch /var/run/update_core
|
||||||
|
rm /var/run/update_core_error 2>/dev/null
|
||||||
|
main $1
|
35
luci-app-adguardhome/root/usr/share/AdGuardHome/waitnet.sh
Executable file
35
luci-app-adguardhome/root/usr/share/AdGuardHome/waitnet.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
count=0
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
ping -c 1 -W 1 -q www.baidu.com 1>/dev/null 2>&1
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
/etc/init.d/AdGuardHome force_reload
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
ping -c 1 -W 1 -q 202.108.22.5 1>/dev/null 2>&1
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
/etc/init.d/AdGuardHome force_reload
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
ping -c 1 -W 1 -q www.google.com 1>/dev/null 2>&1
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
/etc/init.d/AdGuardHome force_reload
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
ping -c 1 -W 1 -q 8.8.8.8 1>/dev/null 2>&1
|
||||||
|
if [ "$?" == "0" ]; then
|
||||||
|
/etc/init.d/AdGuardHome force_reload
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
count=$((count+1))
|
||||||
|
if [ $count -gt 18 ]; then
|
||||||
|
/etc/init.d/AdGuardHome force_reload
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
13
luci-app-adguardhome/root/usr/share/AdGuardHome/watchconfig.sh
Executable file
13
luci-app-adguardhome/root/usr/share/AdGuardHome/watchconfig.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
configpath=$(uci get AdGuardHome.AdGuardHome.configpath)
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
sleep 10
|
||||||
|
if [ -f "$configpath" ]; then
|
||||||
|
/etc/init.d/AdGuardHome do_redirect 1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
11
luci-app-adguardhome/root/usr/share/rpcd/acl.d/luci-app-adguardhome.json
Executable file
11
luci-app-adguardhome/root/usr/share/rpcd/acl.d/luci-app-adguardhome.json
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"luci-app-adguardhome": {
|
||||||
|
"description": "Grant UCI access for luci-app-adguardhome",
|
||||||
|
"read": {
|
||||||
|
"uci": [ "AdGuardHome" ]
|
||||||
|
},
|
||||||
|
"write": {
|
||||||
|
"uci": [ "AdGuardHome" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldcode.js
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldcode.js
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
!function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function e(e,o,i,t){if(i&&i.call){var l=i;i=null}else l=r(e,i,"rangeFinder");"number"==typeof o&&(o=n.Pos(o,0));var f=r(e,i,"minFoldSize");function d(n){var r=l(e,o);if(!r||r.to.line-r.from.line<f)return null;for(var i=e.findMarksAt(r.from),d=0;d<i.length;++d)if(i[d].__isFold&&"fold"!==t){if(!n)return null;r.cleared=!0,i[d].clear()}return r}var u=d(!0);if(r(e,i,"scanUp"))for(;!u&&o.line>e.firstLine();)o=n.Pos(o.line-1,0),u=d(!1);if(u&&!u.cleared&&"unfold"!==t){var a=function(n,e){var o=r(n,e,"widget");if("string"==typeof o){var i=document.createTextNode(o);(o=document.createElement("span")).appendChild(i),o.className="CodeMirror-foldmarker"}else o&&(o=o.cloneNode(!0));return o}(e,i);n.on(a,"mousedown",function(e){c.clear(),n.e_preventDefault(e)});var c=e.markText(u.from,u.to,{replacedWith:a,clearOnEnter:r(e,i,"clearOnEnter"),__isFold:!0});c.on("clear",function(o,r){n.signal(e,"unfold",e,o,r)}),n.signal(e,"fold",e,u.from,u.to)}}n.newFoldFunction=function(n,o){return function(r,i){e(r,i,{rangeFinder:n,widget:o})}},n.defineExtension("foldCode",function(n,o,r){e(this,n,o,r)}),n.defineExtension("isFolded",function(n){for(var e=this.findMarksAt(n),o=0;o<e.length;++o)if(e[o].__isFold)return!0}),n.commands.toggleFold=function(n){n.foldCode(n.getCursor())},n.commands.fold=function(n){n.foldCode(n.getCursor(),null,"fold")},n.commands.unfold=function(n){n.foldCode(n.getCursor(),null,"unfold")},n.commands.foldAll=function(e){e.operation(function(){for(var o=e.firstLine(),r=e.lastLine();o<=r;o++)e.foldCode(n.Pos(o,0),null,"fold")})},n.commands.unfoldAll=function(e){e.operation(function(){for(var o=e.firstLine(),r=e.lastLine();o<=r;o++)e.foldCode(n.Pos(o,0),null,"unfold")})},n.registerHelper("fold","combine",function(){var n=Array.prototype.slice.call(arguments,0);return function(e,o){for(var r=0;r<n.length;++r){var i=n[r](e,o);if(i)return i}}}),n.registerHelper("fold","auto",function(n,e){for(var o=n.getHelpers(e,"fold"),r=0;r<o.length;r++){var i=o[r](n,e);if(i)return i}});var o={rangeFinder:n.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function r(n,e,r){if(e&&void 0!==e[r])return e[r];var i=n.options.foldOptions;return i&&void 0!==i[r]?i[r]:o[r]}n.defineOption("foldOptions",null),n.defineExtension("foldOption",function(n,e){return r(this,n,e)})});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.css
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.css
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
.CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.js
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/foldgutter.js
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],t):t(CodeMirror)}(function(t){"use strict";t.defineOption("foldGutter",!1,function(o,e,r){r&&r!=t.Init&&(o.clearGutter(o.state.foldGutter.options.gutter),o.state.foldGutter=null,o.off("gutterClick",a),o.off("changes",d),o.off("viewportChange",u),o.off("fold",l),o.off("unfold",l),o.off("swapDoc",d)),e&&(o.state.foldGutter=new function(t){this.options=t,this.from=this.to=0}(function(t){!0===t&&(t={});null==t.gutter&&(t.gutter="CodeMirror-foldgutter");null==t.indicatorOpen&&(t.indicatorOpen="CodeMirror-foldgutter-open");null==t.indicatorFolded&&(t.indicatorFolded="CodeMirror-foldgutter-folded");return t}(e)),f(o),o.on("gutterClick",a),o.on("changes",d),o.on("viewportChange",u),o.on("fold",l),o.on("unfold",l),o.on("swapDoc",d))});var o=t.Pos;function e(t,e){for(var r=t.findMarks(o(e,0),o(e+1,0)),n=0;n<r.length;++n)if(r[n].__isFold){var i=r[n].find(-1);if(i&&i.line===e)return r[n]}}function r(t){if("string"==typeof t){var o=document.createElement("div");return o.className=t+" CodeMirror-guttermarker-subtle",o}return t.cloneNode(!0)}function n(t,n,f){var a=t.state.foldGutter.options,d=n-1,u=t.foldOption(a,"minFoldSize"),l=t.foldOption(a,"rangeFinder"),c="string"==typeof a.indicatorFolded&&i(a.indicatorFolded),s="string"==typeof a.indicatorOpen&&i(a.indicatorOpen);t.eachLine(n,f,function(n){++d;var i=null,f=n.gutterMarkers;if(f&&(f=f[a.gutter]),e(t,d)){if(c&&f&&c.test(f.className))return;i=r(a.indicatorFolded)}else{var p=o(d,0),m=l&&l(t,p);if(m&&m.to.line-m.from.line>=u){if(s&&f&&s.test(f.className))return;i=r(a.indicatorOpen)}}(i||f)&&t.setGutterMarker(n,a.gutter,i)})}function i(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function f(t){var o=t.getViewport(),e=t.state.foldGutter;e&&(t.operation(function(){n(t,o.from,o.to)}),e.from=o.from,e.to=o.to)}function a(t,r,n){var i=t.state.foldGutter;if(i){var f=i.options;if(n==f.gutter){var a=e(t,r);a?a.clear():t.foldCode(o(r,0),f)}}}function d(t){var o=t.state.foldGutter;if(o){var e=o.options;o.from=o.to=0,clearTimeout(o.changeUpdate),o.changeUpdate=setTimeout(function(){f(t)},e.foldOnChangeTimeSpan||600)}}function u(t){var o=t.state.foldGutter;if(o){var e=o.options;clearTimeout(o.changeUpdate),o.changeUpdate=setTimeout(function(){var e=t.getViewport();o.from==o.to||e.from-o.to>20||o.from-e.to>20?f(t):t.operation(function(){e.from<o.from&&(n(t,e.from,o.from),o.from=e.from),e.to>o.to&&(n(t,o.to,e.to),o.to=e.to)})},e.updateViewportTimeSpan||400)}}function l(t,o){var e=t.state.foldGutter;if(e){var r=o.line;r>=e.from&&r<e.to&&n(t,r,r+1)}}});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/indent-fold.js
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/addon/fold/indent-fold.js
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(n,t){var i=n.getLine(t),o=i.search(/\S/);return-1==o||/\bcomment\b/.test(n.getTokenTypeAt(e.Pos(t,o+1)))?-1:e.countColumn(i,null,n.getOption("tabSize"))}e.registerHelper("fold","indent",function(t,i){var o=n(t,i.line);if(!(o<0)){for(var r=null,l=i.line+1,f=t.lastLine();l<=f;++l){var u=n(t,l);if(-1==u);else{if(!(u>o))break;r=l}}return r?{from:e.Pos(i.line,t.getLine(i.line).length),to:e.Pos(r,t.getLine(r).length)}:void 0}})});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.css
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.css
vendored
Executable file
File diff suppressed because one or more lines are too long
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.js
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/lib/codemirror.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/mode/yaml/yaml.js
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/mode/yaml/yaml.js
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i");return{token:function(i,t){var r=i.peek(),n=t.escaped;if(t.escaped=!1,"#"==r&&(0==i.pos||/\s/.test(i.string.charAt(i.pos-1))))return i.skipToEnd(),"comment";if(i.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(t.literal&&i.indentation()>t.keyCol)return i.skipToEnd(),"string";if(t.literal&&(t.literal=!1),i.sol()){if(t.keyCol=0,t.pair=!1,t.pairStart=!1,i.match(/---/))return"def";if(i.match(/\.\.\./))return"def";if(i.match(/\s*-\s+/))return"meta"}if(i.match(/^(\{|\}|\[|\])/))return"{"==r?t.inlinePairs++:"}"==r?t.inlinePairs--:"["==r?t.inlineList++:t.inlineList--,"meta";if(t.inlineList>0&&!n&&","==r)return i.next(),"meta";if(t.inlinePairs>0&&!n&&","==r)return t.keyCol=0,t.pair=!1,t.pairStart=!1,i.next(),"meta";if(t.pairStart){if(i.match(/^\s*(\||\>)\s*/))return t.literal=!0,"meta";if(i.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==t.inlinePairs&&i.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(t.inlinePairs>0&&i.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(i.match(e))return"keyword"}return!t.pair&&i.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(t.pair=!0,t.keyCol=i.indentation(),"atom"):t.pair&&i.match(/^:\s*/)?(t.pairStart=!0,"meta"):(t.pairStart=!1,t.escaped="\\"==r,i.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-yaml","yaml"),e.defineMIME("text/yaml","yaml")});
|
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/theme/dracula.css
vendored
Executable file
1
luci-app-adguardhome/root/www/luci-static/resources/codemirror/theme/dracula.css
vendored
Executable file
|
@ -0,0 +1 @@
|
||||||
|
.cm-s-dracula.CodeMirror,.cm-s-dracula .CodeMirror-gutters{background-color:#282a36 !important;color:#f8f8f2 !important;border:0}.cm-s-dracula .CodeMirror-gutters{color:#282a36}.cm-s-dracula .CodeMirror-cursor{border-left:solid thin #f8f8f0}.cm-s-dracula .CodeMirror-linenumber{color:#6d8a88}.cm-s-dracula .CodeMirror-selected{background:rgba(255,255,255,0.10)}.cm-s-dracula .CodeMirror-line::selection,.cm-s-dracula .CodeMirror-line>span::selection,.cm-s-dracula .CodeMirror-line>span>span::selection{background:rgba(255,255,255,0.10)}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line>span::-moz-selection,.cm-s-dracula .CodeMirror-line>span>span::-moz-selection{background:rgba(255,255,255,0.10)}.cm-s-dracula span.cm-comment{color:#6272a4}.cm-s-dracula span.cm-string,.cm-s-dracula span.cm-string-2{color:#f1fa8c}.cm-s-dracula span.cm-number{color:#bd93f9}.cm-s-dracula span.cm-variable{color:#50fa7b}.cm-s-dracula span.cm-variable-2{color:white}.cm-s-dracula span.cm-def{color:#50fa7b}.cm-s-dracula span.cm-operator{color:#ff79c6}.cm-s-dracula span.cm-keyword{color:#ff79c6}.cm-s-dracula span.cm-atom{color:#bd93f9}.cm-s-dracula span.cm-meta{color:#f8f8f2}.cm-s-dracula span.cm-tag{color:#ff79c6}.cm-s-dracula span.cm-attribute{color:#50fa7b}.cm-s-dracula span.cm-qualifier{color:#50fa7b}.cm-s-dracula span.cm-property{color:#66d9ef}.cm-s-dracula span.cm-builtin{color:#50fa7b}.cm-s-dracula span.cm-variable-3,.cm-s-dracula span.cm-type{color:#ffb86c}.cm-s-dracula .CodeMirror-activeline-background{background:rgba(255,255,255,0.1)}.cm-s-dracula .CodeMirror-matchingbracket{text-decoration:underline;color:white !important}
|
7
luci-app-adguardhome/root/www/luci-static/resources/twin-bcrypt.min.js
vendored
Executable file
7
luci-app-adguardhome/root/www/luci-static/resources/twin-bcrypt.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
16
luci-app-cpufreq/Makefile
Executable file
16
luci-app-cpufreq/Makefile
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 ImmortalWrt.org
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
LUCI_TITLE:=LuCI for CPU Freq Setting
|
||||||
|
LUCI_DEPENDS:=@(arm||aarch64)
|
||||||
|
|
||||||
|
PKG_NAME:=luci-app-cpufreq
|
||||||
|
PKG_VERSION:=1
|
||||||
|
PKG_RELEASE:=$(COMMITCOUNT)
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
11
luci-app-cpufreq/luasrc/controller/cpufreq.lua
Executable file
11
luci-app-cpufreq/luasrc/controller/cpufreq.lua
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
module("luci.controller.cpufreq", package.seeall)
|
||||||
|
|
||||||
|
function index()
|
||||||
|
if not nixio.fs.access("/etc/config/cpufreq") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local page = entry({"admin", "system", "cpufreq"}, cbi("cpufreq"), _("CPU Freq"), 90)
|
||||||
|
page.dependent = false
|
||||||
|
page.acl_depends = { "luci-app-cpufreq" }
|
||||||
|
end
|
68
luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua
Executable file
68
luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua
Executable file
|
@ -0,0 +1,68 @@
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
|
||||||
|
function string.split(input, delimiter)
|
||||||
|
input = tostring(input)
|
||||||
|
delimiter = tostring(delimiter)
|
||||||
|
if (delimiter=='') then return false end
|
||||||
|
local pos,arr = 0, {}
|
||||||
|
for st,sp in function() return string.find(input, delimiter, pos, true) end do
|
||||||
|
table.insert(arr, string.sub(input, pos, st - 1))
|
||||||
|
pos = sp + 1
|
||||||
|
end
|
||||||
|
table.insert(arr, string.sub(input, pos))
|
||||||
|
return arr
|
||||||
|
end
|
||||||
|
|
||||||
|
mp = Map("cpufreq", translate("CPU Freq Settings"))
|
||||||
|
mp.description = translate("Set CPU Scaling Governor to Max Performance or Balance Mode")
|
||||||
|
|
||||||
|
s = mp:section(NamedSection, "cpufreq", "settings")
|
||||||
|
s.anonymouse = true
|
||||||
|
|
||||||
|
local policy_nums = luci.sys.exec("echo -n $(find /sys/devices/system/cpu/cpufreq/policy* -maxdepth 0 | grep -Eo '[0-9]+')")
|
||||||
|
for _, policy_num in ipairs(string.split(policy_nums, " ")) do
|
||||||
|
if not fs.access("/sys/devices/system/cpu/cpufreq/policy" .. policy_num .. "/scaling_available_frequencies") then return end
|
||||||
|
|
||||||
|
cpu_freqs = fs.readfile("/sys/devices/system/cpu/cpufreq/policy" .. policy_num .. "/scaling_available_frequencies")
|
||||||
|
cpu_freqs = string.sub(cpu_freqs, 1, -3)
|
||||||
|
|
||||||
|
cpu_governors = fs.readfile("/sys/devices/system/cpu/cpufreq/policy" .. policy_num .. "/scaling_available_governors")
|
||||||
|
cpu_governors = string.sub(cpu_governors, 1, -3)
|
||||||
|
|
||||||
|
|
||||||
|
freq_array = string.split(cpu_freqs, " ")
|
||||||
|
governor_array = string.split(cpu_governors, " ")
|
||||||
|
|
||||||
|
s:tab(policy_num, translate("Policy " .. policy_num))
|
||||||
|
|
||||||
|
governor = s:taboption(policy_num, ListValue, "governor" .. policy_num, translate("CPU Scaling Governor"))
|
||||||
|
for _, e in ipairs(governor_array) do
|
||||||
|
if e ~= "" then governor:value(e, translate(e, string.upper(e))) end
|
||||||
|
end
|
||||||
|
|
||||||
|
minfreq = s:taboption(policy_num, ListValue, "minfreq" .. policy_num, translate("Min Idle CPU Freq"))
|
||||||
|
for _, e in ipairs(freq_array) do
|
||||||
|
if e ~= "" then minfreq:value(e) end
|
||||||
|
end
|
||||||
|
|
||||||
|
maxfreq = s:taboption(policy_num, ListValue, "maxfreq" .. policy_num, translate("Max Turbo Boost CPU Freq"))
|
||||||
|
for _, e in ipairs(freq_array) do
|
||||||
|
if e ~= "" then maxfreq:value(e) end
|
||||||
|
end
|
||||||
|
|
||||||
|
sdfactor = s:taboption(policy_num, Value, "sdfactor" .. policy_num, translate("CPU Switching Sampling rate"))
|
||||||
|
sdfactor.datatype="range(1,100000)"
|
||||||
|
sdfactor.description = translate("The sampling rate determines how frequently the governor checks to tune the CPU (ms)")
|
||||||
|
sdfactor.placeholder = 10
|
||||||
|
sdfactor.default = 10
|
||||||
|
sdfactor:depends("governor" .. policy_num, "ondemand")
|
||||||
|
|
||||||
|
upthreshold = s:taboption(policy_num, Value, "upthreshold" .. policy_num, translate("CPU Switching Threshold"))
|
||||||
|
upthreshold.datatype="range(1,99)"
|
||||||
|
upthreshold.description = translate("Kernel make a decision on whether it should increase the frequency (%)")
|
||||||
|
upthreshold.placeholder = 50
|
||||||
|
upthreshold.default = 50
|
||||||
|
upthreshold:depends("governor" .. policy_num, "ondemand")
|
||||||
|
end
|
||||||
|
|
||||||
|
return mp
|
32
luci-app-cpufreq/po/zh-cn/cpufreq.po
Executable file
32
luci-app-cpufreq/po/zh-cn/cpufreq.po
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
msgid "CPU Freq"
|
||||||
|
msgstr "CPU 性能优化调节"
|
||||||
|
|
||||||
|
msgid "CPU Freq Settings"
|
||||||
|
msgstr "CPU 性能优化调节设置"
|
||||||
|
|
||||||
|
msgid "Set CPU Scaling Governor to Max Performance or Balance Mode"
|
||||||
|
msgstr "设置路由器的 CPU 性能模式(高性能/均衡省电)"
|
||||||
|
|
||||||
|
msgid "CPU Scaling Governor"
|
||||||
|
msgstr "CPU 工作模式"
|
||||||
|
|
||||||
|
msgid "CPU Freq from 48000 to 716000 (Khz)"
|
||||||
|
msgstr "CPU 频率范围为 48000 到 716000 (Khz)"
|
||||||
|
|
||||||
|
msgid "Min Idle CPU Freq"
|
||||||
|
msgstr "待机 CPU 最小频率"
|
||||||
|
|
||||||
|
msgid "Max Turbo Boost CPU Freq"
|
||||||
|
msgstr "最大 Turbo Boost CPU 频率"
|
||||||
|
|
||||||
|
msgid "CPU Switching Sampling rate"
|
||||||
|
msgstr "CPU 切换周期"
|
||||||
|
|
||||||
|
msgid "The sampling rate determines how frequently the governor checks to tune the CPU (ms)"
|
||||||
|
msgstr "CPU 检查切换的周期 (ms)。注意:过于频繁的切换频率会引起网络延迟抖动"
|
||||||
|
|
||||||
|
msgid "CPU Switching Threshold"
|
||||||
|
msgstr "CPU 切换频率触发阈值"
|
||||||
|
|
||||||
|
msgid "Kernel make a decision on whether it should increase the frequency (%)"
|
||||||
|
msgstr "当 CPU 占用率超过 (%) 的情况下触发内核切换频率"
|
3
luci-app-cpufreq/root/etc/config/cpufreq
Executable file
3
luci-app-cpufreq/root/etc/config/cpufreq
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
config settings 'cpufreq'
|
||||||
|
|
27
luci-app-cpufreq/root/etc/init.d/cpufreq
Executable file
27
luci-app-cpufreq/root/etc/init.d/cpufreq
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
START=15
|
||||||
|
|
||||||
|
NAME="cpufreq"
|
||||||
|
|
||||||
|
config_get_cpufreq()
|
||||||
|
{
|
||||||
|
config_get "$NAME" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
config_load "$NAME"
|
||||||
|
|
||||||
|
for i in $(find /sys/devices/system/cpu/cpufreq/policy* -maxdepth 0 | grep -Eo '[0-9]+')
|
||||||
|
do
|
||||||
|
[ -z "$(config_get_cpufreq "governor$i")" ] && return
|
||||||
|
|
||||||
|
config_get_cpufreq "governor$i" > "/sys/devices/system/cpu/cpufreq/policy$i/scaling_governor"
|
||||||
|
config_get_cpufreq "minfreq$i" > "/sys/devices/system/cpu/cpufreq/policy$i/scaling_min_freq"
|
||||||
|
config_get_cpufreq "maxfreq$i" > "/sys/devices/system/cpu/cpufreq/policy$i/scaling_max_freq"
|
||||||
|
if [ "$(config_get_cpufreq "governor$i")" = "ondemand" ]; then
|
||||||
|
config_get_cpufreq "sdfactor$i" > "/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor"
|
||||||
|
config_get_cpufreq "upthreshold$i" > "/sys/devices/system/cpu/cpufreq/ondemand/up_threshold"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
104
luci-app-cpufreq/root/etc/uci-defaults/10-cpufreq
Executable file
104
luci-app-cpufreq/root/etc/uci-defaults/10-cpufreq
Executable file
|
@ -0,0 +1,104 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci_write_config() {
|
||||||
|
uci -q set cpufreq.cpufreq.governor$1="$2"
|
||||||
|
uci -q set cpufreq.cpufreq.minfreq$1="$3"
|
||||||
|
uci -q set cpufreq.cpufreq.maxfreq$1="$4"
|
||||||
|
[ -n "$5" ] && uci -q set cpufreq.cpufreq.sdfactor$1="$5"
|
||||||
|
[ -n "$6" ] && uci -q set cpufreq.cpufreq.upthreshold$1="$6"
|
||||||
|
uci -q commit cpufreq
|
||||||
|
}
|
||||||
|
|
||||||
|
CPU_FREQS="$(cat '/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies')"
|
||||||
|
CPU_POLICYS="$(find '/sys/devices/system/cpu/cpufreq/policy'* -maxdepth 0 | grep -Eo '[0-9]+')"
|
||||||
|
source "/etc/openwrt_release"
|
||||||
|
case "$DISTRIB_TARGET" in
|
||||||
|
"bcm27xx/bcm2710")
|
||||||
|
uci_write_config 0 ondemand 600000 1200000 10 50
|
||||||
|
;;
|
||||||
|
"bcm27xx/bcm2711")
|
||||||
|
uci_write_config 0 ondemand 600000 1500000 10 50
|
||||||
|
;;
|
||||||
|
"ipq40xx/generic")
|
||||||
|
uci_write_config 0 ondemand 200000 716000 10 50
|
||||||
|
;;
|
||||||
|
"ipq60xx/generic")
|
||||||
|
if echo "$CPU_FREQS" | grep -q "1800000"; then
|
||||||
|
# IPQ6010/18/28
|
||||||
|
CPU_MAX_FREQ="1800000"
|
||||||
|
else
|
||||||
|
# IPQ6000
|
||||||
|
CPU_MAX_FREQ="1200000"
|
||||||
|
fi
|
||||||
|
uci_write_config 0 ondemand 864000 $CPU_MAX_FREQ 10 50
|
||||||
|
;;
|
||||||
|
"ipq806x/generic")
|
||||||
|
if echo "$CPU_FREQS" | grep -q "1725000"; then
|
||||||
|
# IPQ8065
|
||||||
|
CPU_MAX_FREQ="1725000"
|
||||||
|
elif echo "$CPU_FREQS" | grep -q "1400000"; then
|
||||||
|
# IPQ8064
|
||||||
|
CPU_MAX_FREQ="1400000"
|
||||||
|
else
|
||||||
|
# IPQ8062
|
||||||
|
CPU_MAX_FREQ="1000000"
|
||||||
|
fi
|
||||||
|
uci_write_config 0 ondemand 600000 $CPU_MAX_FREQ 10 50
|
||||||
|
# IPQ8064/5
|
||||||
|
echo "$CPU_POLICYS" | grep -q "1" && uci_write_config 1 ondemand 600000 1200000 10 50
|
||||||
|
;;
|
||||||
|
"ipq807x/generic")
|
||||||
|
if echo "$CPU_FREQS" | grep -q "2208000"; then
|
||||||
|
# IPQ8072/4/6/8A
|
||||||
|
CPU_MAX_FREQ="2208000"
|
||||||
|
else
|
||||||
|
# IPQ8071A
|
||||||
|
CPU_MAX_FREQ="1382400"
|
||||||
|
fi
|
||||||
|
uci_write_config 0 ondemand 1017600 $CPU_MAX_FREQ 10 50
|
||||||
|
;;
|
||||||
|
"mediatek/mt7622")
|
||||||
|
uci_write_config 0 ondemand 600000 1350000 10 50
|
||||||
|
;;
|
||||||
|
"meson/meson8b")
|
||||||
|
uci_write_config 0 schedutil 816000 1536000
|
||||||
|
;;
|
||||||
|
"rockchip/armv8")
|
||||||
|
if echo "$CPU_POLICYS" | grep -q "4"; then
|
||||||
|
# RK3399
|
||||||
|
uci_write_config 0 schedutil 600000 1608000
|
||||||
|
uci_write_config 4 schedutil 600000 2016000
|
||||||
|
else
|
||||||
|
if echo "$CPU_FREQS" | grep -q "1992000"; then
|
||||||
|
# RK3568
|
||||||
|
CPU_MAX_FREQ="1992000"
|
||||||
|
elif echo "$CPU_FREQS" | grep -q "1800000"; then
|
||||||
|
# RK3566
|
||||||
|
CPU_MAX_FREQ="1800000"
|
||||||
|
else
|
||||||
|
# RK3328
|
||||||
|
CPU_MAX_FREQ="1512000"
|
||||||
|
fi
|
||||||
|
uci_write_config 0 schedutil 816000 $CPU_MAX_FREQ
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"sunxi/cortexa53")
|
||||||
|
if echo "$CPU_FREQS" | grep -q "1800000"; then
|
||||||
|
# H6
|
||||||
|
uci_write_config 0 schedutil 816000 1800000
|
||||||
|
else
|
||||||
|
# H5
|
||||||
|
uci_write_config 0 ondemand 648000 1200000 10 50
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
delete ucitrack.@cpufreq[-1]
|
||||||
|
add ucitrack cpufreq
|
||||||
|
set ucitrack.@cpufreq[-1].init=cpufreq
|
||||||
|
commit ucitrack
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
exit 0
|
11
luci-app-cpufreq/root/usr/share/rpcd/acl.d/luci-app-cpufreq.json
Executable file
11
luci-app-cpufreq/root/usr/share/rpcd/acl.d/luci-app-cpufreq.json
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"luci-app-cpufreq": {
|
||||||
|
"description": "Grant UCI access for luci-app-cpufreq",
|
||||||
|
"read": {
|
||||||
|
"uci": [ "cpufreq" ]
|
||||||
|
},
|
||||||
|
"write": {
|
||||||
|
"uci": [ "cpufreq" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
luci-app-diskman/Makefile
Executable file
51
luci-app-diskman/Makefile
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=luci-app-diskman
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=lisaac <lisaac.cn@gmail.com>
|
||||||
|
PKG_LICENSE:=AGPL-3.0
|
||||||
|
|
||||||
|
LUCI_TITLE:=Disk Manager interface for LuCI
|
||||||
|
LUCI_DEPENDS:=+blkid +e2fsprogs +parted +smartmontools \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_btrfs_progs:btrfs-progs \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_lsblk:lsblk \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_mdadm:mdadm \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:mdadm \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:kmod-md-raid456 \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:mdadm \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:kmod-md-linear
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/config
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_btrfs_progs
|
||||||
|
bool "Include btrfs-progs"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_lsblk
|
||||||
|
bool "Include lsblk"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
|
||||||
|
bool "Include mdadm"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456
|
||||||
|
depends on PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
|
||||||
|
bool "Include kmod-md-raid456"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linear
|
||||||
|
depends on PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
|
||||||
|
bool "Include kmod-md-linear"
|
||||||
|
default n
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
rm -fr /tmp/luci-indexcache /tmp/luci-modulecache
|
||||||
|
endef
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue