sync
This commit is contained in:
parent
ed1029d103
commit
60a5b065ea
@ -8,12 +8,12 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=linux-firmware
|
PKG_NAME:=linux-firmware
|
||||||
PKG_VERSION:=20240220
|
PKG_VERSION:=20240709
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware
|
PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
PKG_HASH:=bf0f239dc0801e9d6bf5d5fb3e2f549575632cf4688f4348184199cb02c2bcd7
|
PKG_HASH:=719662d2e8644c097f9a0bfb6e4c97280f8b2943e7bd9b47f77cf039412f5b14
|
||||||
|
|
||||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Package/amd64-microcode = $(call Package/firmware-default,AMD64 CPU microcode,@TARGET_x86)
|
Package/amd64-microcode = $(call Package/firmware-default,AMD64 CPU microcode,,LICENSE.amd-ucode)
|
||||||
define Package/amd64-microcode/install
|
define Package/amd64-microcode/install
|
||||||
$(INSTALL_DIR) $(1)/lib/firmware/amd-ucode
|
$(INSTALL_DIR) $(1)/lib/firmware/amd-ucode
|
||||||
$(CP) \
|
$(CP) \
|
||||||
@ -8,7 +8,7 @@ endef
|
|||||||
|
|
||||||
$(eval $(call BuildPackage,amd64-microcode))
|
$(eval $(call BuildPackage,amd64-microcode))
|
||||||
|
|
||||||
Package/amdgpu-firmware = $(call Package/firmware-default,AMDGPU Video Driver firmware)
|
Package/amdgpu-firmware = $(call Package/firmware-default,AMDGPU Video Driver firmware,,LICENSE.amdgpura)
|
||||||
define Package/amdgpu-firmware/install
|
define Package/amdgpu-firmware/install
|
||||||
$(INSTALL_DIR) $(1)/lib/firmware/amdgpu
|
$(INSTALL_DIR) $(1)/lib/firmware/amdgpu
|
||||||
$(CP) \
|
$(CP) \
|
||||||
@ -18,7 +18,7 @@ endef
|
|||||||
|
|
||||||
$(eval $(call BuildPackage,amdgpu-firmware))
|
$(eval $(call BuildPackage,amdgpu-firmware))
|
||||||
|
|
||||||
Package/radeon-firmware = $(call Package/firmware-default,Radeon Video Driver firmware)
|
Package/radeon-firmware = $(call Package/firmware-default,Radeon Video Driver firmware,,LICENSE.radeon)
|
||||||
define Package/radeon-firmware/install
|
define Package/radeon-firmware/install
|
||||||
$(INSTALL_DIR) $(1)/lib/firmware/radeon
|
$(INSTALL_DIR) $(1)/lib/firmware/radeon
|
||||||
$(CP) \
|
$(CP) \
|
||||||
|
@ -731,8 +731,7 @@ define KernelPackage/r8169
|
|||||||
DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +!LINUX_5_4:kmod-mdio-devres
|
DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +!LINUX_5_4:kmod-mdio-devres
|
||||||
KCONFIG:= \
|
KCONFIG:= \
|
||||||
CONFIG_R8169 \
|
CONFIG_R8169 \
|
||||||
CONFIG_R8169_NAPI=y \
|
CONFIG_R8169_LEDS=y@ge6.6
|
||||||
CONFIG_R8169_VLAN=n
|
|
||||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/r8169.ko
|
FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/r8169.ko
|
||||||
AUTOLOAD:=$(call AutoProbe,r8169)
|
AUTOLOAD:=$(call AutoProbe,r8169)
|
||||||
endef
|
endef
|
||||||
|
@ -5,7 +5,7 @@ MHz=`grep 'MHz' /proc/cpuinfo | cut -c11- |sed -n '1p'`
|
|||||||
if [ "$(grep 'AMD' /proc/cpuinfo)" != "" ]; then
|
if [ "$(grep 'AMD' /proc/cpuinfo)" != "" ]; then
|
||||||
TEMP=`sensors 2>/dev/null | grep 'Tctl' | cut -c16-`
|
TEMP=`sensors 2>/dev/null | grep 'Tctl' | cut -c16-`
|
||||||
else
|
else
|
||||||
TEMP=`sensors 2>/dev/null | grep 'Core 0' | cut -c12-`
|
TEMP=`sensors 2>/dev/null | grep '0:' | awk -F ':' '{print $2}'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$MHz MHz $TEMP "
|
echo "$MHz MHz $TEMP "
|
||||||
|
@ -51,7 +51,7 @@ sed -i '/option disabled/d' /etc/config/wireless
|
|||||||
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
|
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
|
||||||
|
|
||||||
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
|
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
|
||||||
echo "DISTRIB_REVISION='R24.7.22-D'" >> /etc/openwrt_release
|
echo "DISTRIB_REVISION='R24.8.1'" >> /etc/openwrt_release
|
||||||
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
|
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
|
||||||
echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release
|
echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release
|
||||||
|
|
||||||
|
58
package/lean/leigod-acc/Makefile
Normal file
58
package/lean/leigod-acc/Makefile
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2015-2016 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=leigod-acc
|
||||||
|
PKG_VERSION:=1.3.0.30
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
TITLE:=Powerful Leigod Game Accelerater
|
||||||
|
DEPENDS:=@(x86_64||arm||mipsel||aarch64)
|
||||||
|
URL:=https://www.leigod.com/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/description
|
||||||
|
leigod-acc is a powerful game accelerater
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(ARCH),x86_64)
|
||||||
|
acc-arch:=amd64
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),mipsel)
|
||||||
|
acc-arch:=mipsle
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),arm)
|
||||||
|
acc-arch:=arm
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),aarch64)
|
||||||
|
acc-arch:=arm64
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin/leigod
|
||||||
|
$(INSTALL_BIN) ./files/acc-gw.linux.$(acc-arch) $(1)/usr/sbin/leigod/acc-gw.linux.$(acc-arch)
|
||||||
|
$(INSTALL_BIN) ./files/leigod_uninstall.sh $(1)/usr/sbin/leigod/leigod_uninstall.sh
|
||||||
|
$(INSTALL_BIN) ./files/plugin_common.sh $(1)/usr/sbin/leigod/plugin_common.sh
|
||||||
|
$(INSTALL_BIN) ./files/update_plugin $(1)/usr/sbin/leigod/update_plugin
|
||||||
|
$(INSTALL_DATA) ./files/version $(1)/usr/sbin/leigod/version
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
BIN
package/lean/leigod-acc/files/acc-gw.linux.amd64
Normal file
BIN
package/lean/leigod-acc/files/acc-gw.linux.amd64
Normal file
Binary file not shown.
BIN
package/lean/leigod-acc/files/acc-gw.linux.arm
Normal file
BIN
package/lean/leigod-acc/files/acc-gw.linux.arm
Normal file
Binary file not shown.
BIN
package/lean/leigod-acc/files/acc-gw.linux.arm64
Normal file
BIN
package/lean/leigod-acc/files/acc-gw.linux.arm64
Normal file
Binary file not shown.
BIN
package/lean/leigod-acc/files/acc-gw.linux.mipsle
Normal file
BIN
package/lean/leigod-acc/files/acc-gw.linux.mipsle
Normal file
Binary file not shown.
51
package/lean/leigod-acc/files/leigod-helper.sh
Normal file
51
package/lean/leigod-acc/files/leigod-helper.sh
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# https://github.com/isecret/leigod-helper/blob/main/leigod-helper.sh
|
||||||
|
|
||||||
|
USERNAME="${USERNAME:-phone}"
|
||||||
|
PASSWORD="${PASSWORD:-password}"
|
||||||
|
|
||||||
|
if ! command -v "jq" > /dev/null; then
|
||||||
|
echo "缺失 jq 依赖";
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v md5sum > /dev/null; then
|
||||||
|
password_hash=$(echo -n "$PASSWORD" | md5sum | awk '{print $1}')
|
||||||
|
elif command -v md5 > /dev/null; then
|
||||||
|
password_hash=$(echo -n "$PASSWORD" | md5)
|
||||||
|
else
|
||||||
|
echo "缺失 md5 或 md5sum 依赖,请手动安装"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
login=$(curl -Lks -X POST https://webapi.leigod.com/api/auth/login \
|
||||||
|
-H 'content-type: application/json' \
|
||||||
|
-d "{
|
||||||
|
\"account_token\": null,
|
||||||
|
\"country_code\": 86,
|
||||||
|
\"lang\": \"zh_CN\",
|
||||||
|
\"password\": \"$password_hash\",
|
||||||
|
\"region_code\": 1,
|
||||||
|
\"src_channel\": \"guanwang\",
|
||||||
|
\"user_type\": \"0\",
|
||||||
|
\"username\": \"$USERNAME\"
|
||||||
|
}")
|
||||||
|
|
||||||
|
login_code=$(echo $login | jq -r ".code" 2>&1)
|
||||||
|
login_msg=$(echo $login | jq -r ".msg" 2>&1)
|
||||||
|
|
||||||
|
if [ "$login_code" -eq 0 ]; then
|
||||||
|
account_token=$(echo $login | jq -r ".data.login_info.account_token" 2>&1)
|
||||||
|
pause=$(curl -Lks -X POST https://webapi.leigod.com/api/user/pause \
|
||||||
|
-H 'content-type: application/json' \
|
||||||
|
-d "{
|
||||||
|
\"account_token\": \"$account_token\",
|
||||||
|
\"lang\": \"zh_CN\"
|
||||||
|
}")
|
||||||
|
pause_code=$(echo $pause | jq -r ".code" 2>&1)
|
||||||
|
pause_msg=$(echo $pause | jq -r ".msg" 2>&1)
|
||||||
|
|
||||||
|
echo "暂停结果: $pause_msg"
|
||||||
|
else
|
||||||
|
echo "登录失败...原因: $login_msg"
|
||||||
|
fi
|
24
package/lean/leigod-acc/files/leigod_uninstall.sh
Normal file
24
package/lean/leigod-acc/files/leigod_uninstall.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# this script is use to install leigod plugin
|
||||||
|
ver_name="version"
|
||||||
|
init_file_name="acc"
|
||||||
|
binary_prefix="acc-gw.linux"
|
||||||
|
common_file_name="plugin_common.sh"
|
||||||
|
download_base_url="http://119.3.40.126/router_plugin"
|
||||||
|
|
||||||
|
# include common file
|
||||||
|
. ${common_file_name}
|
||||||
|
|
||||||
|
# preinstall_check
|
||||||
|
# check and set env
|
||||||
|
preinstall_check
|
||||||
|
|
||||||
|
if [ ${is_openwrt} ]; then
|
||||||
|
echo "remove openwrt config"
|
||||||
|
remove_openwrt_series_config
|
||||||
|
remove_openwrt_series_init
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove_binary remove binary
|
||||||
|
remove_binary
|
502
package/lean/leigod-acc/files/plugin_common.sh
Normal file
502
package/lean/leigod-acc/files/plugin_common.sh
Normal file
@ -0,0 +1,502 @@
|
|||||||
|
# this script is use to install leigod plugin
|
||||||
|
# sbin_dir="/usr/sbin/leigod"
|
||||||
|
ver_name="version"
|
||||||
|
init_file_name="acc"
|
||||||
|
binary_prefix="acc-gw.linux"
|
||||||
|
common_file_name="plugin_common.sh"
|
||||||
|
uninstall_file_name="leigod_uninstall.sh"
|
||||||
|
download_base_url="http://119.3.40.126/router_plugin"
|
||||||
|
|
||||||
|
# get_device_os
|
||||||
|
# current support os: Linux
|
||||||
|
get_device_os() {
|
||||||
|
os=$(uname)
|
||||||
|
if [ $? == "0" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "os cant be get"
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
# get_device_arch,
|
||||||
|
# current support arch: arm64 arm x86_64 mips
|
||||||
|
get_device_arch() {
|
||||||
|
arch=$(uname -m)
|
||||||
|
if [ $? == "0" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "arch cant be get"
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
# get_xiaomi_name check if is xiaomi
|
||||||
|
get_xiaomi_name() {
|
||||||
|
local name=$(uci get misc.hardware.displayName)
|
||||||
|
if [[ $? == "0" && ${name} != "" ]]; then
|
||||||
|
echo "router is xiaomi series, name: ${name}"
|
||||||
|
sbin_dir="/userdisk/appdata/leigod"
|
||||||
|
init_dir="/userdisk/appdata/leigod"
|
||||||
|
is_xiaomi=true
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local name=$(uci get misc.hardware.model)
|
||||||
|
if [[ $? == "0" && ${name} != "" ]]; then
|
||||||
|
echo "router is xiaomi series, name: ${name}"
|
||||||
|
sbin_dir="/userdisk/appdata/leigod"
|
||||||
|
init_dir="/userdisk/appdata/leigod"
|
||||||
|
is_xiaomi=true
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local name=$(uci get misc.hardware.model)
|
||||||
|
if [[ $? == "0" && ${name} != "" ]]; then
|
||||||
|
echo "router is xiaomi series, name: ${name}"
|
||||||
|
sbin_dir="/userdisk/appdata/leigod"
|
||||||
|
init_dir="/userdisk/appdata/leigod"
|
||||||
|
is_xiaomi=true
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "router is not xiaomi, use general openwrt"
|
||||||
|
sbin_dir="/usr/sbin/leigod"
|
||||||
|
init_dir="/etc/init.d"
|
||||||
|
# stop openwrt service first
|
||||||
|
echo "stop openwrt acc service first, in casue install failed"
|
||||||
|
/etc/init.d/acc stop
|
||||||
|
sleep 1
|
||||||
|
show_openwrt_suggestion
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# get_asus_name get asus name
|
||||||
|
get_merlin_party() {
|
||||||
|
if [[ -d "/koolshare" ]]; then
|
||||||
|
echo "router is merlin series, name: $(nvram get build_name)"
|
||||||
|
nvram set 3rd-party=merlin
|
||||||
|
is_merlin=true
|
||||||
|
sbin_dir="/koolshare/leigod/acc"
|
||||||
|
init_dir="/koolshare/init.d"
|
||||||
|
echo "message"
|
||||||
|
return 0
|
||||||
|
elif [[ -d "/jffs/softcenter" ]]; then
|
||||||
|
echo "router is swrt series, name: $(nvram get build_name)"
|
||||||
|
is_swrt=true
|
||||||
|
nvram set 3rd-party=swrt
|
||||||
|
sbin_dir="/jffs/softcenter/leigod/acc"
|
||||||
|
init_dir="/jffs/softcenter/init.d"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# check merlin
|
||||||
|
echo "route is not merlin, use general asus"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# get_device_firmware get device firmware
|
||||||
|
# current support firmware: openwrt merlin
|
||||||
|
get_device_firmware() {
|
||||||
|
# openwrt file exist
|
||||||
|
if [ -f "/etc/openwrt_release" ]; then
|
||||||
|
echo "firmware is openwrt series"
|
||||||
|
is_openwrt=true
|
||||||
|
get_xiaomi_name
|
||||||
|
elif [[ -f "/etc/image_version" ]] || [[ -d "/koolshare" ]] || [[ -d "/jffs/softcenter" ]]; then
|
||||||
|
echo "firmware is asus series"
|
||||||
|
is_asus=true
|
||||||
|
echo "stop asus acc service first, in casue install failed"
|
||||||
|
PIDS=$(ps | grep acc | grep -v grep | awk '{print $1}')
|
||||||
|
# check if process exist
|
||||||
|
get_merlin_party
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# install_openwrt_package install openwrt
|
||||||
|
install_binary() {
|
||||||
|
# create sbin dir
|
||||||
|
mkdir -p ${sbin_dir}
|
||||||
|
# create name
|
||||||
|
local acc_name=${binary_prefix}.${arch}
|
||||||
|
local download_bin_url=${download_base_url}/${acc_name}
|
||||||
|
echo "install ${acc_name} to ${sbin_dir}"
|
||||||
|
# download file
|
||||||
|
curl -s -o ${sbin_dir}/${acc_name} ${download_bin_url}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download and install binary failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "install binary success"
|
||||||
|
chmod +x ${sbin_dir}/${acc_name}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "add binary permission failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "add acc binary permission success"
|
||||||
|
# download common file
|
||||||
|
local download_common_url=${download_base_url}/${common_file_name}
|
||||||
|
curl -s -o ${sbin_dir}/${common_file_name} ${download_common_url}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download and install common file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remote uninstall_file_name
|
||||||
|
local remote_uninstall_file_name=${download_base_url}/"plugin_uninstall.sh"
|
||||||
|
curl -s -o ${sbin_dir}/${uninstall_file_name} ${remote_uninstall_file_name}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download and install uninstall file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "add uninstall permission success"
|
||||||
|
local ver_file=${sbin_dir}/${ver_name}
|
||||||
|
touch ${ver_file}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "create version file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# add version to file
|
||||||
|
echo "version=1.3.0.30" > ${ver_file}
|
||||||
|
echo "add version file success"
|
||||||
|
}
|
||||||
|
|
||||||
|
# remove_binary remove binary
|
||||||
|
remove_binary() {
|
||||||
|
rm -r ${sbin_dir}
|
||||||
|
}
|
||||||
|
|
||||||
|
# install xiaomi monitor
|
||||||
|
install_xiaomi_monitor() {
|
||||||
|
local cron_path="/etc/crontabs/root"
|
||||||
|
local monitor_file_name="plugin_monitor.sh"
|
||||||
|
local download_monitor_url=${download_base_url}/${monitor_file_name}
|
||||||
|
curl -o ${sbin_dir}/${monitor_file_name} ${download_monitor_url}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download monitor file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
chmod +x ${sbin_dir}/${monitor_file_name}
|
||||||
|
# download
|
||||||
|
echo "download monitor file success"
|
||||||
|
echo "*/1 * * * * ${sbin_dir}/${monitor_file_name}" >> ${cron_path}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "add monitor to cron failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "add monitor to cron success"
|
||||||
|
}
|
||||||
|
|
||||||
|
# install_openwrt_series_config save openwrt config
|
||||||
|
install_openwrt_series_config() {
|
||||||
|
# create accelerator config
|
||||||
|
touch /etc/config/accelerator
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "make acc config file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
if [ ${install_env} == "test" ]; then
|
||||||
|
# use uci to add config
|
||||||
|
uci set accelerator.base=system
|
||||||
|
uci set accelerator.bind=bind
|
||||||
|
uci set accelerator.device=hardware
|
||||||
|
uci set accelerator.Phone=acceleration
|
||||||
|
uci set accelerator.PC=acceleration
|
||||||
|
uci set accelerator.Game=acceleration
|
||||||
|
uci set accelerator.Unknown=acceleration
|
||||||
|
uci set accelerator.base.url='https://test-opapi.nn.com/speed/router/plug/check'
|
||||||
|
uci set accelerator.base.heart='https://test-opapi.nn.com/speed/router/heartbeat'
|
||||||
|
uci set accelerator.base.base_url='https://test-opapi.nn.com/speed'
|
||||||
|
uci commit accelerator
|
||||||
|
elif [ ${install_env} == "test1" ]; then
|
||||||
|
# use uci to add config
|
||||||
|
uci set accelerator.base=system
|
||||||
|
uci set accelerator.bind=bind
|
||||||
|
uci set accelerator.device=hardware
|
||||||
|
uci set accelerator.Phone=acceleration
|
||||||
|
uci set accelerator.PC=acceleration
|
||||||
|
uci set accelerator.Game=acceleration
|
||||||
|
uci set accelerator.Unknown=acceleration
|
||||||
|
uci set accelerator.base.url='https://test1-opapi.nn.com/speed/router/plug/check'
|
||||||
|
uci set accelerator.base.heart='https://test1-opapi.nn.com/speed/router/heartbeat'
|
||||||
|
uci set accelerator.base.base_url='https://test1-opapi.nn.com/speed'
|
||||||
|
uci commit accelerator
|
||||||
|
else
|
||||||
|
# use uci to add config
|
||||||
|
uci set accelerator.base=system
|
||||||
|
uci set accelerator.bind=bind
|
||||||
|
uci set accelerator.device=hardware
|
||||||
|
uci set accelerator.Phone=acceleration
|
||||||
|
uci set accelerator.PC=acceleration
|
||||||
|
uci set accelerator.Game=acceleration
|
||||||
|
uci set accelerator.Unknown=acceleration
|
||||||
|
uci set accelerator.base.url='https://opapi.nn.com/speed/router/plug/check'
|
||||||
|
uci set accelerator.base.heart='https://opapi.nn.com/speed/router/heartbeat'
|
||||||
|
uci set accelerator.base.base_url='https://opapi.nn.com/speed'
|
||||||
|
uci commit accelerator
|
||||||
|
fi
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "create openwrt config unit failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "create openwrt config unit success"
|
||||||
|
}
|
||||||
|
|
||||||
|
# install_openwrt_series_luasrc install openwrt lua src
|
||||||
|
install_openwrt_series_luasrc() {
|
||||||
|
lua_base="/usr/lib/lua/luci"
|
||||||
|
# download index file
|
||||||
|
curl --create-dirs -o ${lua_base}/controller/acc.lua ${download_base_url}/openwrt/controller/acc.lua
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download acc.lua failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# download service view file
|
||||||
|
curl --create-dirs -o ${lua_base}/model/cbi/leigod/service.lua ${download_base_url}/openwrt/model/cbi/leigod/service.lua
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download service.lua failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# download device view file
|
||||||
|
curl --create-dirs -o ${lua_base}/model/cbi/leigod/device.lua ${download_base_url}/openwrt/model/cbi/leigod/device.lua
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download device.lua failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# download notice view file
|
||||||
|
curl --create-dirs -o ${lua_base}/model/cbi/leigod/notice.lua ${download_base_url}/openwrt/model/cbi/leigod/notice.lua
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download notice.lua failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# download service view file
|
||||||
|
curl --create-dirs -o ${lua_base}/view/leigod/notice.htm ${download_base_url}/openwrt/view/leigod/notice.htm
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download notice.htm failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# download service view file
|
||||||
|
curl --create-dirs -o ${lua_base}/view/leigod/service.htm ${download_base_url}/openwrt/view/leigod/service.htm
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download service.htm failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# download service translate file
|
||||||
|
curl --create-dirs -o ${lua_base}/i18n/acc.zh-cn.lmo ${download_base_url}/openwrt/po/zh-cn/acc.zh-cn.lmo
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download acc.zh-cn.lmo failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "download lua src success"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_openwrt_series_web() {
|
||||||
|
local luci_base="/usr/lib/lua/luci"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# remove_openwrt_series_config remove openwrt config
|
||||||
|
remove_openwrt_series_config() {
|
||||||
|
rm /etc/config/accelerator
|
||||||
|
}
|
||||||
|
|
||||||
|
# install asus series config
|
||||||
|
install_asus_series_config() {
|
||||||
|
mkdir -p ${sbin_dir}/config
|
||||||
|
if [ ${install_env} == "test" ]; then
|
||||||
|
# install test asus config
|
||||||
|
echo "
|
||||||
|
[base]
|
||||||
|
url="https://test-opapi.nn.com/speed/router/plug/check"
|
||||||
|
channel="2"
|
||||||
|
appid="nnMobile_d0k3duup"
|
||||||
|
heart="https://test-opapi.nn.com/speed/router/heartbeat"
|
||||||
|
base_url="https://test-opapi.nn.com/speed"
|
||||||
|
|
||||||
|
[update]
|
||||||
|
domain="https://test-opapi.nn.com/nn-version/version/plug/upgrade"
|
||||||
|
|
||||||
|
[device]
|
||||||
|
" > ${sbin_dir}/config/accelerator
|
||||||
|
elif [ ${install_env} == "test1" ]; then
|
||||||
|
# install test1 asus config
|
||||||
|
echo "
|
||||||
|
[base]
|
||||||
|
url="https://test1-opapi.nn.com/speed/router/plug/check"
|
||||||
|
channel="2"
|
||||||
|
appid="nnMobile_d0k3duup"
|
||||||
|
heart="https://test1-opapi.nn.com/speed/router/heartbeat"
|
||||||
|
base_url="https://test1-opapi.nn.com/speed"
|
||||||
|
|
||||||
|
[update]
|
||||||
|
domain="https://test1-opapi.nn.com/nn-version/version/plug/upgrade"
|
||||||
|
|
||||||
|
[device]
|
||||||
|
" > ${sbin_dir}/config/accelerator
|
||||||
|
else
|
||||||
|
# install formel asus config
|
||||||
|
echo "
|
||||||
|
[base]
|
||||||
|
url="https://opapi.nn.com/speed/router/plug/check"
|
||||||
|
channel="2"
|
||||||
|
appid="nnMobile_d0k3duup"
|
||||||
|
heart="https://opapi.nn.com/speed/router/heartbeat"
|
||||||
|
base_url="https://opapi.nn.com/speed"
|
||||||
|
|
||||||
|
[update]
|
||||||
|
domain="https://opapi.nn.com/nn-version/version/plug/upgrade"
|
||||||
|
|
||||||
|
[device]
|
||||||
|
" > ${sbin_dir}/config/accelerator
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "create asus series config success"
|
||||||
|
}
|
||||||
|
|
||||||
|
# remove_asus_series_config remove asus config
|
||||||
|
remove_asus_series_config() {
|
||||||
|
rm -r ${init_dir}
|
||||||
|
}
|
||||||
|
|
||||||
|
# install_openwrt_init install openwrt to init
|
||||||
|
install_openwrt_series_init() {
|
||||||
|
local remote_init_name="openwrt_init.sh"
|
||||||
|
local download_init_url=${download_base_url}/${remote_init_name}
|
||||||
|
# download init file
|
||||||
|
curl -o ${init_dir}/${init_file_name} ${download_init_url}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download init file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "download init file success"
|
||||||
|
# add permission to file
|
||||||
|
chmod +x ${init_dir}/${init_file_name}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "add init permission failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "add init file permission success"
|
||||||
|
${init_dir}/${init_file_name} enable
|
||||||
|
echo "set accelerator autostart success"
|
||||||
|
${init_dir}/${init_file_name} start
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "start accelerator failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "start accelerator success"
|
||||||
|
}
|
||||||
|
|
||||||
|
# remove_openwrt_series_init remove openwrt init
|
||||||
|
remove_openwrt_series_init() {
|
||||||
|
${init_dir}/${init_file_name} disable
|
||||||
|
${init_dir}/${init_file_name} stop
|
||||||
|
rm ${init_dir}/${init_file_name}
|
||||||
|
}
|
||||||
|
|
||||||
|
# install merlin init
|
||||||
|
install_merlin_init() {
|
||||||
|
local remote_init_name="asus_init.sh"
|
||||||
|
local download_init_url=${download_base_url}/${remote_init_name}
|
||||||
|
# download init file
|
||||||
|
curl -o ${sbin_dir}/${init_file_name} ${download_init_url}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "download init file failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# add permission
|
||||||
|
chmod +x ${sbin_dir}/${init_file_name}
|
||||||
|
# create link
|
||||||
|
local link_init_name="S99LeigodAcc.sh"
|
||||||
|
local link_init_file=${init_dir}/${link_init_name}
|
||||||
|
ln -sf ${sbin_dir}/${init_file_name} ${link_init_file}
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "create merlin init link failed"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
echo "create merlin link file success"
|
||||||
|
${link_init_file} start
|
||||||
|
echo "acc start success"
|
||||||
|
}
|
||||||
|
|
||||||
|
# show_openwrt_suggestion show openwrt install suggest
|
||||||
|
show_openwrt_suggestion() {
|
||||||
|
echo "
|
||||||
|
雷神OpenWrt插件安装建议:
|
||||||
|
|
||||||
|
当前雷神路由器支持两种加速模式,
|
||||||
|
1. tproxy加速模式(速度更快, CPU占用率更低)
|
||||||
|
2. tun加速模式(需要依赖少, 安装灵活)
|
||||||
|
|
||||||
|
需要您根据以上的加速模式, 安装对应的依赖库,
|
||||||
|
如下列出两种模式对应的安装依赖:
|
||||||
|
1. TProxy模式: libpcap iptables kmod-ipt-nat iptables-mod-tproxy kmod-ipt-tproxy kmod-netem(可选) tc-full(可选) kmod-ipt-ipset ipset curl
|
||||||
|
2. Tun模式: libpcap iptables kmod-tun kmod-ipt-nat kmod-ipt-ipset ipset curl
|
||||||
|
|
||||||
|
如何安装依赖:
|
||||||
|
1. 升级依赖: opkg update
|
||||||
|
2. 安装依赖: opkg install xxx
|
||||||
|
|
||||||
|
为了安装方便, 请选择一个模式, 复制以下命令到终端运行:
|
||||||
|
Tproxy模式:
|
||||||
|
opkg update
|
||||||
|
opkg install libpcap iptables kmod-ipt-nat iptables-mod-tproxy kmod-ipt-tproxy kmod-netem tc-full kmod-ipt-ipset ipset
|
||||||
|
|
||||||
|
Tun模式:
|
||||||
|
opkg update
|
||||||
|
opkg install libpcap iptables kmod-tun kmod-ipt-nat kmod-ipt-ipset ipset curl
|
||||||
|
|
||||||
|
关于steamdeck的支持说明
|
||||||
|
steamdeck设备请选择加速电脑游戏
|
||||||
|
|
||||||
|
关于手机设备的支持:
|
||||||
|
1. 安卓支持说明
|
||||||
|
当前代理仅支持ipv4代理, 请更改dhcp配置,更改完配置请重启路由器,
|
||||||
|
配置路径在 /etc/config/dhcp
|
||||||
|
config dhcp 'lan'
|
||||||
|
... 此处是一些其他配置
|
||||||
|
ra 'disable'
|
||||||
|
dhcpv6 'disable'
|
||||||
|
list ra_flags 'none'
|
||||||
|
... 此处是一些其他配置
|
||||||
|
|
||||||
|
2. 关于ios设备的支持说明
|
||||||
|
ios设备, 安装完插件后, 为了精准识别, 请在ios上选择忘记wifi, 然后重新连接即可
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
# preinstall_check check env
|
||||||
|
preinstall_check() {
|
||||||
|
# check os
|
||||||
|
get_device_os
|
||||||
|
if [ ${os} != "Linux" ]; then
|
||||||
|
echo "current os not support, os: ${os}"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# check arch
|
||||||
|
get_device_arch
|
||||||
|
if [[ ${arch} != "x86_64" && ${arch} != "aarch64" && ${arch} != "arm" && ${arch} != "mips" && ${arch} != "armv7l" ]];then
|
||||||
|
echo "current arch not support, arch: ${arch}"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# fix arch
|
||||||
|
if [ ${arch} == "x86_64" ]; then
|
||||||
|
echo "match x86_64 -> amd64"
|
||||||
|
arch="amd64"
|
||||||
|
elif [ ${arch} == "aarch64" ]; then
|
||||||
|
echo "match aarch64 -> arm64"
|
||||||
|
arch="arm64"
|
||||||
|
elif [ ${arch} == "mips" ]; then
|
||||||
|
echo "match mips -> mipsle"
|
||||||
|
arch="mipsle"
|
||||||
|
elif [ ${arch} == "armv7l" ]; then
|
||||||
|
arch="arm"
|
||||||
|
fi
|
||||||
|
# support plugin
|
||||||
|
echo "current system support plugin, system: ${os}-${arch}"
|
||||||
|
get_device_firmware
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# show_install_success show install has been installed
|
||||||
|
show_install_success() {
|
||||||
|
echo "install success"
|
||||||
|
echo "雷神路由器插件安装已完成"
|
||||||
|
echo "请加群632342113体验"
|
||||||
|
}
|
||||||
|
|
175
package/lean/leigod-acc/files/update_plugin
Normal file
175
package/lean/leigod-acc/files/update_plugin
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
#!/usr/bin/lua
|
||||||
|
|
||||||
|
local util = require "luci.util"
|
||||||
|
local string = require "string"
|
||||||
|
local io = require "io"
|
||||||
|
local json = require "luci.jsonc"
|
||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
local client = require "luci.httpclient"
|
||||||
|
local helper = require "luci.helper"
|
||||||
|
|
||||||
|
-- get cloud version
|
||||||
|
function get_cloud_version()
|
||||||
|
-- get cloud url
|
||||||
|
local url = uci:get("easyupdate", "main", "domain")
|
||||||
|
-- get request channel
|
||||||
|
local channel = uci:get("easyupdate", "main", "channel")
|
||||||
|
-- appid
|
||||||
|
local appid = uci:get("easyupdate", "main", "appid")
|
||||||
|
-- read brand and model from file
|
||||||
|
local brand, model = helper.get_board_info()
|
||||||
|
-- platfrom
|
||||||
|
local platform = 11
|
||||||
|
-- create http request options
|
||||||
|
local options = {}
|
||||||
|
-- create http request method
|
||||||
|
options.method = "POST"
|
||||||
|
-- create http request headers
|
||||||
|
options.headers = {}
|
||||||
|
options.headers['appId'] = appid
|
||||||
|
options.headers['reqChannel'] = channel
|
||||||
|
options.headers['Content-Type'] = 'application/json'
|
||||||
|
-- create http request body
|
||||||
|
local body = {
|
||||||
|
--
|
||||||
|
['appId'] = 'spRouterPlugin_fhem2shgq9s5',
|
||||||
|
['brand'] = brand,
|
||||||
|
['model'] = model,
|
||||||
|
['platform'] = platform,
|
||||||
|
}
|
||||||
|
-- marshal to json
|
||||||
|
local buf = util.serialize_json(body)
|
||||||
|
options.body = buf
|
||||||
|
-- begin to query
|
||||||
|
local status, _, buffer, _ = client.request_raw(url, options)
|
||||||
|
-- check if query success
|
||||||
|
if not status then
|
||||||
|
io.write("status is nil \n")
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
-- check if request success
|
||||||
|
if status ~= 200 and status ~=206 then
|
||||||
|
io.write("status is not success, status: " .. status .. "\n")
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
-- begin to parse response
|
||||||
|
local info = json.parse(buffer)
|
||||||
|
-- get ret data
|
||||||
|
local data = info['retData']
|
||||||
|
-- check if data is nil
|
||||||
|
if data == nil then
|
||||||
|
io.write("response ret data is nil \n")
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
-- store url in config
|
||||||
|
local fw_url = data['url']
|
||||||
|
local version = data['versionName']
|
||||||
|
io.write("fw_url: " .. fw_url .. ", version: " .. version .. "\n")
|
||||||
|
-- get version success
|
||||||
|
return version, fw_url
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get local version
|
||||||
|
function get_local_version()
|
||||||
|
-- run command to get acc version
|
||||||
|
local cmd = 'opkg info acc'
|
||||||
|
local buf = util.exec(cmd)
|
||||||
|
-- check exec result
|
||||||
|
if buf == nil then
|
||||||
|
io.write("exec command failed \n")
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
io.write("buf: " .. buf .. "\n")
|
||||||
|
-- read line
|
||||||
|
for line in string.gmatch(buf, "[^\r\n]+") do
|
||||||
|
io.write("read line: " .. line .. "\n")
|
||||||
|
line = string.gsub(line, " ", "")
|
||||||
|
local valueSl = string.gmatch(line, "[^:]+")
|
||||||
|
local key = valueSl()
|
||||||
|
local value = valueSl()
|
||||||
|
if key == "Version" then
|
||||||
|
io.write("get local version: " .. value .. "\n")
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
io.write("local version cant found \n")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get file base name
|
||||||
|
function get_file_base_name(filepath)
|
||||||
|
local name = string.gmatch(filepath, "([^/]+)$")
|
||||||
|
io.write("get file base name: " .. name .. "\n")
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
|
||||||
|
-- download cloud version
|
||||||
|
function download_cloud_app(url, name)
|
||||||
|
io.write("download app, url: " .. url .. ", name: " .. name .. "\n")
|
||||||
|
-- run download
|
||||||
|
local cmd = 'curl -s -o /tmp/' .. name ..' -w %{http_code}' .. ' ' .. url
|
||||||
|
-- exec download
|
||||||
|
local code = util.exec(cmd)
|
||||||
|
if code ~= "200" then
|
||||||
|
io.write("download cloud app failed, code: " .. code .. "\n")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
io.write("download cloud app success \n")
|
||||||
|
return code
|
||||||
|
end
|
||||||
|
|
||||||
|
-- install package name in tmp dir
|
||||||
|
function install_package(name)
|
||||||
|
io.write("install package, package name: " .. name .. "\n")
|
||||||
|
local cmd = "opkg install " .. "/tmp/" .. name .. " " .. "--force-overwrite"
|
||||||
|
local code = util.exec(cmd)
|
||||||
|
io.write("install package finish, package name: " .. name .. "\n")
|
||||||
|
return code
|
||||||
|
end
|
||||||
|
|
||||||
|
-- remove pkg
|
||||||
|
function remove_pkg(name)
|
||||||
|
io.write("remove package, package name: " .. name .. "\n")
|
||||||
|
local cmd = "rm -rf " .. "/tmp/" .. name
|
||||||
|
local code = util.exec(cmd)
|
||||||
|
io.write("remove package finish, package name: " .. name .. "\n")
|
||||||
|
return code
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check network state
|
||||||
|
io.write("check network state \n")
|
||||||
|
while true do
|
||||||
|
local state_code = helper.get_network_state()
|
||||||
|
if state_code == 200 then
|
||||||
|
io.write("network available \n")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if state_code ~= nil then
|
||||||
|
io.write("network is not available, code: " .. state_code .. "\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
io.write("network success")
|
||||||
|
|
||||||
|
-- exec command
|
||||||
|
local local_version = get_local_version()
|
||||||
|
local cloud_version, url = get_cloud_version()
|
||||||
|
-- check if need update
|
||||||
|
if local_version >= cloud_version then
|
||||||
|
io.write("local version is new, dont need update, local ver: " .. local_version ..
|
||||||
|
", cloud version:" .. cloud_version .. "\n")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- need update
|
||||||
|
io.write("local version is lower, need update, local version: " .. local_version ..
|
||||||
|
", cloud version: " .. cloud_version .. "\n")
|
||||||
|
|
||||||
|
-- download url
|
||||||
|
local name = "acc.ipk"
|
||||||
|
local result = download_cloud_app(url, name)
|
||||||
|
if not result then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- install package
|
||||||
|
install_package(name)
|
||||||
|
remove_pkg(name)
|
1
package/lean/leigod-acc/files/version
Normal file
1
package/lean/leigod-acc/files/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
version=1.3.0.30
|
@ -13,7 +13,7 @@ PKG_VERSION:=8.5.0
|
|||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
|
PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
|
||||||
PKG_SOURCE_URL:=https://www.cryptopp.com/
|
PKG_SOURCE_URL:=https://github.com/weidai11/cryptopp/releases/download/CRYPTOPP_$(subst .,_,$(PKG_VERSION))/
|
||||||
PKG_HASH:=95fc50d59488ebf61a735cce2b2ec2c2561fc682077c7b496273d65a1ed93d9e
|
PKG_HASH:=95fc50d59488ebf61a735cce2b2ec2c2561fc682077c7b496273d65a1ed93d9e
|
||||||
|
|
||||||
PKG_FIXUP:=autoreconf
|
PKG_FIXUP:=autoreconf
|
||||||
@ -38,9 +38,19 @@ define Package/libcryptopp/description
|
|||||||
use of templates and abstract base classes.
|
use of templates and abstract base classes.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
PKG_BUILD_FILE:=cryptopp-autotools$(subst .,,$(PKG_VERSION)).zip
|
||||||
|
define Download/autotools
|
||||||
|
URL:=https://github.com/noloader/cryptopp-autotools/releases/download/CRYPTOPP_$(subst .,_,$(PKG_VERSION))/
|
||||||
|
FILE:=$(PKG_BUILD_FILE)
|
||||||
|
HASH:=91e06c53b517753f0ba02b92bb259e0ee929ebc6ad4f8b5c190d39ba407d3fbe
|
||||||
|
endef
|
||||||
|
$(eval $(call Download,autotools))
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
$(Build/Prepare/Default)
|
$(PKG_UNPACK)
|
||||||
|
unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_BUILD_FILE)
|
||||||
cd $(PKG_BUILD_DIR); rm -f GNUmakefile GNUmakefile-cross
|
cd $(PKG_BUILD_DIR); rm -f GNUmakefile GNUmakefile-cross
|
||||||
|
$(Build/Patch)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
|
24
package/lean/libcryptopp/patches/001-autotools.patch
Normal file
24
package/lean/libcryptopp/patches/001-autotools.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -458,14 +458,13 @@ testvector_FILES = \
|
||||||
|
TestVectors/lea.txt TestVectors/sosemanuk.txt \
|
||||||
|
TestVectors/mars.txt TestVectors/speck.txt \
|
||||||
|
TestVectors/nr.txt TestVectors/tea.txt \
|
||||||
|
- TestVectors/ocb.txt TestVectors/threefish.txt \
|
||||||
|
- TestVectors/panama.txt TestVectors/ttmac.txt \
|
||||||
|
- TestVectors/poly1305aes.txt TestVectors/vmac.txt \
|
||||||
|
- TestVectors/poly1305_tls.txt TestVectors/wake.txt \
|
||||||
|
- TestVectors/rabbit.txt TestVectors/whrlpool.txt \
|
||||||
|
- TestVectors/Readme.txt TestVectors/xchacha.txt \
|
||||||
|
- TestVectors/rsa_oaep.txt TestVectors/xts.txt \
|
||||||
|
- TestVectors/rsa_pkcs1_1_5.txt
|
||||||
|
+ TestVectors/panama.txt TestVectors/threefish.txt \
|
||||||
|
+ TestVectors/poly1305aes.txt TestVectors/ttmac.txt \
|
||||||
|
+ TestVectors/poly1305_tls.txt TestVectors/vmac.txt \
|
||||||
|
+ TestVectors/rabbit.txt TestVectors/wake.txt \
|
||||||
|
+ TestVectors/Readme.txt TestVectors/whrlpool.txt \
|
||||||
|
+ TestVectors/rsa_oaep.txt TestVectors/xchacha.txt \
|
||||||
|
+ TestVectors/rsa_pkcs1_1_5.txt TestVectors/xts.txt
|
||||||
|
|
||||||
|
# Create with 'ls TestPrograms/test_*.cxx'. These files do not get installed.
|
||||||
|
# They exist so the feature tests can be run from the configure directory.
|
@ -1,592 +0,0 @@
|
|||||||
## Makefile.am - Autotools configuration file for Crypto++.
|
|
||||||
## written and placed in public domain by Jeffrey Walton.
|
|
||||||
## based on Debian Makefile.am by László Böszörményi.
|
|
||||||
##
|
|
||||||
## The GNUmakefile can generate the list of lib headers, lib sources,
|
|
||||||
## test headers and test sources. Generate the list of files with
|
|
||||||
## 'make sources'. Remove the SIMD files for libothers_la_SOURCES.
|
|
||||||
## Thanks to steeldriver on U&L.SE for help with the sed.
|
|
||||||
##
|
|
||||||
## make sources | sed 's|cryptlib.cpp cpu.cpp integer.cpp ||g' | \
|
|
||||||
## sed -e 's|[[:alnum:]]*_simd.cpp ||g' | \
|
|
||||||
## sed -e 's|[[:alnum:]]*_sse.cpp ||g' | \
|
|
||||||
## sed -e 's|[[:alnum:]]*_avx.cpp ||g' | \
|
|
||||||
## sed -e 's|[[:alnum:]]*_armv4.cpp ||g' | \
|
|
||||||
## sed -e 's|ppc_power[[:alnum:]]*.cpp ||g' | \
|
|
||||||
## fold -s -w 72
|
|
||||||
##
|
|
||||||
## The command `make sources | sed ... | fold` will create the source file
|
|
||||||
## list that can be used with `libothers_la_SOURCES` below.
|
|
||||||
##
|
|
||||||
## The list of header files can be built with 'make sources', too.
|
|
||||||
##
|
|
||||||
## make sources | sed -e 's|[[:alnum:]]*_armv4.h ||g' \
|
|
||||||
## fold -s -w 72
|
|
||||||
##
|
|
||||||
## Note: configure.ac deletes GNUmakefile. You can get it back with:
|
|
||||||
##
|
|
||||||
## git checkout GNUmakefile
|
|
||||||
##
|
|
||||||
|
|
||||||
## Automake does not support "specific flags for certain source files"
|
|
||||||
## natively, so we hack it. The hack include building 20 or so
|
|
||||||
## libraries and then combining them into an archive or shared object.
|
|
||||||
## Also see https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html
|
|
||||||
## https://www.gnu.org/software/automake/manual/html_node/Per_002dObject-Flags.html.
|
|
||||||
##
|
|
||||||
## Visit the link below for the original Debian Autotools files
|
|
||||||
## https://sources.debian.net/src/libcrypto++/5.6.4-8/debian/autotools/
|
|
||||||
##
|
|
||||||
|
|
||||||
## TODO:
|
|
||||||
##
|
|
||||||
## - Figure out how to include TestPrograms/ in the dist tarball
|
|
||||||
## TestPrograms/ is unique because it is included in dist tarball but not installed
|
|
||||||
##
|
|
||||||
## - Figure out what's going on with DragonFly and dependencies
|
|
||||||
##
|
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
AM_DEFAULT_SOURCE_EXT = .cpp
|
|
||||||
|
|
||||||
## libcryptopp.la is created from disjoint libraries due to object file
|
|
||||||
## ordering and per-object file flags requirements. libcryptopp.la is
|
|
||||||
## named as the primary library, and the object files with special needs
|
|
||||||
## are listed as EXTRA_LTLIBRARIES. Also see
|
|
||||||
## https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html.
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = \
|
|
||||||
libcryptopp.la
|
|
||||||
|
|
||||||
EXTRA_LTLIBRARIES = \
|
|
||||||
libcryptlib.la \
|
|
||||||
libcpu.la \
|
|
||||||
libinteger.la \
|
|
||||||
libaria_simd.la \
|
|
||||||
libblake2s_simd.la \
|
|
||||||
libblake2b_simd.la \
|
|
||||||
libchacha_simd.la \
|
|
||||||
libchacha_avx.la \
|
|
||||||
libcham_simd.la \
|
|
||||||
libcrc_simd.la \
|
|
||||||
libdonna_sse.la \
|
|
||||||
libgcm_simd.la \
|
|
||||||
libgf2n_simd.la \
|
|
||||||
libkeccak_simd.la \
|
|
||||||
liblea_simd.la \
|
|
||||||
libneon_simd.la \
|
|
||||||
libppc_simd.la \
|
|
||||||
libppc_power7.la \
|
|
||||||
libppc_power8.la \
|
|
||||||
libppc_power9.la \
|
|
||||||
librijndael_simd.la \
|
|
||||||
libsha_simd.la \
|
|
||||||
libshacal2_simd.la \
|
|
||||||
libsimon128_simd.la \
|
|
||||||
libspeck128_simd.la \
|
|
||||||
libsm4_simd.la \
|
|
||||||
libsse_simd.la
|
|
||||||
|
|
||||||
## ARMv7-a AES and SHA by Andy Polyakov
|
|
||||||
if CRYPTOGAMS_ARM_SOURCES
|
|
||||||
EXTRA_LTLIBRARIES += libaes_armv4.la
|
|
||||||
EXTRA_LTLIBRARIES += libsha1_armv4.la
|
|
||||||
EXTRA_LTLIBRARIES += libsha256_armv4.la
|
|
||||||
EXTRA_LTLIBRARIES += libsha512_armv4.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
## The remainder of the source files
|
|
||||||
EXTRA_LTLIBRARIES += libothers.la
|
|
||||||
|
|
||||||
## libcryptopp_la_SOURCES is empty because we need to create the library
|
|
||||||
## artifact from disjoint libraries due to object file ordering and
|
|
||||||
## per-object file flags requriements. Actually, the adhoc.cpp file is
|
|
||||||
## due to an automake issue of assuming C sources when the list is empty.
|
|
||||||
## https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html.
|
|
||||||
|
|
||||||
libcryptopp_la_SOURCES = \
|
|
||||||
adhoc.cpp
|
|
||||||
|
|
||||||
## Don't use EXTRA_ prefix for libcryptopp_la_LIBADD. It breaks Solaris.
|
|
||||||
|
|
||||||
libcryptopp_la_LIBADD = \
|
|
||||||
$(libcryptlib_la_OBJECTS) \
|
|
||||||
$(libcpu_la_OBJECTS) \
|
|
||||||
$(libinteger_la_OBJECTS) \
|
|
||||||
$(libaria_simd_la_OBJECTS) \
|
|
||||||
$(libblake2s_simd_la_OBJECTS) \
|
|
||||||
$(libblake2b_simd_la_OBJECTS) \
|
|
||||||
$(libchacha_simd_la_OBJECTS) \
|
|
||||||
$(libchacha_avx_la_OBJECTS) \
|
|
||||||
$(libcham_simd_la_OBJECTS) \
|
|
||||||
$(libcrc_simd_la_OBJECTS) \
|
|
||||||
$(libdonna_sse_la_OBJECTS) \
|
|
||||||
$(libgcm_simd_la_OBJECTS) \
|
|
||||||
$(libgf2n_simd_la_OBJECTS) \
|
|
||||||
$(libkeccak_simd_la_OBJECTS) \
|
|
||||||
$(liblea_simd_la_OBJECTS) \
|
|
||||||
$(libneon_simd_la_OBJECTS) \
|
|
||||||
$(libppc_simd_la_OBJECTS) \
|
|
||||||
$(libppc_power7_la_OBJECTS) \
|
|
||||||
$(libppc_power8_la_OBJECTS) \
|
|
||||||
$(libppc_power9_la_OBJECTS) \
|
|
||||||
$(librijndael_simd_la_OBJECTS) \
|
|
||||||
$(libsha_simd_la_OBJECTS) \
|
|
||||||
$(libshacal2_simd_la_OBJECTS) \
|
|
||||||
$(libsimon128_simd_la_OBJECTS) \
|
|
||||||
$(libspeck128_simd_la_OBJECTS) \
|
|
||||||
$(libsm4_simd_la_OBJECTS) \
|
|
||||||
$(libsse_simd_la_OBJECTS)
|
|
||||||
|
|
||||||
## ARMv7-a AES and SHA by Andy Polyakov
|
|
||||||
if CRYPTOGAMS_ARM_SOURCES
|
|
||||||
libcryptopp_la_LIBADD += $(libaes_armv4_la_OBJECTS)
|
|
||||||
libcryptopp_la_LIBADD += $(libsha1_armv4_la_OBJECTS)
|
|
||||||
libcryptopp_la_LIBADD += $(libsha256_armv4_la_OBJECTS)
|
|
||||||
libcryptopp_la_LIBADD += $(libsha512_armv4_la_OBJECTS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
## cpufeatures library on Android
|
|
||||||
if ANDROID_CPU_FEATURES
|
|
||||||
libcryptopp_la_LIBADD += $(libcpu_features_la_OBJECTS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
## The remainder of the object files
|
|
||||||
libcryptopp_la_LIBADD += $(libothers_la_OBJECTS)
|
|
||||||
|
|
||||||
## Don't use EXTRA_ prefix for libcryptopp_la_DEPENDENCIES. It breaks Solaris.
|
|
||||||
|
|
||||||
libcryptopp_la_DEPENDENCIES = \
|
|
||||||
$(libcryptlib_la_OBJECTS) \
|
|
||||||
$(libcpu_la_OBJECTS) \
|
|
||||||
$(libinteger_la_OBJECTS) \
|
|
||||||
$(libaria_simd_la_OBJECTS) \
|
|
||||||
$(libblake2s_simd_la_OBJECTS) \
|
|
||||||
$(libblake2b_simd_la_OBJECTS) \
|
|
||||||
$(libchacha_simd_la_OBJECTS) \
|
|
||||||
$(libchacha_avx_la_OBJECTS) \
|
|
||||||
$(libcham_simd_la_OBJECTS) \
|
|
||||||
$(libcrc_simd_la_OBJECTS) \
|
|
||||||
$(libdonna_sse_la_OBJECTS) \
|
|
||||||
$(libkeccak_simd_la_OBJECTS) \
|
|
||||||
$(liblea_simd_la_OBJECTS) \
|
|
||||||
$(libgcm_simd_la_OBJECTS) \
|
|
||||||
$(libgf2n_simd_la_OBJECTS) \
|
|
||||||
$(libneon_simd_la_OBJECTS) \
|
|
||||||
$(libppc_simd_la_OBJECTS) \
|
|
||||||
$(libppc_power7_la_OBJECTS) \
|
|
||||||
$(libppc_power8_la_OBJECTS) \
|
|
||||||
$(libppc_power9_la_OBJECTS) \
|
|
||||||
$(librijndael_simd_la_OBJECTS) \
|
|
||||||
$(libsha_simd_la_OBJECTS) \
|
|
||||||
$(libshacal2_simd_la_OBJECTS) \
|
|
||||||
$(libsimon128_simd_la_OBJECTS) \
|
|
||||||
$(libspeck128_simd_la_OBJECTS) \
|
|
||||||
$(libsm4_simd_la_OBJECTS) \
|
|
||||||
$(libsse_simd_la_OBJECTS)
|
|
||||||
|
|
||||||
## ARMv7-a AES and SHA by Andy Polyakov
|
|
||||||
if CRYPTOGAMS_ARM_SOURCES
|
|
||||||
libcryptopp_la_DEPENDENCIES += $(libaes_armv4_la_OBJECTS)
|
|
||||||
libcryptopp_la_DEPENDENCIES += $(libsha1_armv4_la_OBJECTS)
|
|
||||||
libcryptopp_la_DEPENDENCIES += $(libsha256_armv4_la_OBJECTS)
|
|
||||||
libcryptopp_la_DEPENDENCIES += $(libsha512_armv4_la_OBJECTS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
## cpufeatures library on Android
|
|
||||||
if ANDROID_CPU_FEATURES
|
|
||||||
libcryptopp_la_DEPENDENCIES += $(libcpu_features_la_OBJECTS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
## The remainder of the object files
|
|
||||||
libcryptopp_la_DEPENDENCIES += $(libothers_la_OBJECTS)
|
|
||||||
|
|
||||||
## Man, did Autotools fuck this up royally...
|
|
||||||
## https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
|
||||||
libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -release 8.5.0 -version-info 8:5
|
|
||||||
|
|
||||||
## Source files with special needs
|
|
||||||
libcryptlib_la_SOURCES = cryptlib.cpp
|
|
||||||
libcryptlib_la_CXXFLAGS = $(AM_CXXFLAGS)
|
|
||||||
|
|
||||||
libcpu_la_SOURCES = cpu.cpp
|
|
||||||
libcpu_la_CXXFLAGS = $(AM_CXXFLAGS)
|
|
||||||
|
|
||||||
libinteger_la_SOURCES = integer.cpp
|
|
||||||
libinteger_la_CXXFLAGS = $(AM_CXXFLAGS)
|
|
||||||
|
|
||||||
libaria_simd_la_SOURCES = aria_simd.cpp
|
|
||||||
libaria_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_ARIA_FLAG)
|
|
||||||
|
|
||||||
libblake2s_simd_la_SOURCES = blake2s_simd.cpp
|
|
||||||
libblake2s_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_BLAKE2S_FLAG)
|
|
||||||
|
|
||||||
libblake2b_simd_la_SOURCES = blake2b_simd.cpp
|
|
||||||
libblake2b_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_BLAKE2B_FLAG)
|
|
||||||
|
|
||||||
libchacha_simd_la_SOURCES = chacha_simd.cpp
|
|
||||||
libchacha_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHACHA_FLAG)
|
|
||||||
|
|
||||||
libchacha_avx_la_SOURCES = chacha_avx.cpp
|
|
||||||
libchacha_avx_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHACHA_AVX2_FLAG)
|
|
||||||
|
|
||||||
libcham_simd_la_SOURCES = cham_simd.cpp
|
|
||||||
libcham_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHAM_FLAG)
|
|
||||||
|
|
||||||
libcrc_simd_la_SOURCES = crc_simd.cpp
|
|
||||||
libcrc_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CRC_FLAG)
|
|
||||||
|
|
||||||
libdonna_sse_la_SOURCES = donna_sse.cpp
|
|
||||||
libdonna_sse_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_DONNA_FLAG)
|
|
||||||
|
|
||||||
libgcm_simd_la_SOURCES = gcm_simd.cpp
|
|
||||||
libgcm_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_GCM_FLAG)
|
|
||||||
|
|
||||||
libgf2n_simd_la_SOURCES = gf2n_simd.cpp
|
|
||||||
libgf2n_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_GF2N_FLAG)
|
|
||||||
|
|
||||||
libkeccak_simd_la_SOURCES = keccak_simd.cpp
|
|
||||||
libkeccak_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_KECCAK_FLAG)
|
|
||||||
|
|
||||||
liblea_simd_la_SOURCES = lea_simd.cpp
|
|
||||||
liblea_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_LEA_FLAG)
|
|
||||||
|
|
||||||
libneon_simd_la_SOURCES = neon_simd.cpp
|
|
||||||
libneon_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_NEON_FLAG)
|
|
||||||
|
|
||||||
libppc_simd_la_SOURCES = ppc_simd.cpp
|
|
||||||
libppc_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_ALTIVEC_FLAG)
|
|
||||||
|
|
||||||
libppc_power7_la_SOURCES = ppc_power7.cpp
|
|
||||||
libppc_power7_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER7_FLAG)
|
|
||||||
|
|
||||||
libppc_power8_la_SOURCES = ppc_power8.cpp
|
|
||||||
libppc_power8_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER8_FLAG)
|
|
||||||
|
|
||||||
# Do not use CRYPTOPP_POWER9_FLAG. See https://github.com/weidai11/cryptopp/issues/986
|
|
||||||
libppc_power9_la_SOURCES = ppc_power9.cpp
|
|
||||||
# libppc_power9_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER9_FLAG)
|
|
||||||
libppc_power9_la_CXXFLAGS = $(AM_CXXFLAGS)
|
|
||||||
|
|
||||||
librijndael_simd_la_SOURCES = rijndael_simd.cpp
|
|
||||||
librijndael_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_AES_FLAG)
|
|
||||||
|
|
||||||
libsha_simd_la_SOURCES = sha_simd.cpp
|
|
||||||
libsha_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SHA_FLAG)
|
|
||||||
|
|
||||||
libshacal2_simd_la_SOURCES = shacal2_simd.cpp
|
|
||||||
libshacal2_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SHA_FLAG)
|
|
||||||
|
|
||||||
libsimon128_simd_la_SOURCES = simon128_simd.cpp
|
|
||||||
libsimon128_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SIMON128_FLAG)
|
|
||||||
|
|
||||||
libspeck128_simd_la_SOURCES = speck128_simd.cpp
|
|
||||||
libspeck128_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SPECK128_FLAG)
|
|
||||||
|
|
||||||
libsm4_simd_la_SOURCES = sm4_simd.cpp
|
|
||||||
libsm4_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SM4_FLAG)
|
|
||||||
|
|
||||||
libsse_simd_la_SOURCES = sse_simd.cpp
|
|
||||||
libsse_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SSE2_FLAG)
|
|
||||||
|
|
||||||
## ARMv7-a AES and SHA by Andy Polyakov
|
|
||||||
## Also see https://stackoverflow.com/q/51575580/608639
|
|
||||||
if CRYPTOGAMS_ARM_SOURCES
|
|
||||||
libaes_armv4_la_SOURCES = aes_armv4.S
|
|
||||||
libsha1_armv4_la_SOURCES = sha1_armv4.S
|
|
||||||
libsha256_armv4_la_SOURCES = sha256_armv4.S
|
|
||||||
libsha512_armv4_la_SOURCES = sha512_armv4.S
|
|
||||||
libaes_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_THUMB_FLAG)
|
|
||||||
libsha1_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
|
|
||||||
libsha256_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
|
|
||||||
libsha512_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
|
|
||||||
endif
|
|
||||||
|
|
||||||
## cpufeatures library on Android
|
|
||||||
if ANDROID_CPU_FEATURES
|
|
||||||
libcpu_features_la_SOURCES = cpu-features.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
# This is the list of remaining sources files that don't need special order
|
|
||||||
# and don't need special flags. It is formed by removing cryptlib.cpp,
|
|
||||||
# cpu.cpp, integer.cpp, *_avx.cpp and *_simd.cpp files. It is sorted in
|
|
||||||
# alphabetical order for deterministic builds.
|
|
||||||
|
|
||||||
# To build this list, see the head notes.
|
|
||||||
libothers_la_SOURCES = \
|
|
||||||
3way.cpp adler32.cpp algebra.cpp algparam.cpp allocate.cpp arc4.cpp \
|
|
||||||
aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp \
|
|
||||||
basecode.cpp bfinit.cpp blake2.cpp blowfish.cpp blumshub.cpp \
|
|
||||||
camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp \
|
|
||||||
chachapoly.cpp cham.cpp channels.cpp cmac.cpp crc.cpp darn.cpp \
|
|
||||||
default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp donna_32.cpp \
|
|
||||||
donna_64.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp \
|
|
||||||
emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp \
|
|
||||||
fipstest.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp \
|
|
||||||
gost.cpp gzip.cpp hc128.cpp hc256.cpp hex.cpp hight.cpp hmac.cpp \
|
|
||||||
hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp \
|
|
||||||
keccak.cpp keccak_core.cpp lea.cpp luc.cpp mars.cpp marss.cpp md2.cpp \
|
|
||||||
md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp \
|
|
||||||
oaep.cpp osrng.cpp padlkrng.cpp panama.cpp pkcspad.cpp poly1305.cpp \
|
|
||||||
polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabbit.cpp rabin.cpp \
|
|
||||||
randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp \
|
|
||||||
rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp \
|
|
||||||
scrypt.cpp seal.cpp seed.cpp serpent.cpp sha.cpp sha3.cpp shacal2.cpp \
|
|
||||||
shake.cpp shark.cpp sharkbox.cpp simeck.cpp simon.cpp skipjack.cpp \
|
|
||||||
sm3.cpp sm4.cpp sosemanuk.cpp speck.cpp square.cpp squaretb.cpp \
|
|
||||||
strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp \
|
|
||||||
ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wake.cpp whrlpool.cpp \
|
|
||||||
xed25519.cpp xtr.cpp xtrcrypt.cpp xts.cpp zdeflate.cpp zinflate.cpp \
|
|
||||||
zlib.cpp
|
|
||||||
|
|
||||||
# To build this list, see the head notes.
|
|
||||||
pkginclude_HEADERS = \
|
|
||||||
3way.h adler32.h adv_simd.h aes.h algebra.h algparam.h allocate.h \
|
|
||||||
arc4.h argnames.h aria.h arm_simd.h asn.h authenc.h base32.h base64.h \
|
|
||||||
basecode.h blake2.h blowfish.h blumshub.h camellia.h cast.h cbcmac.h \
|
|
||||||
ccm.h chacha.h chachapoly.h cham.h channels.h cmac.h config.h \
|
|
||||||
config_align.h config_asm.h config_cpu.h config_cxx.h config_dll.h \
|
|
||||||
config_int.h config_misc.h config_ns.h config_os.h config_ver.h cpu.h \
|
|
||||||
crc.h cryptlib.h darn.h default.h des.h dh.h dh2.h dll.h dmac.h donna.h \
|
|
||||||
donna_32.h donna_64.h donna_sse.h drbg.h dsa.h eax.h ec2n.h eccrypto.h \
|
|
||||||
ecp.h ecpoint.h elgamal.h emsa2.h eprecomp.h esign.h fhmqv.h files.h \
|
|
||||||
filters.h fips140.h fltrimpl.h gcm.h gf256.h gf2_32.h gf2n.h gfpcrypt.h \
|
|
||||||
gost.h gzip.h hashfwd.h hc128.h hc256.h hex.h hight.h hkdf.h hmac.h \
|
|
||||||
hmqv.h hrtimer.h ida.h idea.h integer.h iterhash.h kalyna.h keccak.h \
|
|
||||||
lea.h local.h lubyrack.h luc.h mars.h md2.h md4.h md5.h mdc.h \
|
|
||||||
mersenne.h misc.h modarith.h modes.h modexppc.h mqueue.h mqv.h \
|
|
||||||
naclite.h nbtheory.h nr.h oaep.h oids.h osrng.h ossig.h padlkrng.h \
|
|
||||||
panama.h pch.h pkcspad.h poly1305.h polynomi.h ppc_simd.h pssr.h \
|
|
||||||
pubkey.h pwdbased.h queue.h rabbit.h rabin.h randpool.h rc2.h rc5.h \
|
|
||||||
rc6.h rdrand.h rijndael.h ripemd.h rng.h rsa.h rw.h safer.h salsa.h \
|
|
||||||
scrypt.h seal.h secblock.h secblockfwd.h seckey.h seed.h serpent.h \
|
|
||||||
serpentp.h sha.h sha3.h shacal2.h shake.h shark.h simeck.h simon.h \
|
|
||||||
simple.h siphash.h skipjack.h sm3.h sm4.h smartptr.h sosemanuk.h \
|
|
||||||
speck.h square.h stdcpp.h strciphr.h tea.h threefish.h tiger.h trap.h \
|
|
||||||
trunhash.h ttmac.h tweetnacl.h twofish.h vmac.h wake.h whrlpool.h \
|
|
||||||
words.h xed25519.h xtr.h xtrcrypt.h xts.h zdeflate.h zinflate.h zlib.h
|
|
||||||
|
|
||||||
noinst_HEADERS = \
|
|
||||||
local.h \
|
|
||||||
bench.h \
|
|
||||||
factory.h \
|
|
||||||
resource.h \
|
|
||||||
validate.h \
|
|
||||||
aes_armv4.h \
|
|
||||||
sha1_armv4.h \
|
|
||||||
sha256_armv4.h \
|
|
||||||
sha512_armv4.h
|
|
||||||
|
|
||||||
bin_PROGRAMS = cryptest$(EXEEXT)
|
|
||||||
|
|
||||||
cryptest_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTEST_CXXFLAGS) -DCRYPTOPP_DATA_DIR='"${pkgdatadir}/"'
|
|
||||||
cryptest_SOURCES = \
|
|
||||||
test.cpp bench1.cpp bench2.cpp bench3.cpp datatest.cpp \
|
|
||||||
dlltest.cpp fipsalgt.cpp validat0.cpp validat1.cpp validat2.cpp \
|
|
||||||
validat3.cpp validat4.cpp validat5.cpp validat6.cpp validat7.cpp \
|
|
||||||
validat8.cpp validat9.cpp validat10.cpp regtest1.cpp regtest2.cpp \
|
|
||||||
regtest3.cpp regtest4.cpp
|
|
||||||
|
|
||||||
nodist_cryptest_SOURCES = adhoc.cpp
|
|
||||||
cryptest_LDADD = $(lib_LTLIBRARIES)
|
|
||||||
|
|
||||||
CLEANFILES = adhoc.cpp
|
|
||||||
|
|
||||||
## Copy the TestVectors/ and TestData/ to ${pkgdatadir}.
|
|
||||||
## TestPrograms/ is included in the tarball but not installed.
|
|
||||||
## https://www.gnu.org/software/automake/manual/html_node/Data.html
|
|
||||||
|
|
||||||
# Create with 'ls TestData/*.dat'. These files get installed.
|
|
||||||
testdata_FILES = \
|
|
||||||
TestData/3desval.dat TestData/fhmqv160.dat TestData/rc2val.dat \
|
|
||||||
TestData/3wayval.dat TestData/fhmqv256.dat TestData/rc5val.dat \
|
|
||||||
TestData/aria.dat TestData/fhmqv384.dat TestData/rc6val.dat \
|
|
||||||
TestData/camellia.dat TestData/fhmqv512.dat TestData/rijndael.dat \
|
|
||||||
TestData/cast128v.dat TestData/gostval.dat TestData/rsa1024.dat \
|
|
||||||
TestData/cast256v.dat TestData/hmqv160.dat TestData/rsa2048a.dat \
|
|
||||||
TestData/defdmac1.bin TestData/hmqv256.dat TestData/rsa2048.dat \
|
|
||||||
TestData/defdmac2.bin TestData/hmqv384.dat TestData/rsa400pb.dat \
|
|
||||||
TestData/descert.dat TestData/hmqv512.dat TestData/rsa400pv.dat \
|
|
||||||
TestData/dh1024.dat TestData/ideaval.dat TestData/rsa512a.dat \
|
|
||||||
TestData/dh2048.dat TestData/luc1024.dat TestData/rw1024.dat \
|
|
||||||
TestData/dlie1024.dat TestData/luc2048.dat TestData/rw2048.dat \
|
|
||||||
TestData/dlie2048.dat TestData/lucc1024.dat TestData/saferval.dat \
|
|
||||||
TestData/dsa1024b.dat TestData/lucc512.dat TestData/serpentv.dat \
|
|
||||||
TestData/dsa1024.dat TestData/lucd1024.dat TestData/shacal2v.dat \
|
|
||||||
TestData/dsa512.dat TestData/lucd512.dat TestData/sharkval.dat \
|
|
||||||
TestData/ecies_p160.dat TestData/lucs1024.dat TestData/skipjack.dat \
|
|
||||||
TestData/ecies_t163.dat TestData/lucs512.dat TestData/squareva.dat \
|
|
||||||
TestData/ed25519.dat TestData/marsval.dat TestData/twofishv.dat \
|
|
||||||
TestData/ed25519v0.dat TestData/mqv1024.dat TestData/usage.dat \
|
|
||||||
TestData/ed25519v1.dat TestData/mqv2048.dat TestData/x25519.dat \
|
|
||||||
TestData/elgc1024.dat TestData/nr1024.dat TestData/x25519v0.dat \
|
|
||||||
TestData/esig1023.dat TestData/nr2048.dat TestData/x25519v1.dat \
|
|
||||||
TestData/esig1536.dat TestData/rabi1024.dat TestData/xtrdh171.dat \
|
|
||||||
TestData/esig2046.dat TestData/rabi2048.dat TestData/xtrdh342.dat
|
|
||||||
|
|
||||||
# Create with 'ls TestVectors/*.txt'. These files get installed.
|
|
||||||
testvector_FILES = \
|
|
||||||
TestVectors/aead.txt TestVectors/rsa_pss.txt \
|
|
||||||
TestVectors/aes.txt TestVectors/rw.txt \
|
|
||||||
TestVectors/all.txt TestVectors/salsa.txt \
|
|
||||||
TestVectors/aria.txt TestVectors/seal.txt \
|
|
||||||
TestVectors/blake2b.txt TestVectors/seed.txt \
|
|
||||||
TestVectors/blake2s.txt TestVectors/sha1_160_fips_180.txt \
|
|
||||||
TestVectors/blake2.txt TestVectors/sha1_fips_180.txt \
|
|
||||||
TestVectors/camellia.txt TestVectors/sha2_224_fips_180.txt \
|
|
||||||
TestVectors/ccm.txt TestVectors/sha2_256_fips_180.txt \
|
|
||||||
TestVectors/chacha20poly1305.txt TestVectors/sha2_384_fips_180.txt \
|
|
||||||
TestVectors/chacha_tls.txt TestVectors/sha2_512_fips_180.txt \
|
|
||||||
TestVectors/chacha.txt TestVectors/sha2_fips_180.txt \
|
|
||||||
TestVectors/cham.txt TestVectors/sha2.txt \
|
|
||||||
TestVectors/cmac.txt TestVectors/sha3_224_fips_202.txt \
|
|
||||||
TestVectors/dlies.txt TestVectors/sha3_256_fips_202.txt \
|
|
||||||
TestVectors/dsa_1363.txt TestVectors/sha3_384_fips_202.txt \
|
|
||||||
TestVectors/dsa_rfc6979.txt TestVectors/sha3_512_fips_202.txt \
|
|
||||||
TestVectors/dsa.txt TestVectors/sha3_fips_202.txt \
|
|
||||||
TestVectors/eax.txt TestVectors/sha3.txt \
|
|
||||||
TestVectors/esign.txt TestVectors/shacal2.txt \
|
|
||||||
TestVectors/gcm.txt TestVectors/shake.txt \
|
|
||||||
TestVectors/hc128.txt TestVectors/sha.txt \
|
|
||||||
TestVectors/hc256.txt TestVectors/simeck.txt \
|
|
||||||
TestVectors/hight.txt TestVectors/simon.txt \
|
|
||||||
TestVectors/hkdf.txt TestVectors/siphash.txt \
|
|
||||||
TestVectors/hmac.txt TestVectors/skipjack.txt \
|
|
||||||
TestVectors/kalyna.txt TestVectors/sm3.txt \
|
|
||||||
TestVectors/keccak.txt TestVectors/sm4.txt \
|
|
||||||
TestVectors/lea.txt TestVectors/sosemanuk.txt \
|
|
||||||
TestVectors/mars.txt TestVectors/speck.txt \
|
|
||||||
TestVectors/nr.txt TestVectors/tea.txt \
|
|
||||||
TestVectors/panama.txt TestVectors/threefish.txt \
|
|
||||||
TestVectors/poly1305aes.txt TestVectors/ttmac.txt \
|
|
||||||
TestVectors/poly1305_tls.txt TestVectors/vmac.txt \
|
|
||||||
TestVectors/rabbit.txt TestVectors/wake.txt \
|
|
||||||
TestVectors/Readme.txt TestVectors/whrlpool.txt \
|
|
||||||
TestVectors/rsa_oaep.txt TestVectors/xchacha.txt \
|
|
||||||
TestVectors/rsa_pkcs1_1_5.txt TestVectors/xts.txt
|
|
||||||
|
|
||||||
# Create with 'ls TestPrograms/test_*.cxx'. These files do not get installed.
|
|
||||||
# They exist so the feature tests can be run from the configure directory.
|
|
||||||
testprogs_FILES= \
|
|
||||||
TestPrograms/test_32bit.cxx
|
|
||||||
TestPrograms/test_64bit.cxx
|
|
||||||
TestPrograms/test_arm_acle_header.cxx
|
|
||||||
TestPrograms/test_arm_aes.cxx
|
|
||||||
TestPrograms/test_arm_asimd.cxx
|
|
||||||
TestPrograms/test_arm_crc.cxx
|
|
||||||
TestPrograms/test_arm_neon.cxx
|
|
||||||
TestPrograms/test_arm_neon_header.cxx
|
|
||||||
TestPrograms/test_arm_pmull.cxx
|
|
||||||
TestPrograms/test_arm_sha1.cxx
|
|
||||||
TestPrograms/test_arm_sha256.cxx
|
|
||||||
TestPrograms/test_arm_sha3.cxx
|
|
||||||
TestPrograms/test_arm_sha512.cxx
|
|
||||||
TestPrograms/test_arm_sm3.cxx
|
|
||||||
TestPrograms/test_arm_sm4.cxx
|
|
||||||
TestPrograms/test_asm_mixed.cxx
|
|
||||||
TestPrograms/test_cxx11_alignas.cxx
|
|
||||||
TestPrograms/test_cxx11_alignof.cxx
|
|
||||||
TestPrograms/test_cxx11_assert.cxx
|
|
||||||
TestPrograms/test_cxx11_atomic.cxx
|
|
||||||
TestPrograms/test_cxx11_auto.cxx
|
|
||||||
TestPrograms/test_cxx11_constexpr.cxx
|
|
||||||
TestPrograms/test_cxx11.cxx
|
|
||||||
TestPrograms/test_cxx11_deletefn.cxx
|
|
||||||
TestPrograms/test_cxx11_enumtype.cxx
|
|
||||||
TestPrograms/test_cxx11_initializer.cxx
|
|
||||||
TestPrograms/test_cxx11_lambda.cxx
|
|
||||||
TestPrograms/test_cxx11_noexcept.cxx
|
|
||||||
TestPrograms/test_cxx11_nullptr.cxx
|
|
||||||
TestPrograms/test_cxx11_staticinit.cxx
|
|
||||||
TestPrograms/test_cxx11_sync.cxx
|
|
||||||
TestPrograms/test_cxx11_vartemplates.cxx
|
|
||||||
TestPrograms/test_cxx14.cxx
|
|
||||||
TestPrograms/test_cxx17_assert.cxx
|
|
||||||
TestPrograms/test_cxx17.cxx
|
|
||||||
TestPrograms/test_cxx17_exceptions.cxx
|
|
||||||
TestPrograms/test_cxx98_exception.cxx
|
|
||||||
TestPrograms/test_cxx.cxx
|
|
||||||
TestPrograms/test_glibc.cxx
|
|
||||||
TestPrograms/test_newlib.cxx
|
|
||||||
TestPrograms/test_ppc_aes.cxx
|
|
||||||
TestPrograms/test_ppc_altivec.cxx
|
|
||||||
TestPrograms/test_ppc_power7.cxx
|
|
||||||
TestPrograms/test_ppc_power8.cxx
|
|
||||||
TestPrograms/test_ppc_power9.cxx
|
|
||||||
TestPrograms/test_ppc_sha.cxx
|
|
||||||
TestPrograms/test_ppc_vmull.cxx
|
|
||||||
TestPrograms/test_pthreads.cxx
|
|
||||||
TestPrograms/test_x86_aes.cxx
|
|
||||||
TestPrograms/test_x86_avx2.cxx
|
|
||||||
TestPrograms/test_x86_avx512.cxx
|
|
||||||
TestPrograms/test_x86_avx.cxx
|
|
||||||
TestPrograms/test_x86_clmul.cxx
|
|
||||||
TestPrograms/test_x86_cpuid.cxx
|
|
||||||
TestPrograms/test_x86_rdrand.cxx
|
|
||||||
TestPrograms/test_x86_rdseed.cxx
|
|
||||||
TestPrograms/test_x86_sha.cxx
|
|
||||||
TestPrograms/test_x86_sse2.cxx
|
|
||||||
TestPrograms/test_x86_sse3.cxx
|
|
||||||
TestPrograms/test_x86_sse41.cxx
|
|
||||||
TestPrograms/test_x86_sse42.cxx
|
|
||||||
TestPrograms/test_x86_ssse3.cxx
|
|
||||||
TestPrograms/test_x86_via_aes.cxx
|
|
||||||
TestPrograms/test_x86_via_rng.cxx
|
|
||||||
TestPrograms/test_x86_via_sha.cxx
|
|
||||||
|
|
||||||
nobase_dist_pkgdata_DATA = \
|
|
||||||
$(testdata_FILES) \
|
|
||||||
$(testvector_FILES)
|
|
||||||
|
|
||||||
# Can't seem to get this to work, despite the fiddling attempts.
|
|
||||||
# https://www.gnu.org/software/automake/manual/html_node/Uniform.html and
|
|
||||||
# https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
|
|
||||||
#nobase_noinst_data_DATA = \
|
|
||||||
# $(testprogs_FILES)
|
|
||||||
|
|
||||||
# Workaround Automake bug. We can't seem to include the TestProgram/ data
|
|
||||||
# in the tarball without installation using their Uniform Naming Scheme
|
|
||||||
# https://www.gnu.org/software/automake/manual/html_node/Uniform.html and
|
|
||||||
# https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
|
|
||||||
dist-hook:
|
|
||||||
chmod -R u+w $(distdir)
|
|
||||||
cp -r TestPrograms/ $(distdir)
|
|
||||||
rm -f $(distdir)/TestPrograms/dump2def.cxx
|
|
||||||
|
|
||||||
## Automake bug workaround. If libcryptopp_la_SOURCES is an empty list, Automake assumes
|
|
||||||
## C source files and drives link through the C compiler. We provide the empty adhoc.cpp
|
|
||||||
## to get things back on course, so adhoc.cpp must always be copied.
|
|
||||||
|
|
||||||
adhoc.cpp:
|
|
||||||
cp adhoc.cpp.proto adhoc.cpp
|
|
||||||
touch adhoc.cpp
|
|
||||||
|
|
||||||
## Remove doc directory if present
|
|
||||||
distclean-local:
|
|
||||||
-rm -rf html-docs doxyfile.stamp
|
|
||||||
|
|
||||||
## Automake does not properly uninstall the library test data and vectors
|
|
||||||
uninstall-hook:
|
|
||||||
-rm -rf ${pkgdatadir}
|
|
||||||
-rm -rf ${pkghtmldir}
|
|
||||||
|
|
||||||
## Doxygen is available but not built by default
|
|
||||||
## TODO: copy docs to ${pkghtmldir} if built
|
|
||||||
if CRYPTOPP_DOXYGEN_AVAILABLE
|
|
||||||
|
|
||||||
## PHONY targets. Automake can only handle one of them...
|
|
||||||
.PHONY: doc docs html htmldoc checkout reset
|
|
||||||
|
|
||||||
doc docs html htmldoc:
|
|
||||||
$(DOXYGEN) Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Restore GNUmakefile
|
|
||||||
checkout:
|
|
||||||
git checkout master -f
|
|
||||||
|
|
||||||
# Restore GNUmakefile
|
|
||||||
reset:
|
|
||||||
git reset --hard HEAD
|
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
|||||||
## libcryptopp.pc.in - Autotools package configuration file for Crypto++.
|
|
||||||
## written and placed in public domain by Jeffrey Walton.
|
|
||||||
## based on Debian package configuration by László Böszörményi.
|
|
||||||
##
|
|
||||||
|
|
||||||
## libdir=@libdir@ is not working as expected for Fedora, Solaris,
|
|
||||||
## and other 64-bit OSes that use library directories like /lib64,
|
|
||||||
## /usr/lib64, /lib/amd64 and friends. Also see:
|
|
||||||
## * https://stackoverflow.com/q/47124066/608639
|
|
||||||
## * https://stackoverflow.com/q/46847939/608639 and
|
|
||||||
## * https://bugzilla.redhat.com/show_bug.cgi?id=1510073.
|
|
||||||
|
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: @PACKAGE_NAME@
|
|
||||||
Description: free C++ class library of cryptographic schemes
|
|
||||||
Authors: originally written by Wei Dai
|
|
||||||
Maintainers: the Crypto++ community
|
|
||||||
URL: @PACKAGE_URL@
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Bug-Report: @PACKAGE_BUGREPORT@
|
|
||||||
Requires:
|
|
||||||
|
|
||||||
## These flags are mostly broken. We cannot record user choices,
|
|
||||||
## and then have user programs use the same flags later.
|
|
||||||
## https://lists.freedesktop.org/archives/pkg-config/2017-November/001087.html
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
Libs: -L${libdir} -lcryptopp
|
|
@ -1,22 +0,0 @@
|
|||||||
# Copyright (C) 2016 Openwrt.org
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI fan control
|
|
||||||
LUCI_DEPENDS:=+coreutils-stat
|
|
||||||
LUCI_PKGARCH:=all
|
|
||||||
PKG_VERSION:=1.0.0-3
|
|
||||||
PKG_RELEASE:=
|
|
||||||
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
|
|
||||||
|
|
||||||
define Package/luci-app-fan/conffiles
|
|
||||||
/etc/config/luci-fan
|
|
||||||
endef
|
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
|
||||||
|
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
--[[
|
|
||||||
LuCI - Lua Configuration Interface
|
|
||||||
Copyright 2023 jjm2473
|
|
||||||
]]--
|
|
||||||
|
|
||||||
module("luci.controller.admin.luci-fan", package.seeall)
|
|
||||||
|
|
||||||
function index()
|
|
||||||
require "luci.sys"
|
|
||||||
local appname = "luci-fan"
|
|
||||||
local defaultpage = nil
|
|
||||||
if luci.sys.call("/usr/libexec/fan-control get >/dev/null 2>&1") == 0 then
|
|
||||||
entry({"admin", "system", appname}, cbi("luci-fan"), _("Fan Control"), 60)
|
|
||||||
else
|
|
||||||
entry({"admin", "system", appname}).dependent = true
|
|
||||||
end
|
|
||||||
entry({"admin", "system", appname, "get_fan_info"}, call("get_fan_info"), nil).leaf = true
|
|
||||||
end
|
|
||||||
|
|
||||||
function get_fan_info(zone, trip)
|
|
||||||
require "luci.util"
|
|
||||||
local words
|
|
||||||
if zone and trip and string.match(zone, "^thermal_zone%d+$") and string.match(trip, "^%d+$") then
|
|
||||||
local fs = require "nixio.fs"
|
|
||||||
words = {
|
|
||||||
luci.util.trim(fs.readfile("/sys/class/thermal/"..zone.."/temp")),
|
|
||||||
luci.util.trim(fs.readfile("/sys/class/thermal/"..zone.."/trip_point_"..trip.."_temp"))
|
|
||||||
}
|
|
||||||
else
|
|
||||||
local sys = require "luci.sys"
|
|
||||||
words = luci.util.split(luci.util.trim(sys.exec("/usr/libexec/fan-control temp 2>/dev/null")), " ")
|
|
||||||
end
|
|
||||||
local zone_temp = tonumber(words[1]) / 1000; -- ˚C
|
|
||||||
local fan_on_temp = tonumber(words[2]) / 1000; -- ˚C
|
|
||||||
luci.http.status(200, "ok")
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json({zone_temp=zone_temp, fan_on_temp=fan_on_temp})
|
|
||||||
end
|
|
@ -1,93 +0,0 @@
|
|||||||
--[[
|
|
||||||
LuCI - Lua Configuration Interface
|
|
||||||
Copyright 2023 jjm2473
|
|
||||||
]]--
|
|
||||||
|
|
||||||
local m, s, o
|
|
||||||
require "luci.util"
|
|
||||||
|
|
||||||
local fs = require "nixio.fs"
|
|
||||||
|
|
||||||
local sys = require "luci.sys"
|
|
||||||
|
|
||||||
local words = luci.util.split(luci.util.trim(sys.exec("/usr/libexec/fan-control get 2>/dev/null")), " ")
|
|
||||||
|
|
||||||
if #words < 3 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
m = Map("luci-fan", translate("Fan Control"), translate("Control fan start and stop temperature. This plugin can only configure the lowest gear, not necessarily applicable to all devices."))
|
|
||||||
|
|
||||||
s = m:section(SimpleSection)
|
|
||||||
s.template = "luci-fan"
|
|
||||||
s.thermal_zone = words[1]
|
|
||||||
s.trip_point = words[2]
|
|
||||||
s.thermal_type = luci.util.trim(fs.readfile("/sys/class/thermal/"..words[1].."/type"))
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "luci-fan", translate("Fan Settings"))
|
|
||||||
s.addremove = false
|
|
||||||
s.anonymous = true
|
|
||||||
|
|
||||||
o = s:option(Flag, "enabled", translate("Enabled"), translate("Whether to apply the settings"))
|
|
||||||
o.default = 0
|
|
||||||
|
|
||||||
local on_temp = s:option(Value, "on_temp", translate("Fan start temperature") .. " (℃)")
|
|
||||||
on_temp.datatype = "and(uinteger,min(5))"
|
|
||||||
on_temp.rmempty = false
|
|
||||||
on_temp.default = math.floor(tonumber(words[3])/1000)
|
|
||||||
if #words > 3 then
|
|
||||||
on_temp.datatype = string.format("and(uinteger,range(5,%u))", math.floor(tonumber(words[4])/1000 - 1))
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(Value, "off_temp", translate("Fan stop temperature") .. " (℃)", translate("Optional, MUST be lower than the fan start temperature. Default fan start temperature minus 5 ℃"))
|
|
||||||
o.datatype = "uinteger"
|
|
||||||
o.rmempty = true
|
|
||||||
function o.parse(self, section, novld)
|
|
||||||
local fvalue = self:formvalue(section)
|
|
||||||
local fexist = ( fvalue and (#fvalue > 0) ) -- not "nil" and "not empty"
|
|
||||||
|
|
||||||
local vvalue, errtxt = self:validate(fvalue)
|
|
||||||
if not vvalue then
|
|
||||||
if novld then -- and "novld" set
|
|
||||||
return -- then exit without raising an error
|
|
||||||
end
|
|
||||||
if fexist then -- and there is a formvalue
|
|
||||||
self:add_error(section, "invalid", errtxt or self.title .. ": invalid")
|
|
||||||
return -- so data are invalid
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local rm_opt = ( self.rmempty or self.optional )
|
|
||||||
local vexist = ( vvalue and (#vvalue > 0) ) and true or false -- not "nil" and "not empty"
|
|
||||||
local eq_def = ( vvalue == self.default ) -- equal_default flag
|
|
||||||
-- (rmempty or optional) and (no data or equal_default)
|
|
||||||
if rm_opt and (not vexist or eq_def) then
|
|
||||||
if self:remove(section) then -- remove data from UCI
|
|
||||||
self.section.changed = true -- and push events
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local cvalue = self:cfgvalue(section)
|
|
||||||
local eq_cfg = ( vvalue == cvalue ) -- update equal_config flag
|
|
||||||
-- not forcewrite and no changes, so nothing to write
|
|
||||||
if not self.forcewrite and eq_cfg then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local onvalue = on_temp:validate(on_temp:formvalue(section))
|
|
||||||
if onvalue and #onvalue > 0 then
|
|
||||||
if tonumber(vvalue) >= tonumber(onvalue) then
|
|
||||||
self:add_error(section, "invalid", translate("Fan stop temperature MUST be lower than fan start temperature"))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- write data to UCI; raise event only on changes
|
|
||||||
if self:write(section, vvalue) and not eq_cfg then
|
|
||||||
self.section.changed = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return m
|
|
@ -1,30 +0,0 @@
|
|||||||
<div class="cbi-section">
|
|
||||||
<div class="cbi-section-node">
|
|
||||||
<h3><%:Status%></h3>
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
<tr class="tr"><td class="td"><%:Thermal zone%></td><td class="td"><%=self.thermal_zone%> (<%:type:%> <%=self.thermal_type%>)</td></tr>
|
|
||||||
<tr class="tr"><td class="td"><%:Trip point%></td><td class="td">trip_point_<%=self.trip_point%></td></tr>
|
|
||||||
<tr class="tr"><td class="td"><%:Fan start temperature%></td><td class="td" id="fan_on_temp"></td></tr>
|
|
||||||
<tr class="tr"><td class="td"><%:Current temperature%></td><td class="td" id="zone_temp"></td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
(function(){
|
|
||||||
var fan_on_temp = document.getElementById('fan_on_temp');
|
|
||||||
var zone_temp = document.getElementById('zone_temp');
|
|
||||||
XHR.poll(3, '<%=url("admin/system/luci-fan/get_fan_info/"..self.thermal_zone.."/"..self.trip_point)%>', null,
|
|
||||||
function(x, st) {
|
|
||||||
if (st) {
|
|
||||||
if (fan_on_temp)
|
|
||||||
fan_on_temp.innerHTML = st.fan_on_temp + ' ℃';
|
|
||||||
if (zone_temp)
|
|
||||||
zone_temp.innerHTML = st.zone_temp + ' ℃';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})()
|
|
||||||
//]]></script>
|
|
@ -1,64 +0,0 @@
|
|||||||
msgid ""
|
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:19
|
|
||||||
msgid ""
|
|
||||||
"Control fan start and stop temperature. This plugin can only configure the "
|
|
||||||
"lowest gear, not necessarily applicable to all devices."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:9
|
|
||||||
msgid "Current temperature"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:31
|
|
||||||
msgid "Enabled"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/controller/admin/luci-fan.lua:13
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:19
|
|
||||||
msgid "Fan Control"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:27
|
|
||||||
msgid "Fan Settings"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:34
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:8
|
|
||||||
msgid "Fan start temperature"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:42
|
|
||||||
msgid "Fan stop temperature"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:80
|
|
||||||
msgid "Fan stop temperature MUST be lower than fan start temperature"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:42
|
|
||||||
msgid ""
|
|
||||||
"Optional, MUST be lower than the fan start temperature. Default fan start "
|
|
||||||
"temperature minus 5 ℃"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:3
|
|
||||||
msgid "Status"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:6
|
|
||||||
msgid "Thermal zone"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:7
|
|
||||||
msgid "Trip point"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:31
|
|
||||||
msgid "Whether to apply the settings"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:6
|
|
||||||
msgid "type:"
|
|
||||||
msgstr ""
|
|
@ -1,68 +0,0 @@
|
|||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Language: zh_Hans\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:19
|
|
||||||
msgid ""
|
|
||||||
"Control fan start and stop temperature. This plugin can only configure the "
|
|
||||||
"lowest gear, not necessarily applicable to all devices."
|
|
||||||
msgstr "控制风扇启停温度。此插件仅配置最低档位触发点,不一定适用于所有设备"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:9
|
|
||||||
msgid "Current temperature"
|
|
||||||
msgstr "当前温度"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:31
|
|
||||||
msgid "Enabled"
|
|
||||||
msgstr "启用"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/controller/admin/luci-fan.lua:13
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:19
|
|
||||||
msgid "Fan Control"
|
|
||||||
msgstr "风扇控制"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:27
|
|
||||||
msgid "Fan Settings"
|
|
||||||
msgstr "风扇设置"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:34
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:8
|
|
||||||
msgid "Fan start temperature"
|
|
||||||
msgstr "风扇启动温度"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:42
|
|
||||||
msgid "Fan stop temperature"
|
|
||||||
msgstr "风扇停止温度"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:80
|
|
||||||
msgid "Fan stop temperature MUST be lower than fan start temperature"
|
|
||||||
msgstr "风扇停止温度必须小于风扇启动温度"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:42
|
|
||||||
msgid ""
|
|
||||||
"Optional, MUST be lower than the fan start temperature. Default fan start "
|
|
||||||
"temperature minus 5 ℃"
|
|
||||||
msgstr "可选,必须小于风扇启动温度。默认风扇启动温度减 5 ℃"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:3
|
|
||||||
msgid "Status"
|
|
||||||
msgstr "状态"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:6
|
|
||||||
msgid "Thermal zone"
|
|
||||||
msgstr "温感区"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:7
|
|
||||||
msgid "Trip point"
|
|
||||||
msgstr "触发点"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/model/cbi/luci-fan.lua:31
|
|
||||||
msgid "Whether to apply the settings"
|
|
||||||
msgstr "是否应用此设置"
|
|
||||||
|
|
||||||
#: /Volumes/data/src/nas-packages-luci/luci/luci-app-fan/luasrc/view/luci-fan.htm:6
|
|
||||||
msgid "type:"
|
|
||||||
msgstr "类型:"
|
|
@ -1,4 +0,0 @@
|
|||||||
config luci-fan
|
|
||||||
option enabled 0
|
|
||||||
# option on_temp 55
|
|
||||||
# option off_temp 50
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
|
||||||
|
|
||||||
START=20
|
|
||||||
|
|
||||||
boot() {
|
|
||||||
/usr/libexec/fan-control init
|
|
||||||
start
|
|
||||||
}
|
|
||||||
|
|
||||||
start_instance() {
|
|
||||||
local enabled
|
|
||||||
config_get_bool enabled $1 enabled 0
|
|
||||||
[[ "$enabled" = 1 ]] || return 0
|
|
||||||
|
|
||||||
config_get on_temp $1 on_temp
|
|
||||||
config_get off_temp $1 off_temp
|
|
||||||
|
|
||||||
[[ -n "$on_temp" ]] && on_temp=${on_temp}000
|
|
||||||
[[ -n "$off_temp" ]] && off_temp=${off_temp}000
|
|
||||||
|
|
||||||
/usr/libexec/fan-control set "$on_temp" $off_temp
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
config_load luci-fan
|
|
||||||
config_foreach start_instance luci-fan
|
|
||||||
return 0
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
/usr/libexec/fan-control init
|
|
||||||
|
|
||||||
uci -q batch <<-EOF >/dev/null
|
|
||||||
delete ucitrack.@luci-fan[-1]
|
|
||||||
add ucitrack luci-fan
|
|
||||||
set ucitrack.@luci-fan[-1].init=luci-fan
|
|
||||||
commit ucitrack
|
|
||||||
EOF
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,145 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# author: jjm2473
|
|
||||||
|
|
||||||
SAVE=/tmp/run/fanTP
|
|
||||||
ACTION=${1}
|
|
||||||
shift
|
|
||||||
|
|
||||||
# print: zone trip_point current_target_temp [max_target_temp]
|
|
||||||
# ex. thermal_zone0 0 50000 60000
|
|
||||||
function getFanTP() {
|
|
||||||
local zone cdev trip temp mintemp mintrip minzone maxtemp
|
|
||||||
[[ -d /sys/class/thermal ]] || return 1
|
|
||||||
cd /sys/class/thermal
|
|
||||||
for zone in thermal_zone* ; do
|
|
||||||
cd "$zone"
|
|
||||||
for cdev in `ls | grep 'cdev[0-9]\+$'`; do
|
|
||||||
[[ -d "$cdev" ]] || continue
|
|
||||||
grep -Fiq fan "$cdev/type" || continue
|
|
||||||
trip=`cat ${cdev}_trip_point`
|
|
||||||
grep -Fwq active trip_point_${trip}_type || continue
|
|
||||||
[[ "`stat -c '%#a' trip_point_${trip}_temp || echo 0444`" = "0644" ]] || continue
|
|
||||||
temp=`cat trip_point_${trip}_temp`
|
|
||||||
if [[ -z "$mintemp" ]] || [[ "$temp" -lt "$mintemp" ]]; then
|
|
||||||
if [[ -n "$mintemp" ]]; then
|
|
||||||
if [[ "$zone" = "$minzone" ]]; then
|
|
||||||
maxtemp=$mintemp
|
|
||||||
else
|
|
||||||
maxtemp=
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
mintemp=$temp
|
|
||||||
mintrip=$trip
|
|
||||||
minzone=$zone
|
|
||||||
elif [[ -z "$maxtemp" ]] || [[ "$temp" -lt "$maxtemp" ]]; then
|
|
||||||
maxtemp=$temp
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
cd /sys/class/thermal
|
|
||||||
done
|
|
||||||
if [[ -n "$mintemp" ]]; then
|
|
||||||
echo "$minzone" "$mintrip" "$mintemp" $maxtemp
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFanTP_C() {
|
|
||||||
if [[ -f "$SAVE" ]]; then
|
|
||||||
if [[ -s "$SAVE" ]]; then
|
|
||||||
cat "$SAVE"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
( getFanTP ) | tee "$SAVE"
|
|
||||||
[[ -s "$SAVE" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFanTP_U() {
|
|
||||||
set $(getFanTP_C)
|
|
||||||
[[ -n "$1" && -n "$2" ]] || return 1
|
|
||||||
local onTemp=`cat "/sys/class/thermal/${1}/trip_point_${2}_temp"`
|
|
||||||
echo "$1" "$2" "$onTemp" $4
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function initFanTP() {
|
|
||||||
[[ -f "$SAVE" ]] || ( getFanTP >"$SAVE" )
|
|
||||||
}
|
|
||||||
|
|
||||||
# param: ON_TEMP [OFF_TEMP]
|
|
||||||
# OFF_TEMP = ON_TEMP - 5000 if not set
|
|
||||||
# ex. 60000 55000
|
|
||||||
function setFanTP() {
|
|
||||||
local ON_TEMP=$1
|
|
||||||
local OFF_TEMP=$2
|
|
||||||
[[ -n "$ON_TEMP" ]] || {
|
|
||||||
echo "ON_TEMP must be present" >&2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
if [[ -z "$OFF_TEMP" ]]; then
|
|
||||||
[[ "$ON_TEMP" -gt 5000 ]] || {
|
|
||||||
echo "ON_TEMP must greater than 5000 when OFF_TEMP not present" >&2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
OFF_TEMP=$(( $ON_TEMP - 5000 ))
|
|
||||||
fi
|
|
||||||
[[ "$ON_TEMP" -gt "$OFF_TEMP" ]] || {
|
|
||||||
echo "ON_TEMP must greater than OFF_TEMP" >&2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
local HYST=$(( $ON_TEMP - $OFF_TEMP ))
|
|
||||||
|
|
||||||
set $(getFanTP_C)
|
|
||||||
[[ -n "$1" && -n "$2" ]] || return 1
|
|
||||||
[[ -d "/sys/class/thermal/${1}" ]] || return 1
|
|
||||||
|
|
||||||
[[ -n "$4" ]] && [[ "$ON_TEMP" -ge "$4" ]] && {
|
|
||||||
ON_TEMP=$(( $4 - 5000 ))
|
|
||||||
echo "WARN: ON_TEMP greater than next TP $4, fixed to $ON_TEMP" >&2
|
|
||||||
}
|
|
||||||
echo "$ON_TEMP" > "/sys/class/thermal/${1}/trip_point_${2}_temp"
|
|
||||||
echo "$HYST" > "/sys/class/thermal/${1}/trip_point_${2}_hyst"
|
|
||||||
}
|
|
||||||
|
|
||||||
# print: current thermal sensor value and fan on temp
|
|
||||||
function getTemp() {
|
|
||||||
set $(getFanTP_C)
|
|
||||||
[[ -n "$1" && -n "$2" ]] || return 1
|
|
||||||
[[ -f "/sys/class/thermal/$1/temp" ]] || return 1
|
|
||||||
local temp=`cat "/sys/class/thermal/$1/temp"`
|
|
||||||
local tpt=`cat "/sys/class/thermal/$1/trip_point_${2}_temp"`
|
|
||||||
echo "$temp $tpt"
|
|
||||||
}
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "usage: $0 sub-command"
|
|
||||||
echo "where sub-command is one of:"
|
|
||||||
echo " get Get Fan setting"
|
|
||||||
echo " set ON_TEMP [OFF_TEMP] Set Fan setting"
|
|
||||||
echo " temp Get current thermal temp and Fan on temp"
|
|
||||||
echo " init init, internal used"
|
|
||||||
}
|
|
||||||
|
|
||||||
case ${ACTION} in
|
|
||||||
"get")
|
|
||||||
getFanTP_U
|
|
||||||
;;
|
|
||||||
"set")
|
|
||||||
setFanTP "$@"
|
|
||||||
;;
|
|
||||||
"temp")
|
|
||||||
getTemp
|
|
||||||
;;
|
|
||||||
"init")
|
|
||||||
initFanTP
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
18
package/lean/luci-app-leigod-acc/Makefile
Normal file
18
package/lean/luci-app-leigod-acc/Makefile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
LUCI_TITLE:=Luci for Leigod Game Accelerater
|
||||||
|
LUCI_PKGARCH:=all
|
||||||
|
LUCI_DEPENDS:=+libpcap +iptables +kmod-ipt-nat +iptables-mod-tproxy +kmod-ipt-tproxy +kmod-tun +kmod-netem +tc-full +kmod-ipt-ipset +ipset +curl +miniupnpd +conntrack +conntrackd +leigod-acc
|
||||||
|
PKG_VERSION:=1
|
||||||
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
||||||
|
|
101
package/lean/luci-app-leigod-acc/luasrc/controller/acc.lua
Normal file
101
package/lean/luci-app-leigod-acc/luasrc/controller/acc.lua
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
module("luci.controller.acc", package.seeall)
|
||||||
|
|
||||||
|
function index()
|
||||||
|
require("luci.i18n")
|
||||||
|
entry({ "admin", "services", "acc" }, alias("admin", "services", "acc", "service"), translate("Leigod Acc"), 50)
|
||||||
|
entry({ "admin", "services", "acc", "service" }, cbi("leigod/service"), translate("Leigod Service"), 30).i18n = "acc"
|
||||||
|
entry({ "admin", "services", "acc", "device" }, cbi("leigod/device"), translate("Leigod Device"), 50).i18n = "acc"
|
||||||
|
entry({ "admin", "services", "acc", "app" }, cbi("leigod/app"), translate("Leigod App"), 60).i18n = "acc"
|
||||||
|
entry({ "admin", "services", "acc", "notice" }, cbi("leigod/notice"), translate("Leigod Notice"), 80).i18n = "acc"
|
||||||
|
entry({ "admin", "services", "acc", "status" }, call("get_acc_status")).leaf = true
|
||||||
|
entry({ "admin", "services", "acc", "start_acc_service" }, call("start_acc_service"))
|
||||||
|
entry({ "admin", "services", "acc", "stop_acc_service" }, call("stop_acc_service"))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get_acc_status get acc status
|
||||||
|
function get_acc_status()
|
||||||
|
-- util module
|
||||||
|
local util = require "luci.util"
|
||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
local translate = luci.i18n.translate
|
||||||
|
-- init result
|
||||||
|
local resp = {}
|
||||||
|
-- init state
|
||||||
|
resp.service = translate("Acc Service Disabled")
|
||||||
|
resp.state = {}
|
||||||
|
-- check if exist
|
||||||
|
local exist = util.exec("ps | grep acc-gw | grep -v grep")
|
||||||
|
-- check if program is running
|
||||||
|
if exist ~= "" then
|
||||||
|
resp.service = translate("Acc Service Enabled")
|
||||||
|
end
|
||||||
|
-- get uci
|
||||||
|
local results = uci:get_all("accelerator")
|
||||||
|
for _, typ in pairs({ "Phone", "PC", "Game", "Unknown" }) do
|
||||||
|
local state = uci:get("accelerator", typ, "state")
|
||||||
|
-- check state
|
||||||
|
local state_text = "None"
|
||||||
|
if state == nil or state == '0' then
|
||||||
|
elseif state == '1' then
|
||||||
|
state_text = translate("Acc Catalog Started")
|
||||||
|
elseif state == '2' then
|
||||||
|
state_text = translate("Acc Catalog Stopped")
|
||||||
|
elseif state == '3' then
|
||||||
|
state_text = translate("Acc Catalog Paused")
|
||||||
|
end
|
||||||
|
-- store text
|
||||||
|
resp.state[translate(typ .. "_Catalog")] = state_text
|
||||||
|
end
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(resp)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- start_acc_service
|
||||||
|
function start_acc_service()
|
||||||
|
-- util module
|
||||||
|
local util = require "luci.util"
|
||||||
|
util.exec("/etc/init.d/acc enable")
|
||||||
|
util.exec("/etc/init.d/acc restart")
|
||||||
|
local resp = {}
|
||||||
|
resp.result = "OK"
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(resp)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- stop_acc_service
|
||||||
|
function stop_acc_service()
|
||||||
|
-- util module
|
||||||
|
local util = require "luci.util"
|
||||||
|
util.exec("/etc/init.d/acc stop")
|
||||||
|
util.exec("/etc/init.d/acc disable")
|
||||||
|
local resp = {}
|
||||||
|
resp.result = "OK"
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(resp)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- schedule_pause
|
||||||
|
function schedule_pause()
|
||||||
|
local util = require "luci.util"
|
||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
local schedule_enabled = uci:get("accelerator", "system", "schedule_enabled") or "0"
|
||||||
|
local pause_time = uci:get("accelerator", "system", "pause_time") or "01:00"
|
||||||
|
local username = uci:get("accelerator", "system", "username") or ""
|
||||||
|
local password = uci:get("accelerator", "system", "password") or ""
|
||||||
|
|
||||||
|
-- Remove existing cron jobs related to leigod_helper.sh
|
||||||
|
util.exec("sed -i '/usr/sbin/leigod/leigod_helper.sh/d' /etc/crontabs/root")
|
||||||
|
|
||||||
|
if schedule_enabled == "1" then
|
||||||
|
-- Set the new cron job
|
||||||
|
local hour, minute = pause_time:match("(%d+):(%d+)")
|
||||||
|
local cron_time = string.format("%d %d * * * USERNAME=%s PASSWORD=%s /usr/sbin/leigod/leigod_helper.sh", tonumber(minute), tonumber(hour), username, password)
|
||||||
|
util.exec(string.format('echo "%s" >> /etc/crontabs/root', cron_time))
|
||||||
|
util.exec("/etc/init.d/cron restart")
|
||||||
|
end
|
||||||
|
|
||||||
|
local resp = {}
|
||||||
|
resp.result = "OK"
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(resp)
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
require("luci.util")
|
||||||
|
|
||||||
|
mp = Map("accelerator")
|
||||||
|
|
||||||
|
mp:section(SimpleSection).template = "leigod/app"
|
||||||
|
|
||||||
|
return mp
|
@ -0,0 +1,157 @@
|
|||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
local util = require "luci.util"
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
local pairs = pairs
|
||||||
|
local io = io
|
||||||
|
|
||||||
|
-- config
|
||||||
|
m = Map("accelerator")
|
||||||
|
m.title = translate("Leigod Device Config")
|
||||||
|
m.description = translate("Control Device Config")
|
||||||
|
|
||||||
|
-- get neigh info
|
||||||
|
neigh = m:section(NamedSection, "base", "system", translate("Neigh Device"))
|
||||||
|
neigh_tab = neigh:option(ListValue, "neigh", translate("acc interface"))
|
||||||
|
local sys_dir = util.exec("ls /sys/class/net")
|
||||||
|
if sys_dir ~= nil then
|
||||||
|
neigh_tab:value("br-lan")
|
||||||
|
for ifc in string.gmatch(sys_dir, "[^\n]+") do
|
||||||
|
neigh_tab:value(ifc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- range all device
|
||||||
|
device = m:section(NamedSection, "device", "hardware", translate("Device Info"))
|
||||||
|
device:tab("none_catalog", translate("None_Catalog"))
|
||||||
|
device:tab("phone_catalog", translate("Phone_Catalog"))
|
||||||
|
device:tab("pc_catalog", translate("PC_Catalog"))
|
||||||
|
device:tab("game_catalog", translate("Game_Catalog"))
|
||||||
|
device:tab("vr_catalog", translate("VR_Catalog"))
|
||||||
|
device:tab("unknown_catalog", translate("Unknown_Catalog"))
|
||||||
|
|
||||||
|
|
||||||
|
local dhcp_map = {}
|
||||||
|
-- check dhcp file
|
||||||
|
if fs.access("/tmp/dhcp.leases") then
|
||||||
|
for line in io.lines("/tmp/dhcp.leases") do
|
||||||
|
-- check if read empty line
|
||||||
|
if line == "" then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
-- split line
|
||||||
|
local valueSl = string.gmatch(line, "[^ ]+")
|
||||||
|
-- read time
|
||||||
|
valueSl()
|
||||||
|
-- read mac
|
||||||
|
local mac = valueSl()
|
||||||
|
-- get ip
|
||||||
|
local ip = valueSl()
|
||||||
|
-- get host name
|
||||||
|
local hostname = valueSl()
|
||||||
|
-- key
|
||||||
|
local key = string.gsub(mac, ":", "")
|
||||||
|
-- store key
|
||||||
|
dhcp_map[key] = {
|
||||||
|
["key"] = key,
|
||||||
|
["mac"] = mac,
|
||||||
|
["ip"] = ip,
|
||||||
|
["name"] = hostname
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ifc = uci:get("accelerator", "base", "neigh")
|
||||||
|
if ifc == nil then
|
||||||
|
ifc = "br-lan"
|
||||||
|
end
|
||||||
|
|
||||||
|
local arp_map = {}
|
||||||
|
-- check if arp exist
|
||||||
|
if fs.access("/proc/net/arp") then
|
||||||
|
-- read all item from arp
|
||||||
|
for line in io.lines("/proc/net/arp") do
|
||||||
|
-- check if line is not exist
|
||||||
|
if line == "" then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
-- split item
|
||||||
|
local valueSl = string.gmatch(line, "[^ ]+")
|
||||||
|
-- get ip
|
||||||
|
local ip = valueSl()
|
||||||
|
-- get type
|
||||||
|
valueSl()
|
||||||
|
-- get flag
|
||||||
|
local flag = valueSl()
|
||||||
|
-- get mac
|
||||||
|
local mac = valueSl()
|
||||||
|
-- get mask
|
||||||
|
valueSl()
|
||||||
|
-- get device
|
||||||
|
local dev = valueSl()
|
||||||
|
-- get key
|
||||||
|
local key = string.gsub(mac, ":", "")
|
||||||
|
-- check if device and flag state
|
||||||
|
if dev == ifc and flag == "0x2" then
|
||||||
|
-- get current name
|
||||||
|
local name = mac
|
||||||
|
if dhcp_map[key] ~= nil and dhcp_map[key] ~= "*" then
|
||||||
|
name = dhcp_map[key].name
|
||||||
|
end
|
||||||
|
arp_map[key] = {
|
||||||
|
["key"] = key,
|
||||||
|
["mac"] = mac,
|
||||||
|
["ip"] = ip,
|
||||||
|
["name"] = name
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get device config
|
||||||
|
for key, item in pairs(arp_map) do
|
||||||
|
local typ = uci:get("accelerator", "device", key)
|
||||||
|
-- get device catalog from type
|
||||||
|
local catalog = "none_catalog"
|
||||||
|
-- default to unknown device
|
||||||
|
if typ == nil then
|
||||||
|
typ = 9
|
||||||
|
else
|
||||||
|
typ = tonumber(typ)
|
||||||
|
end
|
||||||
|
|
||||||
|
if typ == nil then
|
||||||
|
catalog = "unknown_catalog"
|
||||||
|
elseif typ >= 1 and typ <= 3 then
|
||||||
|
catalog = "game_catalog"
|
||||||
|
elseif typ >= 4 and typ <= 6 then
|
||||||
|
catalog = "pc_catalog"
|
||||||
|
elseif typ >= 7 and typ <= 8 then
|
||||||
|
catalog = "phone_catalog"
|
||||||
|
elseif typ >= 20 and typ <= 21 then
|
||||||
|
catalog = "vr_catalog"
|
||||||
|
else
|
||||||
|
catalog = "unknown_catalog"
|
||||||
|
end
|
||||||
|
-- device type
|
||||||
|
device_typ = device:taboption(catalog, ListValue, key, item.name)
|
||||||
|
device_typ:value("0", "None")
|
||||||
|
device_typ:value("1", "XBox")
|
||||||
|
device_typ:value("2", "Switch")
|
||||||
|
device_typ:value("3", "Play Station")
|
||||||
|
device_typ:value("4", "Steam Deck")
|
||||||
|
device_typ:value("5", "Windows")
|
||||||
|
device_typ:value("6", "MacBook")
|
||||||
|
device_typ:value("7", "Android")
|
||||||
|
device_typ:value("8", "iPhone")
|
||||||
|
device_typ:value("20", "Oculus")
|
||||||
|
device_typ:value("21", "HTC Vive")
|
||||||
|
device_typ:value("22", "Pico")
|
||||||
|
device_typ:value("9", "Unknown")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- set
|
||||||
|
device.write = function()
|
||||||
|
util.exec("/etc/init.d/acc restart")
|
||||||
|
end
|
||||||
|
|
||||||
|
return m
|
@ -0,0 +1,10 @@
|
|||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
|
||||||
|
-- config
|
||||||
|
m = Map("accelerator")
|
||||||
|
m.title = translate("Leigod Notice")
|
||||||
|
m.description = translate("Leigod Accelerator Usage")
|
||||||
|
|
||||||
|
m:section(SimpleSection).template = "leigod/notice"
|
||||||
|
|
||||||
|
return m
|
@ -0,0 +1,46 @@
|
|||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
|
||||||
|
-- config
|
||||||
|
m = Map("accelerator")
|
||||||
|
m.title = translate("Leigod Accelerator Config")
|
||||||
|
m.description = translate("Control Accelerator Config")
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "system")
|
||||||
|
s.addremove = false
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
enable = s:option(Flag,"enabled" ,translate("Enable"))
|
||||||
|
enable.rmempty = false
|
||||||
|
enable.default = 0
|
||||||
|
|
||||||
|
tun = s:option(Flag,"tun" ,translate("Tunnel Mode"))
|
||||||
|
tun.rmempty = false
|
||||||
|
tun.default = 0
|
||||||
|
tun.description = translate("Turning Leigod into Tunnel mode can make some proxy plugins available")
|
||||||
|
|
||||||
|
schedule_enabled = s:option(Flag, "schedule_enabled", translate("Scheduled Pause"))
|
||||||
|
schedule_enabled.rmempty = false
|
||||||
|
schedule_enabled.default = 0
|
||||||
|
schedule_enabled.description = translate("夜猫子选项")
|
||||||
|
|
||||||
|
pause_time = s:option(ListValue, "pause_time", translate("Pause Time"))
|
||||||
|
pause_time:depends("schedule_enabled", 1)
|
||||||
|
for i = 0, 23 do
|
||||||
|
pause_time:value(string.format("%02d:00", i), string.format("%02d:00", i))
|
||||||
|
end
|
||||||
|
pause_time.rmempty = false
|
||||||
|
pause_time.description = translate("选择好时间雷神加速器会定时暂停,请避开你的游戏时间以免影响游戏体验")
|
||||||
|
|
||||||
|
|
||||||
|
username = s:option(Value, "username", translate("Phone Number"))
|
||||||
|
username:depends("schedule_enabled", 1)
|
||||||
|
username.rmempty = false
|
||||||
|
|
||||||
|
password = s:option(Value, "password", translate("Leigod Password"))
|
||||||
|
password:depends("schedule_enabled", 1)
|
||||||
|
password.password = true
|
||||||
|
password.rmempty = false
|
||||||
|
|
||||||
|
m:section(SimpleSection).template = "leigod/service"
|
||||||
|
|
||||||
|
return m
|
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="leigod_qcode">
|
||||||
|
<img src="/leigodapp.png" height="300" /><img src="/leigodbind.png" height="300" />
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
@ -0,0 +1,74 @@
|
|||||||
|
<fieldset>
|
||||||
|
<legend><%:Declare%></legend>
|
||||||
|
此插件为 LEDE/QWRT 官方合作版插件, 需要配合雷神手机APP使用
|
||||||
|
</p>
|
||||||
|
<legend><%:Upgrade Info%></legend>
|
||||||
|
<p>
|
||||||
|
2024-8-1 <br>
|
||||||
|
支持LEDE/QWRT性能优化 <br>
|
||||||
|
2024-7-25 <br>
|
||||||
|
支持非桥接模式下的旁路由 <br>
|
||||||
|
2024-6-5 <br>
|
||||||
|
扩充ipset容量, 以支持大容量代理ip库 <br>
|
||||||
|
2024-1-22 <br>
|
||||||
|
新增自动选择低延迟线路 <br>
|
||||||
|
新增下载不限速(switch除外) <br>
|
||||||
|
设备名为*时, 显示mac地址 <br>
|
||||||
|
<hr/>
|
||||||
|
2023-11-28 <br>
|
||||||
|
新增对mips设备的支持 <br>
|
||||||
|
新增对旁路由的支持 <br>
|
||||||
|
解决翻译异常的问题 <br>
|
||||||
|
设备管理页面可以显示未识别设备 <br>
|
||||||
|
</p>
|
||||||
|
<legend><%:Install Dependence%></legend>
|
||||||
|
<p>
|
||||||
|
插件运行需要借助一些依赖才能运行, 一般第三方固件默认已经集成了大部分的依赖, <br>
|
||||||
|
如果使用的是openwrt官方的固件, 则需要确保依赖安装好了, 以下列出依赖包和注意事项 <br>
|
||||||
|
libpcap <br>
|
||||||
|
iptables <br>
|
||||||
|
kmod-ipt-nat <br>
|
||||||
|
iptables-mod-tproxy <br>
|
||||||
|
kmod-ipt-tproxy <br>
|
||||||
|
kmod-netem(非必须, 针对于一些icmp测速的游戏使用, 只影响界面显示, 实际游戏效果不影响) <br>
|
||||||
|
tc-full(非必须, 同kmod-netem) <br>
|
||||||
|
kmod-ipt-ipset <br>
|
||||||
|
ipset <br>
|
||||||
|
curl(谨慎更新, 某些三方固件升级curl, 会导致curl出现问题) <br>
|
||||||
|
</p>
|
||||||
|
<legend><%:Bridge Mode%></legend>
|
||||||
|
<p>
|
||||||
|
加速插件无法探知当前插件应该使用什么模式, <br>
|
||||||
|
当前默认使用网桥作为流量转发的设备, <br>
|
||||||
|
如果使用旁路由模式或者docker时, 此时默认设备不是网桥, <br>
|
||||||
|
此时需要手动调整接口, <br>
|
||||||
|
改变接口的地址在 设备管理->路由设备, 选择对应的设备 <br>
|
||||||
|
</p>
|
||||||
|
<legend><%:Acc Mode%></legend>
|
||||||
|
<p>
|
||||||
|
当前雷神路由器支持两种加速模式, tproxy 和 tun <br>
|
||||||
|
当前默认采用的是tproxy模式, 原因在于tproxy有更好的性能<br>
|
||||||
|
tun模式暂时屏蔽, 后续luci会完善一键切换模式
|
||||||
|
</p>
|
||||||
|
<legend><%:Acc Usage%></legend>
|
||||||
|
<p>
|
||||||
|
当前雷神加速插件是根据设备类型进行加速的, 也就是说, 如果加速了相应的类型后, 理论上只要连接该路由器的设备都将获得加速效果<br>
|
||||||
|
当前支持的设备类型有以下几种: <br>
|
||||||
|
手机: Android iPhone <br>
|
||||||
|
电脑: Windows MacOS SteamDeck <br>
|
||||||
|
主机: XBox Switch PlayStation <br>
|
||||||
|
未识别: Others <br>
|
||||||
|
可以在设备管理中, 插件自己的设备是否被成功识别成对应的设备, 如果不是, 可以选择对应的设备, 这样设备就能成功加速了 <br>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
一些特殊的说明: <br>
|
||||||
|
关于ios设备, 最好是在安装插件之前, 先忘记网络, 等安装完插件后, 再重新连接网络 <br>
|
||||||
|
关于android设备, 需要关闭dhcpv6后, 手机重连网络, 以下给出一个 /etc/config/dhcp 的配置 <br>
|
||||||
|
config dhcp 'lan' <br>
|
||||||
|
... 此处是一些其他配置 <br>
|
||||||
|
ra 'disable' <br>
|
||||||
|
dhcpv6 'disable' <br>
|
||||||
|
list ra_flags 'none' <br>
|
||||||
|
... 此处是一些其他配置 <br>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
@ -0,0 +1,61 @@
|
|||||||
|
<!-- acc service state
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<table class="cbi-section-table" id="acc_service_state_table">
|
||||||
|
<tr class="cbi-section-table-title">
|
||||||
|
<th class="cbi-section-table-cell"><%:Acc_Service_Name%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:Acc_Service_Status%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:Acc_Service_Operate%></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%:Acc_Service%></td>
|
||||||
|
<td id="acc_service_state_cell"><%:Acc_Service_Status%></td>
|
||||||
|
<td id="acc_service_state_button"><%:Acc_Service_Operate%></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset> -->
|
||||||
|
|
||||||
|
<!-- acc catalog state -->
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<legend><%:Acc Catalog State%></legend>
|
||||||
|
<table class="cbi-section-table" id="acc_catalog_state_table">
|
||||||
|
<tr class="cbi-section-table-title">
|
||||||
|
<th class="cbi-section-table-cell"><%:Acc_Catalog%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:Acc_Catalog_Status%></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
// start acc service
|
||||||
|
function start_acc_service() {
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "acc", "start_acc_service")%>', null, function(x) {});
|
||||||
|
}
|
||||||
|
// start acc service
|
||||||
|
function stop_acc_service() {
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "acc", "stop_acc_service")%>', null, function(x) {});
|
||||||
|
}
|
||||||
|
|
||||||
|
XHR.poll(5, '<%=url('admin/services/acc/status')%>', null, function(x, st) {
|
||||||
|
var service_cell = document.getElementById("acc_service_state_cell");
|
||||||
|
var button_cell = document.getElementById("acc_service_state_button");
|
||||||
|
if (st && service_cell && button_cell) {
|
||||||
|
service_cell.innerHTML = st["service"];
|
||||||
|
if (st["service"] == "Acc Service Enabled" || st["service"] == "已启动" || st["service"] == "加速服务已启动")
|
||||||
|
button_cell.innerHTML = '<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Stop Acc Service%>" onclick="return stop_acc_service()"/>';
|
||||||
|
else
|
||||||
|
button_cell.innerHTML = '<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Start Acc Service%>" onclick="return start_acc_service()"/>';
|
||||||
|
}
|
||||||
|
var catalog_table = document.getElementById("acc_catalog_state_table");
|
||||||
|
if (st && catalog_table) {
|
||||||
|
while(catalog_table.rows.length > 1)
|
||||||
|
catalog_table.deleteRow(1);
|
||||||
|
var status_map = st["state"];
|
||||||
|
for (var typ in status_map) {
|
||||||
|
var tr = catalog_table.insertRow(-1);
|
||||||
|
tr.insertCell(-1).innerHTML = typ;
|
||||||
|
tr.insertCell(-1).innerHTML = status_map[typ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//]]></script>
|
126
package/lean/luci-app-leigod-acc/po/zh-cn/leigo-acc.po
Normal file
126
package/lean/luci-app-leigod-acc/po/zh-cn/leigo-acc.po
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
|
||||||
|
msgid "Leigod Acc"
|
||||||
|
msgstr "雷神加速器"
|
||||||
|
|
||||||
|
msgid "Leigod Service"
|
||||||
|
msgstr "服务控制"
|
||||||
|
|
||||||
|
msgid "Leigod Device"
|
||||||
|
msgstr "设备管理"
|
||||||
|
|
||||||
|
msgid "Leigod App"
|
||||||
|
msgstr "雷神移动端APP"
|
||||||
|
|
||||||
|
msgid "Leigod Notice"
|
||||||
|
msgstr "加速公告"
|
||||||
|
|
||||||
|
msgid "Leigod Accelerator Config"
|
||||||
|
msgstr "雷神加速器 - 专线加速游戏,按分钟计费可暂停,玩多久算多久,时长永久有效"
|
||||||
|
|
||||||
|
msgid "Control Accelerator Config"
|
||||||
|
msgstr "加速时长6端通用 (Windows端 | Mac端 | NN | 手机端 | 主机端 | 路由器)"
|
||||||
|
|
||||||
|
msgid "Acc_Service_Name"
|
||||||
|
msgstr "服务名称"
|
||||||
|
|
||||||
|
msgid "Acc_Service_Status"
|
||||||
|
msgstr "启动状态"
|
||||||
|
|
||||||
|
msgid "Acc_Service_Operate"
|
||||||
|
msgstr "加速设置"
|
||||||
|
|
||||||
|
msgid "Acc Catalog State"
|
||||||
|
msgstr "加速状态"
|
||||||
|
|
||||||
|
msgid "Acc_Catalog"
|
||||||
|
msgstr "加速设备"
|
||||||
|
|
||||||
|
msgid "Acc_Catalog_Status"
|
||||||
|
msgstr "加速状态"
|
||||||
|
|
||||||
|
msgid "Declare"
|
||||||
|
msgstr "说明"
|
||||||
|
|
||||||
|
msgid "Upgrade Info"
|
||||||
|
msgstr "更新内容"
|
||||||
|
|
||||||
|
msgid "Install Dependence"
|
||||||
|
msgstr "安装依赖"
|
||||||
|
|
||||||
|
msgid "Bridge Mode"
|
||||||
|
msgstr "旁路由模式"
|
||||||
|
|
||||||
|
msgid "Acc Mode"
|
||||||
|
msgstr "加速模式"
|
||||||
|
|
||||||
|
msgid "Acc Usage"
|
||||||
|
msgstr "使用说明"
|
||||||
|
|
||||||
|
msgid "Leigod Accelerator Usage"
|
||||||
|
msgstr "雷神加速插件使用"
|
||||||
|
|
||||||
|
msgid "Leigod Device Config"
|
||||||
|
msgstr "设备管理配置"
|
||||||
|
|
||||||
|
msgid "Control Device Config"
|
||||||
|
msgstr "控制和改变设备类型"
|
||||||
|
|
||||||
|
msgid "Neigh Device"
|
||||||
|
msgstr "路由设置"
|
||||||
|
|
||||||
|
msgid "acc interface"
|
||||||
|
msgstr "代理接口"
|
||||||
|
|
||||||
|
msgid "Device Info"
|
||||||
|
msgstr "设备信息"
|
||||||
|
|
||||||
|
msgid "None_Catalog"
|
||||||
|
msgstr "未分类设备"
|
||||||
|
|
||||||
|
msgid "Phone_Catalog"
|
||||||
|
msgstr "手机设备"
|
||||||
|
|
||||||
|
msgid "None_Catalog"
|
||||||
|
msgstr "未分类设备"
|
||||||
|
|
||||||
|
msgid "Tunnel Mode"
|
||||||
|
msgstr "TUN 模式"
|
||||||
|
|
||||||
|
msgid "PC_Catalog"
|
||||||
|
msgstr "PC 设备"
|
||||||
|
|
||||||
|
msgid "Game_Catalog"
|
||||||
|
msgstr "游戏机"
|
||||||
|
|
||||||
|
msgid "VR_Catalog"
|
||||||
|
msgstr "VR 设备"
|
||||||
|
|
||||||
|
msgid "Unknown_Catalog"
|
||||||
|
msgstr "未识别设备"
|
||||||
|
|
||||||
|
msgid "acc_service"
|
||||||
|
msgstr "雷神加速器服务"
|
||||||
|
|
||||||
|
msgid "Acc_Service"
|
||||||
|
msgstr "雷神加速器服务"
|
||||||
|
|
||||||
|
msgid "Stop Acc Service"
|
||||||
|
msgstr "停止加速服务"
|
||||||
|
|
||||||
|
msgid "Start Acc Service"
|
||||||
|
msgstr "启动加速服务"
|
||||||
|
|
||||||
|
msgid "Acc Service Disabled"
|
||||||
|
msgstr "加速服务已被禁用"
|
||||||
|
|
||||||
|
msgid "Acc Service Enabled"
|
||||||
|
msgstr "已启动"
|
||||||
|
|
||||||
|
msgid "Acc Catalog Started"
|
||||||
|
msgstr "该设备类别加速已启用"
|
||||||
|
|
||||||
|
msgid "Acc Catalog Stopped"
|
||||||
|
msgstr "该设备类别加速已停止"
|
||||||
|
|
||||||
|
msgid "Acc Catalog Paused"
|
||||||
|
msgstr "该设备类别加速已暂停"
|
24
package/lean/luci-app-leigod-acc/root/etc/config/accelerator
Normal file
24
package/lean/luci-app-leigod-acc/root/etc/config/accelerator
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
config system 'base'
|
||||||
|
option url 'https://opapi.nn.com/speed/router/plug/check'
|
||||||
|
option heart 'https://opapi.nn.com/speed/router/heartbeat'
|
||||||
|
option base_url 'https://opapi.nn.com/speed'
|
||||||
|
option enabled '0'
|
||||||
|
option tun '0'
|
||||||
|
option schedule_enabled '0'
|
||||||
|
option pause_time '01:00'
|
||||||
|
option username ''
|
||||||
|
option password ''
|
||||||
|
|
||||||
|
config bind 'bind'
|
||||||
|
|
||||||
|
config hardware 'device'
|
||||||
|
|
||||||
|
config acceleration 'Phone'
|
||||||
|
|
||||||
|
config acceleration 'PC'
|
||||||
|
|
||||||
|
config acceleration 'Game'
|
||||||
|
|
||||||
|
config acceleration 'Unknown'
|
||||||
|
|
166
package/lean/luci-app-leigod-acc/root/etc/init.d/acc
Executable file
166
package/lean/luci-app-leigod-acc/root/etc/init.d/acc
Executable file
@ -0,0 +1,166 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
# start prio
|
||||||
|
START=50
|
||||||
|
# use proc to start service
|
||||||
|
USE_PROCD=1
|
||||||
|
# package name
|
||||||
|
PACKAGE_NAME="acc.ipk"
|
||||||
|
# binary dir
|
||||||
|
sbin_dir="/usr/sbin/leigod"
|
||||||
|
# binary name
|
||||||
|
binary_prefix="acc-gw.linux"
|
||||||
|
|
||||||
|
|
||||||
|
# download acceleration binary
|
||||||
|
download_acc_binary() {
|
||||||
|
echo "begin to download file... ..."
|
||||||
|
# create download
|
||||||
|
local url="http://119.3.40.126/${PACKAGE_NAME}"
|
||||||
|
echo "download path: ${url}"
|
||||||
|
local path="/tmp/${PACKAGE_NAME}"
|
||||||
|
local code=$(curl --connect-timeout 2 -L -s -k -o "${path}" -w "%{http_code}" "${url}")
|
||||||
|
for i in $(seq 1 2)
|
||||||
|
do
|
||||||
|
if [ "$?" != "0" -o "${code}" != "200" -o ! -f "${path}" ]; then
|
||||||
|
echo "download failed: ${code}"
|
||||||
|
rm -f ${path}
|
||||||
|
sleep 5
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "download success"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "download file success... ..."
|
||||||
|
}
|
||||||
|
|
||||||
|
# mkdir acc dir
|
||||||
|
mk_acc_dir() {
|
||||||
|
echo "begin to mkdir... ..."
|
||||||
|
# should make sure dir exist
|
||||||
|
local cmd="mkdir -p ${BINARY_DIR}"
|
||||||
|
echo "exec mkdir dir: ${cmd}"
|
||||||
|
local code=`$cmd`
|
||||||
|
echo "mkdir success... ..."
|
||||||
|
}
|
||||||
|
|
||||||
|
# decompress file
|
||||||
|
decompress_file() {
|
||||||
|
echo "begin to decompress file... ..."
|
||||||
|
# compress file path
|
||||||
|
local path="/tmp/${PACKAGE_NAME}"
|
||||||
|
# decompress command
|
||||||
|
local cmd="tar -zxvf ${path} -C ${BINARY_DIR}"
|
||||||
|
local code=`${cmd}`
|
||||||
|
echo "decompress file success... ..."
|
||||||
|
}
|
||||||
|
|
||||||
|
# install ipk
|
||||||
|
install_package() {
|
||||||
|
echo "begin to overwrite package"
|
||||||
|
# local cmd = "opkg install /tmp/${PACKAGE_NAME} --force-overwrite"
|
||||||
|
# `$cmd`
|
||||||
|
echo "overwrite finish, begin to start"
|
||||||
|
}
|
||||||
|
|
||||||
|
# main
|
||||||
|
prepare_env() {
|
||||||
|
# mkdir
|
||||||
|
mk_acc_dir
|
||||||
|
# download file
|
||||||
|
download_acc_binary
|
||||||
|
# decompress file
|
||||||
|
install_package
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
prepare_env
|
||||||
|
}
|
||||||
|
|
||||||
|
# get_device_arch,
|
||||||
|
# current support arch: arm64 arm x86_64 mips
|
||||||
|
get_device_arch() {
|
||||||
|
arch=$(uname -m)
|
||||||
|
if [ $? != "0" ]; then
|
||||||
|
echo "arch cant be get"
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
# fix arch
|
||||||
|
if [ ${arch} == "x86_64" ]; then
|
||||||
|
echo "match x86_64 -> amd64"
|
||||||
|
arch="amd64"
|
||||||
|
elif [ ${arch} == "aarch64" ]; then
|
||||||
|
echo "match aarch64 -> arm64"
|
||||||
|
arch="arm64"
|
||||||
|
elif [ ${arch} == "mips" ]; then
|
||||||
|
echo "match mips -> mipsle"
|
||||||
|
arch="mipsle"
|
||||||
|
elif [ ${arch} == "armv7l" ]; then
|
||||||
|
echo "match armv7l -> arm"
|
||||||
|
arch="arm"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# get_xiaomi_name check if is xiaomi
|
||||||
|
get_xiaomi_name() {
|
||||||
|
local name=$(uci get misc.hardware.displayName)
|
||||||
|
if [[ $? == "0" && ${name} != "" ]]; then
|
||||||
|
echo "router is xiaomi series, name: ${name}"
|
||||||
|
sbin_dir="/userdisk/appdata/leigod"
|
||||||
|
init_dir="/userdisk/appdata/leigod"
|
||||||
|
args="--mode tun"
|
||||||
|
is_xiaomi=true
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local name=$(uci get misc.hardware.model)
|
||||||
|
if [[ $? == "0" && ${name} != "" ]]; then
|
||||||
|
echo "router is xiaomi series, name: ${name}"
|
||||||
|
sbin_dir="/userdisk/appdata/leigod"
|
||||||
|
init_dir="/userdisk/appdata/leigod"
|
||||||
|
args="--mode tun"
|
||||||
|
is_xiaomi=true
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "router is not xiaomi, use general openwrt"
|
||||||
|
sbin_dir="/usr/sbin/leigod"
|
||||||
|
init_dir="/etc/init.d"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# run service as daemon
|
||||||
|
start_service_daemon() {
|
||||||
|
# open once instance
|
||||||
|
procd_open_instance
|
||||||
|
# run binary
|
||||||
|
local cmd="${sbin_dir}/${binary_prefix}.${arch} ${args}"
|
||||||
|
echo "start service: ${cmd}"
|
||||||
|
procd_set_param command ${cmd}
|
||||||
|
# auto start when failed
|
||||||
|
procd_set_param respawn
|
||||||
|
# close instance
|
||||||
|
procd_close_instance
|
||||||
|
# start check update
|
||||||
|
# update_plugin &
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# proc start service
|
||||||
|
start_service() {
|
||||||
|
|
||||||
|
config_load "accelerator"
|
||||||
|
|
||||||
|
local enabled
|
||||||
|
config_get_bool enabled base enabled 0
|
||||||
|
|
||||||
|
local tun
|
||||||
|
config_get_bool tun base tun 0
|
||||||
|
|
||||||
|
[ "${enabled}" -gt 0 ] || return
|
||||||
|
[ "${tun}" -eq 1 ] && args="--mode tun"
|
||||||
|
|
||||||
|
get_device_arch
|
||||||
|
start_service_daemon
|
||||||
|
}
|
||||||
|
|
29
package/lean/luci-app-leigod-acc/root/etc/uci-defaults/99-accelerator-config
Executable file
29
package/lean/luci-app-leigod-acc/root/etc/uci-defaults/99-accelerator-config
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# check if file exist
|
||||||
|
if [ ! -f /etc/config/accelerator ]; then
|
||||||
|
echo "file not exist, should create..."
|
||||||
|
touch /etc/config/accelerator
|
||||||
|
uci set accelerator.base=system
|
||||||
|
uci set accelerator.device=hardware
|
||||||
|
uci set accelerator.Phone=acceleration
|
||||||
|
uci set accelerator.PC=acceleration
|
||||||
|
uci set accelerator.Game=acceleration
|
||||||
|
uci set accelerator.Unknown=acceleration
|
||||||
|
uci commit accelerator
|
||||||
|
fi
|
||||||
|
|
||||||
|
uci set accelerator.base.url='https://opapi.nn.com/speed/router/plug/check'
|
||||||
|
uci set accelerator.base.heart='https://opapi.nn.com/speed/router/heartbeat'
|
||||||
|
uci set accelerator.base.base_url='https://opapi.nn.com/speed'
|
||||||
|
uci commit accelerator
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
delete ucitrack.@accelerator[-1]
|
||||||
|
add ucitrack accelerator
|
||||||
|
set ucitrack.@accelerator[-1].init=acc
|
||||||
|
commit ucitrack
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
exit 0
|
BIN
package/lean/luci-app-leigod-acc/root/www/leigodapp.png
Normal file
BIN
package/lean/luci-app-leigod-acc/root/www/leigodapp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
package/lean/luci-app-leigod-acc/root/www/leigodbind.png
Normal file
BIN
package/lean/luci-app-leigod-acc/root/www/leigodbind.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
@ -17,7 +17,7 @@ KERNELNAME:=bzImage
|
|||||||
|
|
||||||
include $(INCLUDE_DIR)/target.mk
|
include $(INCLUDE_DIR)/target.mk
|
||||||
|
|
||||||
DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs kmod-button-hotplug kmod-usb-hid kmod-mmc kmod-sdhci kmod-fs-f2fs intel-microcode cfdisk usbutils pciutils \
|
DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs kmod-button-hotplug kmod-usb-hid kmod-mmc kmod-sdhci kmod-fs-f2fs amd64-microcode intel-microcode cfdisk usbutils pciutils \
|
||||||
kmod-alx kmod-e1000e kmod-igb kmod-igc kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-via-velocity kmod-vmxnet3 kmod-i40e kmod-i40evf \
|
kmod-alx kmod-e1000e kmod-igb kmod-igc kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-via-velocity kmod-vmxnet3 kmod-i40e kmod-i40evf \
|
||||||
kmod-sound-hda-core kmod-sound-hda-codec-realtek kmod-sound-hda-codec-via kmod-sound-via82xx kmod-sound-hda-intel kmod-sound-hda-codec-hdmi kmod-sound-i8x0 \
|
kmod-sound-hda-core kmod-sound-hda-codec-realtek kmod-sound-hda-codec-via kmod-sound-via82xx kmod-sound-hda-intel kmod-sound-hda-codec-hdmi kmod-sound-i8x0 \
|
||||||
kmod-usb-net kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-net-aqc111 kmod-mlx4-core kmod-mlx5-core kmod-drm-i915 kmod-drm-amdgpu kmod-usb-audio \
|
kmod-usb-net kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-net-aqc111 kmod-mlx4-core kmod-mlx5-core kmod-drm-i915 kmod-drm-amdgpu kmod-usb-audio \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user