优化第三方软件包添加方式

This commit is contained in:
Hyy2001X 2021-07-19 12:17:05 +08:00
parent e8f924b206
commit 377622c22b
6 changed files with 67 additions and 59 deletions

View File

@ -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

View File

@ -1,7 +0,0 @@
#!/bin/bash
case "${OP_Maintainer},${OP_BRANCH}" in
coolsnowwolf,master)
AddPackage git other luci-app-usb3disable rufengsuixing
;;
esac

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,41 @@
#!/bin/bash
# AutoBuild Module by Hyy2001 <https://github.com/Hyy2001X/AutoBuild-Actions>
# 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

View File

@ -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 <Branch>,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() {