From a36cf2c333e241f5ed4e97e2dac2ad0d165b8dc0 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Wed, 23 Jun 2021 17:53:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20PKG=5FFinder,=E9=80=82?= =?UTF-8?q?=E9=85=8D=20main=20=E5=88=86=E6=94=AF=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/AutoBuild_Function.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index 811fcbe..d539d51 100755 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -12,10 +12,12 @@ GET_INFO() { Openwrt_Author="$(echo "${Openwrt_Repo}" | cut -d "/" -f4)" Openwrt_Repo_Name="$(echo "${Openwrt_Repo}" | cut -d "/" -f5)" Openwrt_Branch="$(GET_BRANCH)" - [[ ! ${Openwrt_Branch} == master ]] && { + if [[ ${Openwrt_Branch} == master || -z ${Openwrt_Branch} ]];then + Openwrt_Version_="R$(date +%y.%m)-" + else Openwrt_Branch="$(echo ${Openwrt_Branch} | egrep -o "[0-9]+.[0-9]+")" - Openwrt_Version_="R${Openwrt_Branch}-" - } || Openwrt_Version_="R$(date +%y.%m)-" + Openwrt_Version_="R${Openwrt_Branch}.0-" + fi case "${Openwrt_Author}" in coolsnowwolf) Version_File=package/lean/default-settings/files/zzz-default-settings @@ -353,11 +355,13 @@ TIME() { } PKG_Finder() { + local Result [[ $# -ne 3 ]] && { - TIME "[ERROR] Error options: [$#] [$*] !" + TIME "Usage: PKG_Finder Search_Path Target_Name/Target_Path" return 0 } - find $2 -name $3 -type $1 -depth -exec echo {} \; + Result=$(find $2 -name $3 -type $1 -depth -exec echo {} \;) + [[ -n ${Result} ]] && echo "${Result}" } AddPackage_List() {