From 377622c22b7a94b0aa810506371e5bfc5411b0cb Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Mon, 19 Jul 2021 12:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E5=8C=85=E6=B7=BB=E5=8A=A0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomPackages/Common | 21 --------------- CustomPackages/asus_rt-acrh17 | 7 ----- CustomPackages/d-team_newifi-d2 | 8 ------ CustomPackages/x86_64 | 8 ------ Scripts/AutoBuild_ExtraPackages.sh | 41 ++++++++++++++++++++++++++++++ Scripts/AutoBuild_Function.sh | 41 +++++++++++++++++++----------- 6 files changed, 67 insertions(+), 59 deletions(-) delete mode 100644 CustomPackages/Common delete mode 100644 CustomPackages/asus_rt-acrh17 delete mode 100755 CustomPackages/d-team_newifi-d2 delete mode 100755 CustomPackages/x86_64 create mode 100644 Scripts/AutoBuild_ExtraPackages.sh diff --git a/CustomPackages/Common b/CustomPackages/Common deleted file mode 100644 index bb8d021..0000000 --- a/CustomPackages/Common +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# 推荐使用的 case 判断参数: -# OP_Maintainer Openwrt 源码作者 -# OP_REPO_NAME Openwrt 仓库名称 -# OP_BRANCH Openwrt 源码分支/Tag -# TARGET_PROFILE 设备名称 -# TARGET_BOARD 设备架构 - -case "${OP_Maintainer},${OP_BRANCH}" in -coolsnowwolf,master) - AddPackage svn other luci-app-smartdns kenzok8/openwrt-packages/trunk - AddPackage git other luci-app-serverchan tty228 - AddPackage svn other luci-app-socat Lienol/openwrt-package/trunk - AddPackage git other luci-app-onliner Hyy2001X - AddPackage git other luci-app-adguardhome Hyy2001X - AddPackage svn other luci-app-eqos kenzok8/openwrt-packages/trunk - AddPackage git other OpenClash vernesong master - AddPackage git other luci-app-adblock-plus small-5 master -;; -esac diff --git a/CustomPackages/asus_rt-acrh17 b/CustomPackages/asus_rt-acrh17 deleted file mode 100644 index 121b52a..0000000 --- a/CustomPackages/asus_rt-acrh17 +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -case "${OP_Maintainer},${OP_BRANCH}" in -coolsnowwolf,master) - AddPackage git other luci-app-usb3disable rufengsuixing -;; -esac diff --git a/CustomPackages/d-team_newifi-d2 b/CustomPackages/d-team_newifi-d2 deleted file mode 100755 index cff5622..0000000 --- a/CustomPackages/d-team_newifi-d2 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -case "${OP_Maintainer},${OP_BRANCH}" in -coolsnowwolf,master) - AddPackage git other luci-app-usb3disable rufengsuixing - # AddPackage svn package/kernel mt76 openwrt/openwrt/trunk/package/kernel -;; -esac diff --git a/CustomPackages/x86_64 b/CustomPackages/x86_64 deleted file mode 100755 index c4d0e98..0000000 --- a/CustomPackages/x86_64 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -case "${OP_Maintainer},${OP_BRANCH}" in -coolsnowwolf,master) - AddPackage git other openwrt-passwall xiaorouji main - AddPackage git other luci-app-shutdown Hyy2001X -;; -esac diff --git a/Scripts/AutoBuild_ExtraPackages.sh b/Scripts/AutoBuild_ExtraPackages.sh new file mode 100644 index 0000000..4e964c1 --- /dev/null +++ b/Scripts/AutoBuild_ExtraPackages.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# AutoBuild Module by Hyy2001 +# AutoBuild ExtraPackages + +# 推荐使用的 case 判断参数: +# OP_Maintainer Openwrt 源码作者,例如 [coolsnowwolf] [openwrt] [lienol/Lienol] [immortalwrt] +# OP_REPO_NAME Openwrt 仓库名称,例如 [lede] [openwrt] [immortalwrt] +# OP_BRANCH Openwrt 源码分支,例如 [master] [main] [openwrt-21.02] [v21.02.0-rc3] ... +# TARGET_PROFILE 设备名称,例如 [asus_rt-acrh17] [d-team_newifi-d2] [redmi_ax6] ... +# TARGET_BOARD 设备架构,例如 [x86] [ramips] [ipq807x] [ath79] ... + +## coolsnowwolf:master 通用软件包 +case "${OP_Maintainer},${OP_BRANCH}" in +coolsnowwolf,master) + AddPackage svn other luci-app-smartdns kenzok8/openwrt-packages/trunk + AddPackage git other luci-app-serverchan tty228 + AddPackage svn other luci-app-socat Lienol/openwrt-package/trunk + AddPackage git other luci-app-onliner Hyy2001X + AddPackage git other luci-app-adguardhome Hyy2001X + AddPackage svn other luci-app-eqos kenzok8/openwrt-packages/trunk + AddPackage git other OpenClash vernesong master + AddPackage git other luci-app-adblock-plus small-5 master +;; +esac + +## coolsnowwolf:master 设备独有软件包 +case "${TARGET_PROFILE},${OP_Maintainer},${OP_BRANCH}" in +asus_rt-acrh17,coolsnowwolf,master) + AddPackage git other luci-app-usb3disable rufengsuixing +;; +d-team_newifi-d2,coolsnowwolf,master) + AddPackage git other luci-app-usb3disable rufengsuixing + # AddPackage svn package/kernel mt76 openwrt/openwrt/trunk/package/kernel +;; +x86_64,coolsnowwolf,master) + AddPackage git other openwrt-passwall xiaorouji main + AddPackage git other luci-app-shutdown Hyy2001X master + AddPackage svn other luci-app-ddnsto linkease/nas-packages/trunk/luci + AddPackage svn other ddnsto linkease/nas-packages/trunk/network/services +;; +esac \ No newline at end of file diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index c90c3ae..faedced 100755 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -94,14 +94,15 @@ Firmware-Diy_Main() { Firmware-Diy_Before mkdir -p package/base-files/files/etc/AutoBuild [ -f VARIABLE_Main ] && cp VARIABLE_Main package/base-files/files/etc/AutoBuild/Default_Variable - [[ ${Load_CustomPackages_List} == true ]] && { - [[ -f ${GITHUB_WORKSPACE}/CustomPackages/Common ]] && . ${GITHUB_WORKSPACE}/CustomPackages/Common - [[ -f ${GITHUB_WORKSPACE}/CustomPackages/${TARGET_PROFILE} ]] && . ${GITHUB_WORKSPACE}/CustomPackages/${TARGET_PROFILE} - } Copy CustomFiles/Depends/Custom_Variable package/base-files/files/etc/AutoBuild chmod +x -R ${GITHUB_WORKSPACE}/Scripts chmod 777 -R ${GITHUB_WORKSPACE}/CustomFiles - chmod 777 -R ${GITHUB_WORKSPACE}/CustomPackages + [[ ${Load_CustomPackages_List} == true ]] && { + bash -n ${GITHUB_WORKSPACE}/Scripts/AutoBuild_ExtraPackages.sh + [[ ! $? == 0 ]] && TIME "AutoBuild_ExtraPackages.sh syntax error,skip ..." || { + . ${GITHUB_WORKSPACE}/Scripts/AutoBuild_ExtraPackages.sh + } + } [[ ${INCLUDE_AutoBuild_Features} == true ]] && { Copy Scripts/AutoBuild_Tools.sh package/base-files/files/bin Copy Scripts/AutoUpdate.sh package/base-files/files/bin @@ -203,14 +204,14 @@ Firmware-Diy_Other() { esac if [[ ${PKG_Compatible} == true ]];then if [[ ${OP_Maintainer} == openwrt || ${OP_Maintainer} == [Ll]ienol || ${Force_mode} == 1 ]];then - TIME "Start to run Obsolete_Package_Compatible Scripts ..." + TIME "Starting to run Obsolete_Package_Compatible Scripts ..." case "${OP_BRANCH}" in 19.07 | 21.02 | main) [[ ${OP_BRANCH} == main ]] && OP_BRANCH=21.02 Copy CustomFiles/Patches/0003-upx-ucl-${OP_BRANCH}.patch ./ cat 0003-upx-ucl-${OP_BRANCH}.patch | patch -p1 > /dev/null 2>&1 # AddPackage svn feeds/packages golang coolsnowwolf/packages/trunk/lang - TIME "Start to convert zh-cn translation files to zh_Hans ..." + TIME "Starting to convert zh-cn translation files to zh_Hans ..." Copy Scripts/Convert_Translation.sh package cd ./package && bash ./Convert_Translation.sh && cd .. ;; @@ -339,18 +340,28 @@ PKG_Finder() { AddPackage() { [[ $# -lt 4 ]] && { - TIME "Error options: [$#] [$*] !" + TIME "Syntax error: [$#] [$*] !" return 0 } - [[ $* =~ "#" ]] && return 0 - PKG_PROTO="$1" - PKG_DIR="$2" - PKG_NAME="$3" + PKG_PROTO=$1 + case "${PKG_PROTO}" in + git | svn) + : + ;; + *) + TIME "Unknown type: ${PKG_PROTO}" + ;; + esac + PKG_DIR=$2 + PKG_NAME=$3 REPO_URL="https://github.com/$4" - [[ -z $5 ]] && REPO_BRANCH=master || REPO_BRANCH="$5" + [[ -z $5 ]] && { + TIME "WARNING: Missing ,will use default branch: [master]" + REPO_BRANCH=master + } || REPO_BRANCH=$5 [[ ${REPO_URL} =~ "${OP_Maintainer}/${OP_REPO_NAME}" ]] && return 0 - mkdir -p package/${PKG_DIR} + mkdir -p package/${PKG_DIR} || TIME "Can't create download dir: [package/${PKG_DIR}]" && return 0 [[ -d package/${PKG_DIR}/${PKG_NAME} ]] && { TIME "Removing old package: [${PKG_NAME}] ..." rm -rf package/${PKG_DIR}/${PKG_NAME} @@ -368,7 +379,7 @@ AddPackage() { esac [[ -f ${PKG_NAME}/Makefile || -n $(ls -A ${PKG_NAME}) ]] && { mv -f "${PKG_NAME}" "package/${PKG_DIR}" - } + } || TIME "Package: ${PKG_NAME} failed to download" } Copy() {