uugamebooster: update version

This commit is contained in:
coolsnowwolf 2024-11-12 23:16:41 +08:00
parent 98b47a0b18
commit 1c38018ec0
5 changed files with 107 additions and 71 deletions

View File

@ -1,22 +1,33 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 KFERMercer <KFER.Mercer@gmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
#
#
# to get the latest version & md5 checksum:
# curl -L -s -k -H "Accept:text/plain" "http://router.uu.163.com/api/plugin?type=openwrt-$(UU_ARCH)"
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=uugamebooster
PKG_VERSION:=v7.9.14
PKG_RELEASE:=1
PKG_VERSION:=7.9.14
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(ARCH).tar.gz
PKG_SOURCE_URL:=https://uu.gdl.netease.com/uuplugin/openwrt-$(ARCH)/v$(PKG_VERSION)/uu.tar.gz?
ifeq ($(ARCH),aarch64)
PKG_HASH:=95ea5d99a6ad8d22c3650660d04d603508509972ec9098d680c82e7d51ff024e
else ifeq ($(ARCH),arm)
PKG_HASH:=2e624deea128a298fce71f243d92092dad23451de7f547ad82008b9dd989bca5
else ifeq ($(ARCH),mipsel)
PKG_HASH:=31c08d893f46aaeddef41b37cdf10f935d5a45a136c6401fb71166d47cd8db12
else ifeq ($(ARCH),x86_64)
PKG_HASH:=6025af23e771540e31f86144aebb1420d56e315e29cb3157ac1dc0da428fcf63
endif
PKG_LICENSE:=Proprietary
include $(INCLUDE_DIR)/package.mk
STRIP:=true
TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
define Package/uugamebooster
SECTION:=net
CATEGORY:=Network
@ -26,60 +37,27 @@ define Package/uugamebooster
endef
define Package/uugamebooster/description
NetEase's UU Game Booster Accelerates Triple-A Gameplay and Market
endef
ifeq ($(ARCH),arm)
UU_ARCH:=arm
PKG_HASH:=2e624deea128a298fce71f243d92092dad23451de7f547ad82008b9dd989bca5
endif
ifeq ($(ARCH),aarch64)
UU_ARCH:=aarch64
PKG_HASH:=95ea5d99a6ad8d22c3650660d04d603508509972ec9098d680c82e7d51ff024e
endif
ifeq ($(ARCH),mipsel)
UU_ARCH:=mipsel
PKG_HASH:=31c08d893f46aaeddef41b37cdf10f935d5a45a136c6401fb71166d47cd8db12
endif
ifeq ($(ARCH),x86_64)
UU_ARCH:=x86_64
PKG_HASH:=6025af23e771540e31f86144aebb1420d56e315e29cb3157ac1dc0da428fcf63
endif
PKG_SOURCE_URL:=https://uu.gdl.netease.com/uuplugin/openwrt-$(UU_ARCH)/$(PKG_VERSION)/uu.tar.gz?
PKG_SOURCE:=$(PKG_NAME)-$(UU_ARCH)-$(PKG_VERSION).tar.gz
STRIP:=true
UNTAR_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/$(PKG_NAME)-$(UU_ARCH)-bin
define Build/Prepare
mkdir -vp $(UNTAR_DIR)
tar -zxvf $(DL_DIR)/$(PKG_SOURCE) -C $(UNTAR_DIR)
NetEase's UU Game Booster Accelerates Triple-A Gameplay and Market.
endef
define Build/Compile
endef
define Package/uugamebooster/conffiles
/root/.uuplugin_uuid
/.uuplugin_uuid
/usr/share/uugamebooster/uu.conf
endef
define Package/uugamebooster/install
# $(INSTALL_DIR) $(1)/etc/init.d
# $(INSTALL_BIN) ./files/uugamebooster.init $(1)/etc/init.d/uuplugin
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uuplugin $(1)/usr/bin/uugamebooster
$(INSTALL_DIR) $(1)/usr/share/uugamebooster
$(INSTALL_BIN) $(UNTAR_DIR)/uuplugin $(1)/usr/share/uugamebooster/uuplugin
$(INSTALL_CONF) $(UNTAR_DIR)/uu.conf $(1)/usr/share/uugamebooster/uu.conf
$(INSTALL_CONF) $(PKG_BUILD_DIR)/uu.conf $(1)/usr/share/uugamebooster/uu.conf
# not finish yet:
# $(INSTALL_DIR) $(1)/usr/bin
# $(INSTALL_BIN) ./files/uugamebooster-update $(1)/usr/bin/uugamebooster
# $(LN) $(1)/usr/bin/uugamebooster/uugamebooster-update $(1)/usr/bin/uugamebooster-update
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
$(INSTALL_CONF) ./files/uugamebooster.config $(1)/etc/config/uugamebooster
$(INSTALL_BIN) ./files/uugamebooster.init $(1)/etc/init.d/uugamebooster
endef
$(eval $(call BuildPackage,uugamebooster))

View File

@ -1,18 +0,0 @@
#!/bin/sh
# Return: 0 means update flag is set.
check_update() {
if [ -f "/usr/bin/uugamebooster/uu.update" ];then
return 0
else
return 1
fi
}
check_update
if [ "$?" != "0" ];then
exit 0
return
fi
exit 0

View File

@ -0,0 +1,4 @@
config uugamebooster 'config'
option enabled '0'

View File

@ -0,0 +1,37 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2021 Tianling Shen <cnsztl@immortalwrt.org>
USE_PROCD=1
START=99
CONF="uugamebooster"
PROG="/usr/bin/uugamebooster"
UU_CONF="/usr/share/uugamebooster/uu.conf"
start_service() {
config_load "$CONF"
local enabled
config_get_bool enabled "config" "enabled" "0"
[ "$enabled" -eq "1" ] || return 1
procd_open_instance "$CONF"
procd_set_param command "$PROG" "$UU_CONF"
procd_set_param limits core="unlimited"
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger "$CONF"
}

35
net/uugamebooster/update.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
set -x
export CURDIR="$(cd "$(dirname $0)"; pwd)"
VERSION="$(curl -fsSL "https://router.uu.163.com/api/plugin?type=openwrt-aarch64" | jq -r ".url" | awk -F '/' '{print $6}' | tr -d 'v')" || exit 1
PKG_VERSION="$(awk -F "PKG_VERSION:=" '{print $2}' "$CURDIR/Makefile" | xargs)"
[ "$PKG_VERSION" != "$VERSION" ] || exit 0
for ARCH in "aarch64" "arm" "mipsel" "x86_64"; do
FILE_INFO="$(curl -fsSL "https://router.uu.163.com/api/plugin?type=openwrt-$ARCH")"
FILE_MD5="$(echo "$FILE_INFO" | jq -r ".md5")"
FILE_VER="$(echo "$FILE_INFO" | jq -r ".url" | awk -F '/' '{print $6}' | tr -d 'v')"
if [ "$FILE_VER" != "$VERSION" ]; then
echo -e "Version mismatch. Expected version: $VERSION, got $FILE_VER."
exit 1
else
curl -fsSL "https://uu.gdl.netease.com/uuplugin/openwrt-$ARCH/v$VERSION/uu.tar.gz" -o "$CURDIR/uu-$ARCH.tar.gz"
ACTUAL_MD5="$(md5sum "$CURDIR/uu-$ARCH.tar.gz" | awk '{print $1}')"
if [ "$ACTUAL_MD5" != "$FILE_MD5" ]; then
echo -e "HASH mismatch. Expected md5: $FILE_MD5, got $ACTUAL_MD5."
else
FILE_HASH="$(sha256sum "$CURDIR/uu-$ARCH.tar.gz" | awk '{print $1}')"
HASH_LINE="$(($(sed -n -e "/(\$(ARCH),$ARCH)/=" "$CURDIR/Makefile") + 1))"
sed -i "${HASH_LINE}s/PKG_HASH:=.*/PKG_HASH:=$FILE_HASH/" "$CURDIR/Makefile"
fi
rm -f "$CURDIR/uu-$ARCH.tar.gz"
fi
done
sed -i "s,PKG_VERSION:=.*,PKG_VERSION:=$VERSION,g" "$CURDIR/Makefile"