mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 11:17:34 +08:00
update 2023-10-17 23:36:10
This commit is contained in:
parent
2d1411edbe
commit
1d3811d594
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UA2F
|
||||
PKG_VERSION:=4.3.3
|
||||
PKG_VERSION:=4.3.4
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-only
|
||||
|
@ -15,7 +15,7 @@ FW_DIR="/var/etc"
|
||||
FW_CONF="$FW_DIR/ua2f.include"
|
||||
|
||||
HAS_IPT6="$(command -v ip6tables)"
|
||||
FW4="$(command -v fw4)"
|
||||
HAS_NFT="$(command -v nft)"
|
||||
|
||||
if type extra_command >"/dev/null" 2>&1; then
|
||||
extra_command "setup_firewall"
|
||||
@ -35,7 +35,7 @@ setup_firewall() {
|
||||
config_get_bool handle_intranet "firewall" "handle_intranet" "0"
|
||||
config_get_bool handle_mmtls "firewall" "handle_mmtls" "0"
|
||||
|
||||
if [ -n "$FW4" ]; then
|
||||
if [ -n "$HAS_NFT" ]; then
|
||||
nft -f- <<-EOF
|
||||
table inet ua2f {
|
||||
set localaddr_v4 {
|
||||
@ -66,8 +66,6 @@ setup_firewall() {
|
||||
chain prerouting {
|
||||
type filter hook prerouting priority mangle -5; policy accept;
|
||||
|
||||
meta l4proto != tcp counter return comment "!ua2f: not tcp";
|
||||
|
||||
$([ "$handle_intranet" -ne "1" ] || echo 'ip daddr @localaddr_v4 counter return;')
|
||||
$([ "$handle_intranet" -ne "1" ] || echo 'ip6 daddr @localaddr_v6 counter return;')
|
||||
|
||||
@ -75,7 +73,7 @@ setup_firewall() {
|
||||
$([ "$handle_tls" -eq "1" ] || echo 'tcp dport 443 counter return comment "!ua2f: bypass HTTPS";')
|
||||
tcp dport 80 counter ct mark set 44;
|
||||
ct mark 43 counter return comment "!ua2f: bypass non-http stream";
|
||||
ct direction original counter queue num 10010 bypass;
|
||||
meta l4proto tcp ct direction original counter queue num 10010 bypass;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
@ -149,7 +147,7 @@ start_service() {
|
||||
config_get_bool handle_fw "firewall" "handle_fw" "0"
|
||||
if [ "$handle_fw" -eq "1" ]; then
|
||||
setup_firewall
|
||||
[ -n "$FW4" ] || {
|
||||
[ -n "$HAS_NFT" ] || {
|
||||
mkdir -p "$FW_DIR"
|
||||
echo -e "/etc/init.d/$NAME setup_firewall" > "$FW_CONF"
|
||||
}
|
||||
@ -163,7 +161,7 @@ start_service() {
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
if [ -n "$FW4" ]; then
|
||||
if [ -n "$HAS_NFT" ]; then
|
||||
nft flush table inet ua2f
|
||||
nft delete table inet ua2f
|
||||
else
|
||||
|
@ -16,7 +16,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-amlogic
|
||||
PKG_VERSION:=3.1.207
|
||||
PKG_VERSION:=3.1.208
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 License
|
||||
|
@ -20,15 +20,9 @@ AMLOGIC_SOC_FILE="/etc/flippy-openwrt-release"
|
||||
START_LOG="${TMP_CHECK_DIR}/amlogic_check_firmware.log"
|
||||
RUNNING_LOG="${TMP_CHECK_DIR}/amlogic_running_script.log"
|
||||
LOG_FILE="${TMP_CHECK_DIR}/amlogic.log"
|
||||
all_releases_list="${TMP_CHECK_DIR}/josn_api_releases"
|
||||
support_platform=("allwinner" "rockchip" "amlogic" "qemu-aarch64")
|
||||
LOGTIME="$(date "+%Y-%m-%d %H:%M:%S")"
|
||||
[[ -d ${TMP_CHECK_DIR} ]] || mkdir -p ${TMP_CHECK_DIR}
|
||||
# Set github API default value
|
||||
github_page="1"
|
||||
github_per_page="100"
|
||||
|
||||
rm -f ${all_releases_list}
|
||||
|
||||
# Clean the running log
|
||||
clean_running() {
|
||||
@ -46,8 +40,8 @@ tolog() {
|
||||
this_running_log="3@OpenWrt update in progress, try again later!"
|
||||
running_script="$(cat ${RUNNING_LOG} 2>/dev/null | xargs)"
|
||||
if [[ -n "${running_script}" ]]; then
|
||||
run_num=$(echo "${running_script}" | awk -F "@" '{print $1}')
|
||||
run_log=$(echo "${running_script}" | awk -F "@" '{print $2}')
|
||||
run_num="$(echo "${running_script}" | awk -F "@" '{print $1}')"
|
||||
run_log="$(echo "${running_script}" | awk -F "@" '{print $2}')"
|
||||
fi
|
||||
if [[ -n "${run_log}" && "${run_num}" -ne "3" ]]; then
|
||||
echo -e "${run_log}" >${START_LOG} 2>/dev/null && sync && exit 1
|
||||
@ -101,7 +95,7 @@ tolog "PLATFORM: [ ${PLATFORM} ], BOARD: [ ${BOARD} ], Use in [ ${EMMC_NAME} ]"
|
||||
sleep 2
|
||||
|
||||
# 01. Query local version information
|
||||
tolog "01. Query version information."
|
||||
tolog "01. Query version information..."
|
||||
# 01.01 Query the current version
|
||||
current_kernel_v="$(uname -r 2>/dev/null | grep -oE '^[1-9].[0-9]{1,3}.[0-9]+')"
|
||||
tolog "01.01 current version: ${current_kernel_v}"
|
||||
@ -137,46 +131,80 @@ fi
|
||||
|
||||
# 02. Check Updated
|
||||
check_updated() {
|
||||
tolog "02. Start checking for the latest version..."
|
||||
tolog "02.01 Search for tags in the first 5 pages of releases..."
|
||||
|
||||
# Get the release list
|
||||
while true; do
|
||||
response="$(
|
||||
curl -s -L \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/${server_firmware_url}/releases?per_page=${github_per_page}&page=${github_page}"
|
||||
)"
|
||||
# Get the tags list
|
||||
firmware_tags_array=()
|
||||
for i in {1..5}; do
|
||||
while IFS= read -r firmware_tags_name; do
|
||||
firmware_tags_name="$(echo "${firmware_tags_name}" | sed 's/releases\/tag\///g')"
|
||||
if [[ -n "${firmware_tags_name}" ]]; then
|
||||
firmware_tags_array+=("${firmware_tags_name}")
|
||||
fi
|
||||
done < <(
|
||||
curl -fsSL \
|
||||
https://github.com/${server_firmware_url}/releases?page=${i} |
|
||||
grep -oE 'releases/tag/([^" ]+)'
|
||||
)
|
||||
done
|
||||
|
||||
# Check if the response is empty or an error occurred
|
||||
if [[ -z "${response}" ]] || [[ "${response}" == *"Not Found"* ]]; then
|
||||
tolog "02.01 Invalid OpenWrt download address." "1"
|
||||
else
|
||||
# Filter the results and save them to the file
|
||||
echo "${response}" |
|
||||
jq '.[]' |
|
||||
jq -s --arg RTK "${releases_tag_keywords}" '.[] | select(.tag_name | contains($RTK))' |
|
||||
jq -s '.[].assets[] | {data:.updated_at, url:.browser_download_url}' |
|
||||
jq -s --arg BOARD "_${BOARD}_" --arg MLV "${main_line_version}." --arg FSX "${firmware_suffix}" \
|
||||
'.[] | select((.url | contains($BOARD)) and (.url | contains($MLV)) and (.url | endswith($FSX)))' \
|
||||
>>${all_releases_list}
|
||||
fi
|
||||
if [[ "${#firmware_tags_array[*]}" -eq "0" ]]; then
|
||||
tolog "02.01.01 Unable to retrieve a list of firmware tags." "1"
|
||||
fi
|
||||
|
||||
# Check if the current page has fewer results than the per_page limit
|
||||
if [[ "$(echo "${response}" | jq '. | length')" -lt "${github_per_page}" ]]; then
|
||||
tolog "02.02 Search for tags containing the keyword..."
|
||||
|
||||
# Search for tags containing the keyword
|
||||
for i in "${firmware_tags_array[@]}"; do
|
||||
if [[ "${i}" == *"${releases_tag_keywords}"* ]]; then
|
||||
firmware_releases_tag="${i}"
|
||||
break
|
||||
else
|
||||
# Increase the page number
|
||||
github_page="$((github_page + 1))"
|
||||
fi
|
||||
done
|
||||
|
||||
# Get the latest version
|
||||
if [[ -s "${all_releases_list}" ]]; then
|
||||
latest_version="$(cat ${all_releases_list} | jq -s 'sort_by(.data) | reverse | .[0]' -c)"
|
||||
latest_updated_at="$(echo ${latest_version} | jq -r '.data')"
|
||||
latest_url="$(echo ${latest_version} | jq -r '.url')"
|
||||
if [[ -n "${firmware_releases_tag}" ]]; then
|
||||
tolog "02.02.01 Tags: ${firmware_releases_tag}"
|
||||
sleep 2
|
||||
else
|
||||
tolog "02.02.01 No matching tags found." "1"
|
||||
fi
|
||||
|
||||
tolog "02.03 Start searching for firmware download links..."
|
||||
|
||||
# Retrieve the HTML code of the tags list page
|
||||
html_code="$(
|
||||
curl -fsSL \
|
||||
https://github.com/${server_firmware_url}/releases/expanded_assets/${firmware_releases_tag}
|
||||
)"
|
||||
|
||||
# Define regular expressions to match firmware download links and release dates
|
||||
regex_href='href="([^"]+)"'
|
||||
regex_datetime='datetime="([^"]+)"'
|
||||
link_date_results=()
|
||||
while [[ "${html_code}" =~ ${regex_href} ]]; do
|
||||
href="${BASH_REMATCH[1]##*/}"
|
||||
html_code="${html_code#*"${BASH_REMATCH[1]}"}"
|
||||
if [[ "${html_code}" =~ $regex_datetime ]]; then
|
||||
datetime="${BASH_REMATCH[1]}"
|
||||
|
||||
# Search for firmware download links that meet the criteria
|
||||
if [[ "${href}" =~ .*_${BOARD}_.*${main_line_version}\.[0-9]+.*${firmware_suffix} ]] &&
|
||||
[[ ! "${href}" =~ \.sha ]]; then
|
||||
link_date_results+=("${href}@${datetime}")
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${#link_date_results[*]}" -eq "0" ]]; then
|
||||
tolog "02.01 No matching download links found." "1"
|
||||
fi
|
||||
|
||||
# Get the latest version
|
||||
latest_url_date="$(echo "${link_date_results[*]}" | tr ' ' '\n' | sort -urV | head -n 1)"
|
||||
if [[ -n "${latest_url_date}" ]]; then
|
||||
latest_url="$(echo "${latest_url_date}" | awk -F '@' '{print $1}')"
|
||||
latest_updated_at="$(echo "${latest_url_date}" | awk -F '@' '{print $2}')"
|
||||
# Convert to readable date format
|
||||
date_display_format="$(echo ${latest_updated_at} | tr 'T' '(' | tr 'Z' ')')"
|
||||
else
|
||||
@ -186,7 +214,7 @@ check_updated() {
|
||||
# Check the firmware update code
|
||||
down_check_code="${latest_updated_at}.${main_line_version}"
|
||||
op_release_code="${FIRMWARE_DOWNLOAD_PATH}/.luci-app-amlogic/op_release_code"
|
||||
if [[ -f "${op_release_code}" ]]; then
|
||||
if [[ -s "${op_release_code}" ]]; then
|
||||
update_check_code="$(cat ${op_release_code} | xargs)"
|
||||
if [[ -n "${update_check_code}" && "${update_check_code}" == "${down_check_code}" ]]; then
|
||||
tolog "02.02 Already the latest version, no need to update." "1"
|
||||
@ -194,10 +222,10 @@ check_updated() {
|
||||
fi
|
||||
|
||||
# Prompt to update
|
||||
if [[ "${latest_url}" == "http"* ]]; then
|
||||
tolog '<input type="button" class="cbi-button cbi-button-reload" value="Download" onclick="return b_check_firmware(this, '"'download_${latest_updated_at}@${latest_url##*download/}'"')"/> Latest updated: '${date_display_format}'' "1"
|
||||
if [[ -n "${latest_url}" ]]; then
|
||||
tolog '<input type="button" class="cbi-button cbi-button-reload" value="Download" onclick="return b_check_firmware(this, '"'download_${latest_updated_at}@${firmware_releases_tag}/${latest_url}'"')"/> Latest updated: '${date_display_format}'' "1"
|
||||
else
|
||||
tolog "02.03 [${latest_url}] No OpenWrt available, please use another kernel branch." "1"
|
||||
tolog "02.03 No OpenWrt available, please use another kernel branch." "1"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@ -205,7 +233,7 @@ check_updated() {
|
||||
|
||||
# 03. Download Openwrt firmware
|
||||
download_firmware() {
|
||||
tolog "03. Download Openwrt firmware ..."
|
||||
tolog "03. Download Openwrt firmware..."
|
||||
|
||||
# Get the openwrt firmware download path
|
||||
if [[ "${download_version}" == "download_"* ]]; then
|
||||
@ -228,7 +256,6 @@ download_firmware() {
|
||||
# Restore converted characters in file names(%2B to +)
|
||||
firmware_download_oldname="${opfile_path//%2B/+}"
|
||||
latest_url="https://github.com/${server_firmware_url}/releases/download/${firmware_download_oldname}"
|
||||
#tolog "${latest_url}"
|
||||
|
||||
# Download to OpenWrt file
|
||||
firmware_download_name="openwrt_${BOARD}_k${main_line_version}_github${firmware_suffix}"
|
||||
@ -257,7 +284,6 @@ download_firmware() {
|
||||
|
||||
tolog "You can update."
|
||||
|
||||
#echo '<a href="javascript:;" onclick="return amlogic_update(this, '"'${firmware_download_name}'"')">Update</a>' >$START_LOG
|
||||
tolog '<input type="button" class="cbi-button cbi-button-reload" value="Update" onclick="return amlogic_update(this, '"'${firmware_download_name}@${down_check_code}@${FIRMWARE_DOWNLOAD_PATH}'"')"/>' "1"
|
||||
|
||||
exit 0
|
||||
|
@ -6,12 +6,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sing-box
|
||||
PKG_VERSION:=1.6.0-beta.1
|
||||
PKG_VERSION:=1.6.0-beta.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=4a57d8ad9c56538067d29c426c21041c982e3d02ce7b898c13d39c91f8f39c7e
|
||||
PKG_HASH:=2b115540c1d7b357b381769cd074c51a47d3ce1845516941a9242ccde4eddc06
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
@ -21,13 +21,13 @@ define Download/geoip
|
||||
HASH:=7107cfe4e211d4df5234d0d2b1c47bdcd19f6602c2b7969f3a5e12f7cf48692e
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=20231015073627
|
||||
GEOSITE_VER:=20231017111016
|
||||
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
|
||||
define Download/geosite
|
||||
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=2042c47d520634236fbf238a4168196bea64a2d61ca5e6cbab9fd0ac37c7e659
|
||||
HASH:=749426b2cacd471b4a4bcbb5ed1c17047b748597ac4df700a9fd5e74d56387ee
|
||||
endef
|
||||
|
||||
GEOSITE_IRAN_VER:=202310161455
|
||||
|
Loading…
Reference in New Issue
Block a user