From a15d4abdd67536b3620fc95eae3fd63341ce0ffa Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Sun, 31 Jan 2021 01:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81,=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20webadmin=20uhttpd=20=E6=B1=89=E5=8C=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/AutoBuild_Function.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index d04d24a..c1bb168 100644 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -23,7 +23,7 @@ Diy_Part1_Base() { ExtraPackages git lean helloworld https://github.com/fw876 master sed -i 's/143/143,25,5222/' package/lean/helloworld/luci-app-ssr-plus/root/etc/init.d/shadowsocksr fi - if [[ "${INCLUDE_Latest_Xray}" == "true" ]];then + if [[ "${INCLUDE_Keep_Latest_Xray}" == "true" ]];then Update_Makefile xray package/lean/helloworld/xray Update_Makefile v2ray package/lean/v2ray Update_Makefile v2ray-plugin package/lean/v2ray-plugin @@ -57,6 +57,8 @@ Diy_Part2_Base() { else sed -i "s?Openwrt?Openwrt ${Openwrt_Version}?g" package/base-files/files/etc/banner fi + Replace_File Customize/uhttpd.po package/feeds/luci/applications/luci-app-uhttpd/po/zh-cn + Replace_File Customize/webadmin.po package/lean/luci-app-webadmin/po/zh-cn [[ -z "${Author}" ]] && Author="Unknown" echo "Author: ${Author}" echo "Openwrt Version: ${Openwrt_Version}" @@ -160,21 +162,27 @@ Replace_File() { Update_Makefile() { PKG_NAME="$1" Makefile="$2/Makefile" + [ -f /tmp/tmp_file ] && rm -f /tmp/tmp_file if [ -f "${Makefile}" ];then PKG_URL_MAIN="$(grep "PKG_SOURCE_URL:=" ${Makefile} | cut -c17-100)" _process1=${PKG_URL_MAIN##*com/} _process2=${_process1%%/tar*} api_URL="https://api.github.com/repos/${_process2}/releases" - PKG_DL_URL="https://codeload.github.com/${_process2}/tar.gz/v" + PKG_SOURCE_URL="$(grep "PKG_SOURCE_URL:=" ${Makefile} | cut -c17-100)" + PKG_DL_URL="${PKG_SOURCE_URL%\$(\PKG_VERSION*}" Offical_Version="$(curl -s ${api_URL} 2>/dev/null | grep 'tag_name' | egrep -o '[0-9].+[0-9.]+' | awk 'NR==1')" - if [[ -z "${Offical_Version}" ]] && [[ ! "$?" -eq 0 ]];then - echo "Failed to obtain the Offical version,skip update ..." + if [[ -z "${Offical_Version}" ]];then + echo "Failed to obtain the Offical version of [${PKG_NAME}],skip update ..." return fi Source_Version="$(grep "PKG_VERSION:=" ${Makefile} | cut -c14-20)" Source_HASH="$(grep "PKG_HASH:=" ${Makefile} | cut -c11-100)" + if [[ -z "${Source_Version}" ]] || [[ -z "${Source_HASH}" ]];then + echo "Failed to obtain the Source version or HASH,skip update ..." + return + fi echo -e "Current ${PKG_NAME} version: ${Source_Version}\nOffical ${PKG_NAME} version: ${Offical_Version}" - if [[ ! "${Source_Version}" == "${Offical_Version}" ]] && [[ ! "$?" -eq 0 ]];then + if [[ ! "${Source_Version}" == "${Offical_Version}" ]];then echo -e "Updating package ${PKG_NAME} [${Source_Version}] to [${Offical_Version}] ..." sed -i "s?PKG_VERSION:=${Source_Version}?PKG_VERSION:=${Offical_Version}?g" ${Makefile} wget -q "${PKG_DL_URL}${Offical_Version}?" -O /tmp/tmp_file @@ -188,5 +196,5 @@ Update_Makefile() { else echo "Package ${PKG_NAME} is not detected,skip update ..." fi - unset _process1 _process2 Offical_Version + unset _process1 _process2 Offical_Version Source_Version }