AutoBuild-Actions: 20211212 功能更新
2021/12/12 更新内容 1. 新增固件标签 Default_FLAG, 一键更新固件时会自动检测带该标签的固件版本, e.g. 若固件标签为 Full, 则更新固件时仅可以更新到固件名称中带 Full 标签的版本 补充: 用户自定义变量 Default_FLAG, 支持数字与字母的组合 [0-9a-zA-Z] 例如 [Full Lite Daily1 Test2], 不支持标点符号, 不能为空 当该值为 AUTO 时, 将自动从配置文件名称获取, 格式为 <TARGET_PROFILE>-<FLAG>, e.g. 配置文件名称为 [x86_64-Test 或 d-team_newifi-d2-Lite], 则标签分别为 [Test Lite]; 配置文件若为不规则命名或无标签例如 [x86_64 X86 NEWIFI-D2], 则标签自动设定为 Full 同时支持在手动编译时临时修改, 点击 Run workflow 后修改 固件名称后缀 [可选] 值即可, 优先级高于用户自定义变量 Default_FLAG 固件内支持标签的快速切换, 切换方法 autoupdate --flag <标签名>, 恢复默认 autoupdate --flag reset 2. AutoBuild_Function.sh Firmware_Diy 函数中新增 CONFIG_FILE TARGET_FLAG 等可调用变量 3. 新增一些设备支持 (也许, 我也不知道) 改动内容较大, 建议重新 Fork 本仓库
This commit is contained in:
parent
12282b826e
commit
a4c4df601d
|
@ -12,11 +12,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
Tempoary_IP:
|
Tempoary_IP:
|
||||||
description: '临时修改 IP 地址 [可选]'
|
description: '固件 IP 地址 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
Tempoary_CONFIG:
|
Tempoary_CONFIG:
|
||||||
description: '配置文件 [可选]'
|
description: '配置文件 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
|
Tempoary_FLAG:
|
||||||
|
description: '固件名称后缀 [可选]'
|
||||||
|
default: ''
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
#push:
|
#push:
|
||||||
|
@ -87,8 +90,16 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
||||||
then
|
then
|
||||||
|
echo "IP: [${{ github.event.inputs.Tempoary_IP }}]"
|
||||||
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{ github.event.inputs.Tempoary_FLAG }}" ]
|
||||||
|
then
|
||||||
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "env Tempoary_FLAG is not detected !"
|
||||||
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
|
|
|
@ -12,11 +12,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
Tempoary_IP:
|
Tempoary_IP:
|
||||||
description: '临时修改 IP 地址 [可选]'
|
description: '固件 IP 地址 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
Tempoary_CONFIG:
|
Tempoary_CONFIG:
|
||||||
description: '配置文件 [可选]'
|
description: '配置文件 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
|
Tempoary_FLAG:
|
||||||
|
description: '固件名称后缀 [可选]'
|
||||||
|
default: ''
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
#push:
|
#push:
|
||||||
|
@ -87,8 +90,16 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
||||||
then
|
then
|
||||||
|
echo "IP: [${{ github.event.inputs.Tempoary_IP }}]"
|
||||||
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{ github.event.inputs.Tempoary_FLAG }}" ]
|
||||||
|
then
|
||||||
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "env Tempoary_FLAG is not detected !"
|
||||||
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
|
|
|
@ -12,11 +12,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
Tempoary_IP:
|
Tempoary_IP:
|
||||||
description: '临时修改 IP 地址 [可选]'
|
description: '固件 IP 地址 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
Tempoary_CONFIG:
|
Tempoary_CONFIG:
|
||||||
description: '配置文件 [可选]'
|
description: '配置文件 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
|
Tempoary_FLAG:
|
||||||
|
description: '固件名称后缀 [可选]'
|
||||||
|
default: ''
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
#push:
|
#push:
|
||||||
|
@ -87,8 +90,16 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
||||||
then
|
then
|
||||||
|
echo "IP: [${{ github.event.inputs.Tempoary_IP }}]"
|
||||||
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{ github.event.inputs.Tempoary_FLAG }}" ]
|
||||||
|
then
|
||||||
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "env Tempoary_FLAG is not detected !"
|
||||||
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
|
|
|
@ -12,11 +12,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
Tempoary_IP:
|
Tempoary_IP:
|
||||||
description: '临时修改 IP 地址 [可选]'
|
description: '固件 IP 地址 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
Tempoary_CONFIG:
|
Tempoary_CONFIG:
|
||||||
description: '配置文件 [可选]'
|
description: '配置文件 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
|
Tempoary_FLAG:
|
||||||
|
description: '固件名称后缀 [可选]'
|
||||||
|
default: ''
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
#push:
|
#push:
|
||||||
|
@ -87,8 +90,16 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
||||||
then
|
then
|
||||||
|
echo "IP: [${{ github.event.inputs.Tempoary_IP }}]"
|
||||||
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{ github.event.inputs.Tempoary_FLAG }}" ]
|
||||||
|
then
|
||||||
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "env Tempoary_FLAG is not detected !"
|
||||||
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
|
|
|
@ -12,11 +12,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
Tempoary_IP:
|
Tempoary_IP:
|
||||||
description: '临时修改 IP 地址 [可选]'
|
description: '固件 IP 地址 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
Tempoary_CONFIG:
|
Tempoary_CONFIG:
|
||||||
description: '配置文件 [可选]'
|
description: '配置文件 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
|
Tempoary_FLAG:
|
||||||
|
description: '固件名称后缀 [可选]'
|
||||||
|
default: ''
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
#push:
|
#push:
|
||||||
|
@ -87,8 +90,16 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
||||||
then
|
then
|
||||||
|
echo "IP: [${{ github.event.inputs.Tempoary_IP }}]"
|
||||||
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{ github.event.inputs.Tempoary_FLAG }}" ]
|
||||||
|
then
|
||||||
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "env Tempoary_FLAG is not detected !"
|
||||||
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
|
|
|
@ -12,11 +12,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
Tempoary_IP:
|
Tempoary_IP:
|
||||||
description: '临时修改 IP 地址 [可选]'
|
description: '固件 IP 地址 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
Tempoary_CONFIG:
|
Tempoary_CONFIG:
|
||||||
description: '配置文件 [可选]'
|
description: '配置文件 [可选]'
|
||||||
default: ''
|
default: ''
|
||||||
|
Tempoary_FLAG:
|
||||||
|
description: '固件名称后缀 [可选]'
|
||||||
|
default: ''
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
#push:
|
#push:
|
||||||
|
@ -87,8 +90,16 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
if [ -n "${{ github.event.inputs.Tempoary_IP }}" ]
|
||||||
then
|
then
|
||||||
|
echo "IP: [${{ github.event.inputs.Tempoary_IP }}]"
|
||||||
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
echo "Tempoary_IP=${{ github.event.inputs.Tempoary_IP }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{ github.event.inputs.Tempoary_FLAG }}" ]
|
||||||
|
then
|
||||||
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "env Tempoary_FLAG is not detected !"
|
||||||
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
|
|
|
@ -6,6 +6,7 @@ Firmware_Diy_Core() {
|
||||||
|
|
||||||
Author=AUTO
|
Author=AUTO
|
||||||
Author_URL=AUTO
|
Author_URL=AUTO
|
||||||
|
Default_FLAG=AUTO
|
||||||
Default_IP="192.168.1.1"
|
Default_IP="192.168.1.1"
|
||||||
Banner_Message="Powered by AutoBuild-Actions"
|
Banner_Message="Powered by AutoBuild-Actions"
|
||||||
|
|
||||||
|
@ -21,22 +22,24 @@ Firmware_Diy_Core() {
|
||||||
|
|
||||||
Firmware_Diy() {
|
Firmware_Diy() {
|
||||||
|
|
||||||
# 请在该函数内定制固件, 建议使用专业文本编辑器进行修改
|
# 请在该函数内定制固件
|
||||||
|
|
||||||
# 可用预设变量, 其他可用变量请参考运行日志
|
# 可用预设变量, 其他可用变量请参考运行日志
|
||||||
# ${OP_AUTHOR} OpenWrt 源码作者
|
# ${OP_AUTHOR} OpenWrt 源码作者
|
||||||
# ${OP_REPO} OpenWrt 仓库名称
|
# ${OP_REPO} OpenWrt 仓库名称
|
||||||
# ${OP_BRANCH} OpenWrt 源码分支
|
# ${OP_BRANCH} OpenWrt 源码分支
|
||||||
# ${TARGET_PROFILE} 设备名称, 例如: d-team_newifi-d2
|
# ${TARGET_PROFILE} 设备名称
|
||||||
# ${TARGET_BOARD} 设备架构, 例如: ramips
|
# ${TARGET_BOARD} 设备架构
|
||||||
|
# ${TARGET_FLAG} 固件名称后缀
|
||||||
|
|
||||||
# ${Home} OpenWrt 源码位置
|
# ${Home} OpenWrt 源码位置
|
||||||
# ${FEEDS_CONF} [feeds.conf.default] 文件
|
# ${CONFIG_FILE} 使用的配置文件名称
|
||||||
|
# ${FEEDS_CONF} OpenWrt 源码目录下的 feeds.conf.default 文件
|
||||||
# ${CustomFiles} 仓库中的 /CustomFiles 绝对路径
|
# ${CustomFiles} 仓库中的 /CustomFiles 绝对路径
|
||||||
# ${Scripts} 仓库中的 /Scripts 绝对路径
|
# ${Scripts} 仓库中的 /Scripts 绝对路径
|
||||||
# ${FEEDS_LUCI} OpenWrt 源码目录下的 package/feeds/luci
|
# ${FEEDS_LUCI} OpenWrt 源码目录下的 package/feeds/luci 目录
|
||||||
# ${FEEDS_PKG} OpenWrt 源码目录下的 package/feeds/packages
|
# ${FEEDS_PKG} OpenWrt 源码目录下的 package/feeds/packages 目录
|
||||||
# ${BASE_FILES} 俗称替换大法的路径, 位于 package/base-files/files
|
# ${BASE_FILES} OpenWrt 源码目录下的 package/base-files/files 目录
|
||||||
|
|
||||||
case "${OP_AUTHOR}/${OP_REPO}:${OP_BRANCH}" in
|
case "${OP_AUTHOR}/${OP_REPO}:${OP_BRANCH}" in
|
||||||
coolsnowwolf/lede:master)
|
coolsnowwolf/lede:master)
|
||||||
|
@ -48,6 +51,7 @@ Firmware_Diy() {
|
||||||
AddPackage svn other luci-app-socat Lienol/openwrt-package/trunk
|
AddPackage svn other luci-app-socat Lienol/openwrt-package/trunk
|
||||||
AddPackage svn other luci-app-eqos kenzok8/openwrt-packages/trunk
|
AddPackage svn other luci-app-eqos kenzok8/openwrt-packages/trunk
|
||||||
AddPackage git other OpenClash vernesong master
|
AddPackage git other OpenClash vernesong master
|
||||||
|
AddPackage git other luci-app-usb3disable rufengsuixing master
|
||||||
# AddPackage git other OpenAppFilter destan19 master
|
# AddPackage git other OpenAppFilter destan19 master
|
||||||
# AddPackage svn other luci-app-ddnsto linkease/nas-packages/trunk/luci
|
# AddPackage svn other luci-app-ddnsto linkease/nas-packages/trunk/luci
|
||||||
# AddPackage svn other ddnsto linkease/nas-packages/trunk/network/services
|
# AddPackage svn other ddnsto linkease/nas-packages/trunk/network/services
|
||||||
|
@ -57,15 +61,8 @@ Firmware_Diy() {
|
||||||
patch -i ${CustomFiles}/${TARGET_PROFILE}_mac80211.patch package/kernel/mac80211/files/lib/wifi/mac80211.sh
|
patch -i ${CustomFiles}/${TARGET_PROFILE}_mac80211.patch package/kernel/mac80211/files/lib/wifi/mac80211.sh
|
||||||
Copy ${CustomFiles}/${TARGET_PROFILE}_system ${BASE_FILES}/etc/config system
|
Copy ${CustomFiles}/${TARGET_PROFILE}_system ${BASE_FILES}/etc/config system
|
||||||
sed -i "/DEVICE_COMPAT_VERSION := 1.1/d" target/linux/ramips/image/mt7621.mk
|
sed -i "/DEVICE_COMPAT_VERSION := 1.1/d" target/linux/ramips/image/mt7621.mk
|
||||||
AddPackage git other luci-app-usb3disable rufengsuixing master
|
|
||||||
;;
|
;;
|
||||||
x86_64)
|
x86_64)
|
||||||
cat >> ${Version_File} <<EOF
|
|
||||||
|
|
||||||
sed -i 's#mirrors.cloud.tencent.com/lede#downloads.immortalwrt.cnsztl.eu.org#g' /etc/opkg/distfeeds.conf
|
|
||||||
sed -i 's#18.06.9/##g' /etc/opkg/distfeeds.conf
|
|
||||||
sed -i 's#releases/#snapshots/#g' /etc/opkg/distfeeds.conf
|
|
||||||
EOF
|
|
||||||
AddPackage git other openwrt-passwall xiaorouji main
|
AddPackage git other openwrt-passwall xiaorouji main
|
||||||
rm -rf packages/lean/autocore
|
rm -rf packages/lean/autocore
|
||||||
AddPackage git lean autocore-modify Hyy2001X master
|
AddPackage git lean autocore-modify Hyy2001X master
|
||||||
|
|
|
@ -51,25 +51,48 @@ Firmware_Diy_Before() {
|
||||||
TARGET_SUBTARGET="$(awk -F '[="]+' '/TARGET_SUBTARGET/{print $2}' ${CONFIG_TEMP})"
|
TARGET_SUBTARGET="$(awk -F '[="]+' '/TARGET_SUBTARGET/{print $2}' ${CONFIG_TEMP})"
|
||||||
[[ -z ${Firmware_Format} || ${Firmware_Format} =~ (false|AUTO) ]] && {
|
[[ -z ${Firmware_Format} || ${Firmware_Format} =~ (false|AUTO) ]] && {
|
||||||
case "${TARGET_BOARD}" in
|
case "${TARGET_BOARD}" in
|
||||||
ramips | reltek | ipq40xx | ath79 | ipq807x)
|
ramips | reltek | ath* | ipq* | bcm47xx | bmips | kirkwood | mediatek)
|
||||||
Firmware_Format=bin
|
Firmware_Format=bin
|
||||||
;;
|
;;
|
||||||
rockchip | x86)
|
rockchip | x86 | bcm27xx | mxs | sunxi | zynq)
|
||||||
[[ $(cat ${CONFIG_TEMP}) =~ CONFIG_TARGET_IMAGES_GZIP=y ]] && {
|
Firmware_Format=$(if_IMG)
|
||||||
Firmware_Format=img.gz
|
;;
|
||||||
} || Firmware_Format=img
|
mvebu)
|
||||||
|
case "${TARGET_SUBTARGET}" in
|
||||||
|
cortexa53 | cortexa72)
|
||||||
|
Firmware_Format=$(if_IMG)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
octeon | oxnas | pistachio)
|
||||||
|
Firmware_Format=tar
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
[[ ${Author_URL} != false && ${Author_URL} == AUTO ]] && Author_URL=${Github}
|
||||||
|
[[ ${Author_URL} == false ]] && unset Author_URL
|
||||||
|
if [[ ${Default_FLAG} == AUTO ]]
|
||||||
|
then
|
||||||
|
TARGET_FLAG=${CONFIG_FILE/${TARGET_PROFILE}-/}
|
||||||
|
[[ ${TARGET_FLAG} =~ ${TARGET_PROFILE} || -z ${TARGET_FLAG} || ${TARGET_FLAG} == ${CONFIG_FILE} ]] && TARGET_FLAG=Full
|
||||||
|
else
|
||||||
|
if [[ ! ${Default_FLAG} =~ (\"|=|-|_|\.|\#|\|) && ${Default_FLAG} =~ [a-zA-Z0-9] ]]
|
||||||
|
then
|
||||||
|
TARGET_FLAG="${Default_FLAG}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ ! ${Tempoary_FLAG} =~ (\"|=|-|_|\.|\#|\|) && ${Tempoary_FLAG} =~ [a-zA-Z0-9] ]]
|
||||||
|
then
|
||||||
|
TARGET_FLAG="${Tempoary_FLAG}"
|
||||||
|
fi
|
||||||
case "${TARGET_BOARD}" in
|
case "${TARGET_BOARD}" in
|
||||||
x86)
|
x86)
|
||||||
AutoBuild_Firmware="AutoBuild-${OP_REPO}-${TARGET_PROFILE}-${OP_VERSION}-BOOT-SHA256.FORMAT"
|
AutoBuild_Firmware="AutoBuild-${OP_REPO}-${TARGET_PROFILE}-${OP_VERSION}-BOOT-${TARGET_FLAG}-SHA256.FORMAT"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AutoBuild_Firmware="AutoBuild-${OP_REPO}-${TARGET_PROFILE}-${OP_VERSION}-SHA256.FORMAT"
|
AutoBuild_Firmware="AutoBuild-${OP_REPO}-${TARGET_PROFILE}-${OP_VERSION}-${TARGET_FLAG}-SHA256.FORMAT"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cat >> ${GITHUB_ENV} <<EOF
|
cat >> ${GITHUB_ENV} <<EOF
|
||||||
Home=${Home}
|
Home=${Home}
|
||||||
CONFIG_TEMP=${CONFIG_TEMP}
|
CONFIG_TEMP=${CONFIG_TEMP}
|
||||||
|
@ -119,6 +142,7 @@ Github=${Github}
|
||||||
TARGET_PROFILE=${TARGET_PROFILE}
|
TARGET_PROFILE=${TARGET_PROFILE}
|
||||||
TARGET_BOARD=${TARGET_BOARD}
|
TARGET_BOARD=${TARGET_BOARD}
|
||||||
TARGET_SUBTARGET=${TARGET_SUBTARGET}
|
TARGET_SUBTARGET=${TARGET_SUBTARGET}
|
||||||
|
TARGET_FLAG=${TARGET_FLAG}
|
||||||
OP_VERSION=${OP_VERSION}
|
OP_VERSION=${OP_VERSION}
|
||||||
OP_AUTHOR=${OP_AUTHOR}
|
OP_AUTHOR=${OP_AUTHOR}
|
||||||
OP_REPO=${OP_REPO}
|
OP_REPO=${OP_REPO}
|
||||||
|
@ -151,9 +175,6 @@ EOF
|
||||||
cat >> ${Version_File} <<EOF
|
cat >> ${Version_File} <<EOF
|
||||||
|
|
||||||
sed -i '/check_signature/d' /etc/opkg.conf
|
sed -i '/check_signature/d' /etc/opkg.conf
|
||||||
# sed -i 's#mirrors.cloud.tencent.com/lede#downloads.immortalwrt.cnsztl.eu.org#g' /etc/opkg/distfeeds.conf
|
|
||||||
# sed -i 's#18.06.9/##g' /etc/opkg/distfeeds.conf
|
|
||||||
# sed -i 's#releases/#snapshots/#g' /etc/opkg/distfeeds.conf
|
|
||||||
|
|
||||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/aliyundrive-webdav.lua
|
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/aliyundrive-webdav.lua
|
||||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/aliyundrive-webdav/aliyundrive-webdav_log.htm
|
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/aliyundrive-webdav/aliyundrive-webdav_log.htm
|
||||||
|
@ -176,19 +197,37 @@ then
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
sed -i "s?${zzz_Default_Version}?${zzz_Default_Version} @ ${Author} [${Display_Date}]?g" ${Version_File}
|
if [[ -n ${TARGET_FLAG} ]]
|
||||||
|
then
|
||||||
|
sed -i "s?${zzz_Default_Version}?${TARGET_FLAG} ${zzz_Default_Version} @ ${Author} [${Display_Date}]?g" ${Version_File}
|
||||||
|
else
|
||||||
|
sed -i "s?${zzz_Default_Version}?${zzz_Default_Version} @ ${Author} [${Display_Date}]?g" ${Version_File}
|
||||||
|
fi
|
||||||
ECHO "Downloading [ShadowSocksR Plus+] for coolsnowwolf/lede ..."
|
ECHO "Downloading [ShadowSocksR Plus+] for coolsnowwolf/lede ..."
|
||||||
AddPackage git other helloworld fw876 master
|
AddPackage git other helloworld fw876 master
|
||||||
sed -i 's/143/143,8080,8443/' $(PKG_Finder d package luci-app-ssr-plus)/root/etc/init.d/shadowsocksr
|
sed -i 's/143/143,8080,8443/' $(PKG_Finder d package luci-app-ssr-plus)/root/etc/init.d/shadowsocksr
|
||||||
;;
|
;;
|
||||||
immortalwrt/immortalwrt)
|
immortalwrt/immortalwrt)
|
||||||
Copy ${CustomFiles}/Depends/openwrt_release_${OP_AUTHOR} ${BASE_FILES}/etc openwrt_release
|
Copy ${CustomFiles}/Depends/openwrt_release_${OP_AUTHOR} ${BASE_FILES}/etc openwrt_release
|
||||||
sed -i "s?ImmortalWrt?ImmortalWrt @ ${Author} [${Display_Date}]?g" ${Version_File}
|
if [[ -n ${TARGET_FLAG} ]]
|
||||||
|
then
|
||||||
|
sed -i "s?ImmortalWrt?ImmortalWrt ${TARGET_FLAG} @ ${Author} [${Display_Date}]?g" ${Version_File}
|
||||||
|
else
|
||||||
|
sed -i "s?ImmortalWrt?ImmortalWrt @ ${Author} [${Display_Date}]?g" ${Version_File}
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
sed -i "s?By?By ${Author}?g" ${CustomFiles}/Depends/banner
|
sed -i "s?By?By ${Author}?g" ${CustomFiles}/Depends/banner
|
||||||
sed -i "s?Openwrt?Openwrt ${OP_VERSION} / AutoUpdate ${AutoUpdate_Version}?g" ${CustomFiles}/Depends/banner
|
sed -i "s?Openwrt?Openwrt ${OP_VERSION} / AutoUpdate ${AutoUpdate_Version}?g" ${CustomFiles}/Depends/banner
|
||||||
[[ -n ${Banner_Message} ]] && sed -i "s?Powered by AutoBuild-Actions?${Banner_Message}?g" ${CustomFiles}/Depends/banner
|
if [[ -n ${Banner_Message} ]]
|
||||||
|
then
|
||||||
|
if [[ -n ${TARGET_FLAG} ]]
|
||||||
|
then
|
||||||
|
sed -i "s?Powered by AutoBuild-Actions?${Banner_Message} @ ${TARGET_FLAG}?g" ${CustomFiles}/Depends/banner
|
||||||
|
else
|
||||||
|
sed -i "s?Powered by AutoBuild-Actions?${Banner_Message}?g" ${CustomFiles}/Depends/banner
|
||||||
|
fi
|
||||||
|
fi
|
||||||
case "${OP_AUTHOR}/${OP_REPO}" in
|
case "${OP_AUTHOR}/${OP_REPO}" in
|
||||||
immortalwrt/immortalwrt)
|
immortalwrt/immortalwrt)
|
||||||
Copy ${CustomFiles}/Depends/banner ${Home}/$(PKG_Finder d package default-settings)/files openwrt_banner
|
Copy ${CustomFiles}/Depends/banner ${Home}/$(PKG_Finder d package default-settings)/files openwrt_banner
|
||||||
|
@ -271,9 +310,8 @@ EOF
|
||||||
ECHO "[${OP_AUTHOR}]: Current OP_AUTHOR is not supported !"
|
ECHO "[${OP_AUTHOR}]: Current OP_AUTHOR is not supported !"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ ${Author_URL} != false ]]
|
if [[ -n ${Author_URL} ]]
|
||||||
then
|
then
|
||||||
[[ ${Author_URL} == AUTO ]] && Author_URL=${Github}
|
|
||||||
cat >> ${CONFIG_TEMP} <<EOF
|
cat >> ${CONFIG_TEMP} <<EOF
|
||||||
|
|
||||||
CONFIG_KERNEL_BUILD_USER="${Author}"
|
CONFIG_KERNEL_BUILD_USER="${Author}"
|
||||||
|
@ -300,7 +338,12 @@ Firmware_Diy_End() {
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
Process_Firmware ${Firmware_Format}
|
if [[ -n ${Firmware_Format} ]]
|
||||||
|
then
|
||||||
|
Process_Firmware ${Firmware_Format}
|
||||||
|
else
|
||||||
|
Process_Firmware $(List_Format)
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
[[ $(ls) =~ 'AutoBuild-' ]] && {
|
[[ $(ls) =~ 'AutoBuild-' ]] && {
|
||||||
|
@ -322,21 +365,21 @@ Process_Firmware_Core() {
|
||||||
Firmware_Format_Defined=$1
|
Firmware_Format_Defined=$1
|
||||||
shift
|
shift
|
||||||
while [[ $1 ]];do
|
while [[ $1 ]];do
|
||||||
AutoBuild_Firmware=$(Get_Variable AutoBuild_Firmware)
|
Firmware=${AutoBuild_Firmware}
|
||||||
case "${TARGET_BOARD}" in
|
case "${TARGET_BOARD}" in
|
||||||
x86)
|
x86)
|
||||||
[[ $1 =~ efi ]] && {
|
[[ $1 =~ efi ]] && {
|
||||||
FW_Boot_Method=UEFI
|
FW_Boot_Method=UEFI
|
||||||
} || FW_Boot_Method=BIOS
|
} || FW_Boot_Method=BIOS
|
||||||
AutoBuild_Firmware=${AutoBuild_Firmware/BOOT/${FW_Boot_Method}}
|
Firmware=${Firmware/BOOT/${FW_Boot_Method}}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
AutoBuild_Firmware=${AutoBuild_Firmware/SHA256/$(Get_SHA256 $1)}
|
Firmware=${Firmware/SHA256/$(Get_SHA256 $1)}
|
||||||
AutoBuild_Firmware=${AutoBuild_Firmware/FORMAT/${Firmware_Format_Defined}}
|
Firmware=${Firmware/FORMAT/${Firmware_Format_Defined}}
|
||||||
[[ -f $1 ]] && {
|
[[ -f $1 ]] && {
|
||||||
ECHO "Copying [$1] to [${AutoBuild_Firmware}] ..."
|
ECHO "Copying [$1] to [${Firmware}] ..."
|
||||||
cp -a $1 ${AutoBuild_Firmware}
|
cp -a $1 ${Firmware}
|
||||||
} || ECHO "Unable to access [${AutoBuild_Firmware}] ..."
|
} || ECHO "Unable to access [${Firmware}] ..."
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -370,23 +413,18 @@ Get_SHA256() {
|
||||||
List_REGEX | grep "$1" | cut -c1-5
|
List_REGEX | grep "$1" | cut -c1-5
|
||||||
}
|
}
|
||||||
|
|
||||||
Get_Variable() {
|
|
||||||
local Result="$(grep "$1" ${ENV_FILE} | grep -v "#" | awk -F '=' '{print $2}')"
|
|
||||||
if [[ -n ${Result} ]]
|
|
||||||
then
|
|
||||||
eval echo "${Result}"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_Branch() {
|
GET_Branch() {
|
||||||
git -C $(pwd) rev-parse --abbrev-ref HEAD | grep -v HEAD || \
|
git -C $(pwd) rev-parse --abbrev-ref HEAD | grep -v HEAD || \
|
||||||
git -C $(pwd) describe --exact-match HEAD || \
|
git -C $(pwd) describe --exact-match HEAD || \
|
||||||
git -C $(pwd) rev-parse HEAD
|
git -C $(pwd) rev-parse HEAD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if_IMG() {
|
||||||
|
[[ $(cat ${CONFIG_TEMP}) =~ CONFIG_TARGET_IMAGES_GZIP=y ]] && {
|
||||||
|
echo img.gz
|
||||||
|
} || echo img
|
||||||
|
}
|
||||||
|
|
||||||
ECHO() {
|
ECHO() {
|
||||||
echo "[$(date "+%H:%M:%S")] $*"
|
echo "[$(date "+%H:%M:%S")] $*"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# AutoUpdate for Openwrt
|
# AutoUpdate for Openwrt
|
||||||
# Dependences: wget-ssl/wget/uclient-fetch curl jq expr sysupgrade
|
# Dependences: wget-ssl/wget/uclient-fetch curl jq expr sysupgrade
|
||||||
|
|
||||||
Version=V6.8.1
|
Version=V6.8.2
|
||||||
|
|
||||||
function TITLE() {
|
function TITLE() {
|
||||||
clear && echo "Openwrt-AutoUpdate Script by Hyy2001 ${Version}"
|
clear && echo "Openwrt-AutoUpdate Script by Hyy2001 ${Version}"
|
||||||
|
@ -36,6 +36,8 @@ function SHELL_HELP() {
|
||||||
-B, --boot-mode <TYPE> 指定 x86 设备下载 <TYPE> 引导的固件 (e.g. UEFI BIOS)
|
-B, --boot-mode <TYPE> 指定 x86 设备下载 <TYPE> 引导的固件 (e.g. UEFI BIOS)
|
||||||
-C <Github URL> 更改 Github 地址为提供的 <Github URL>
|
-C <Github URL> 更改 Github 地址为提供的 <Github URL>
|
||||||
--api 打印 Github API 内容
|
--api 打印 Github API 内容
|
||||||
|
--flag <FLAG> 更改固件标签为提供的 <FLAG>
|
||||||
|
--flag reset 恢复默认的固件标签
|
||||||
--help 打印 AutoUpdate 帮助信息
|
--help 打印 AutoUpdate 帮助信息
|
||||||
--log < | del> <打印 | 删除> AutoUpdate 历史运行日志
|
--log < | del> <打印 | 删除> AutoUpdate 历史运行日志
|
||||||
--log --path <PATH> 更改 AutoUpdate 运行日志路径为提供的绝对路径 <PATH>
|
--log --path <PATH> 更改 AutoUpdate 运行日志路径为提供的绝对路径 <PATH>
|
||||||
|
@ -45,7 +47,6 @@ function SHELL_HELP() {
|
||||||
--chk 检查 AutoUpdate 运行环境
|
--chk 检查 AutoUpdate 运行环境
|
||||||
--clean 清理 AutoUpdate 缓存
|
--clean 清理 AutoUpdate 缓存
|
||||||
--fw-log < | *> 打印 <当前 | 指定> 版本的固件更新日志
|
--fw-log < | *> 打印 <当前 | 指定> 版本的固件更新日志
|
||||||
--fw-list 打印所有云端固件名称
|
|
||||||
--list 打印当前系统信息
|
--list 打印当前系统信息
|
||||||
--var <VARIABLE> 打印用户指定的环境变量 <VARIABLE>
|
--var <VARIABLE> 打印用户指定的环境变量 <VARIABLE>
|
||||||
--verbose 打印详细下载信息 *
|
--verbose 打印详细下载信息 *
|
||||||
|
@ -313,6 +314,12 @@ function LOAD_VARIABLE() {
|
||||||
[[ ! ${TARGET_PROFILE} ]] && eval TARGET_PROFILE="$(jq .model.id /etc/board.json 2> /dev/null)"
|
[[ ! ${TARGET_PROFILE} ]] && eval TARGET_PROFILE="$(jq .model.id /etc/board.json 2> /dev/null)"
|
||||||
[[ ! ${TARGET_PROFILE} || ${TARGET_PROFILE} == null ]] && ECHO r "当前设备名称获取失败!" && EXIT 1
|
[[ ! ${TARGET_PROFILE} || ${TARGET_PROFILE} == null ]] && ECHO r "当前设备名称获取失败!" && EXIT 1
|
||||||
[[ ! ${OP_VERSION} ]] && OP_VERSION="未知"
|
[[ ! ${OP_VERSION} ]] && OP_VERSION="未知"
|
||||||
|
if [[ $(LIST_ENV 1) =~ TARGET_FLAG ]]
|
||||||
|
then
|
||||||
|
[[ -z ${TARGET_FLAG} ]] && TARGET_FLAG="Full"
|
||||||
|
else
|
||||||
|
unset TARGET_FLAG
|
||||||
|
fi
|
||||||
DISTRIB_TARGET="$(GET_VARIABLE DISTRIB_TARGET /etc/openwrt_release)"
|
DISTRIB_TARGET="$(GET_VARIABLE DISTRIB_TARGET /etc/openwrt_release)"
|
||||||
TARGET_BOARD="$(echo ${DISTRIB_TARGET} | cut -d '/' -f1)"
|
TARGET_BOARD="$(echo ${DISTRIB_TARGET} | cut -d '/' -f1)"
|
||||||
TARGET_SUBTARGET="$(echo ${DISTRIB_TARGET} | cut -d '/' -f2)"
|
TARGET_SUBTARGET="$(echo ${DISTRIB_TARGET} | cut -d '/' -f2)"
|
||||||
|
@ -374,6 +381,29 @@ function CHANGE_BOOT() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CHANGE_FLAG() {
|
||||||
|
case $1 in
|
||||||
|
reset)
|
||||||
|
EDIT_VARIABLE rm ${Custom_Variable} TARGET_FLAG
|
||||||
|
ECHO y "固件标签已恢复为默认!"
|
||||||
|
ECHO y "当前固件标签: [$(GET_VARIABLE TARGET_FLAG ${Default_Variable})]"
|
||||||
|
EXIT 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ ! $1 =~ (\"|=|-|_|\.|\#|\|) && $1 =~ [a-zA-Z0-9] ]]
|
||||||
|
then
|
||||||
|
EDIT_VARIABLE edit ${Custom_Variable} TARGET_FLAG $1
|
||||||
|
ECHO r "警告: 修改此设置后更新固件后可能导致无法检测到更新!"
|
||||||
|
ECHO y "固件标签已指定为: [$1]"
|
||||||
|
EXIT 0
|
||||||
|
else
|
||||||
|
ECHO r "错误的参数: [$1], 当前仅支持 [a-zA-Z0-9] 且不能包含 <\" = - _ # |> 等特殊字符!"
|
||||||
|
EXIT 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
function UPDATE_SCRIPT() {
|
function UPDATE_SCRIPT() {
|
||||||
if [[ ! -d $1 ]];then
|
if [[ ! -d $1 ]];then
|
||||||
mkdir -p $1 2> /dev/null || {
|
mkdir -p $1 2> /dev/null || {
|
||||||
|
@ -492,6 +522,34 @@ function ANALYZE_API() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GET_FW_INFO() {
|
||||||
|
local Info Type Result
|
||||||
|
[[ ! -s ${API_File} ]] && {
|
||||||
|
ECHO r "未检测到 API 文件!"
|
||||||
|
EXIT 1
|
||||||
|
}
|
||||||
|
Info=$(grep "AutoBuild-${OP_REPO}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot_Method}" | grep "${TARGET_FLAG}" | awk 'BEGIN {MAX = 0} {if ($6+0 > MAX+0) {MAX=$6 ;content=$0} } END {print content}')
|
||||||
|
Result="$(echo "${Info}" | awk '{print $"'${1}'"}' 2> /dev/null)"
|
||||||
|
case $1 in
|
||||||
|
1) Type="固件名称";;
|
||||||
|
2) Type="固件格式";;
|
||||||
|
3) Type="下载次数";;
|
||||||
|
4) Type="校验信息";;
|
||||||
|
5) Type="固件版本";;
|
||||||
|
6) Type="发布日期";;
|
||||||
|
7) Type="固件体积";;
|
||||||
|
8) Type="固件链接";;
|
||||||
|
*) Type="未定义信息";;
|
||||||
|
esac
|
||||||
|
[[ ! ${Result} == "-" ]] && {
|
||||||
|
LOGGER "${Type}: ${Result}"
|
||||||
|
echo -e "${Result}"
|
||||||
|
} || {
|
||||||
|
LOGGER "${Type}获取失败!"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function GET_CLOUD_LOG() {
|
function GET_CLOUD_LOG() {
|
||||||
local Version log_Test
|
local Version log_Test
|
||||||
[[ ! $(cat ${API_File} 2> /dev/null) =~ Update_Logs.json ]] && {
|
[[ ! $(cat ${API_File} 2> /dev/null) =~ Update_Logs.json ]] && {
|
||||||
|
@ -524,39 +582,6 @@ function GET_CLOUD_LOG() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function GET_FW_INFO() {
|
|
||||||
local Info Type Result
|
|
||||||
[[ ! -s ${API_File} ]] && {
|
|
||||||
ECHO r "未检测到 API 文件!"
|
|
||||||
EXIT 1
|
|
||||||
}
|
|
||||||
if [[ $1 == "-a" ]];then
|
|
||||||
Info=$(grep "AutoBuild-${OP_REPO}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot_Method}" | uniq)
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
Info=$(grep "AutoBuild-${OP_REPO}-${TARGET_PROFILE}" ${API_File} | grep "${x86_Boot_Method}" | awk 'BEGIN {MAX = 0} {if ($6+0 > MAX+0) {MAX=$6 ;content=$0} } END {print content}')
|
|
||||||
fi
|
|
||||||
Result="$(echo "${Info}" | awk '{print $"'${1}'"}' 2> /dev/null)"
|
|
||||||
case $1 in
|
|
||||||
1) Type="固件名称";;
|
|
||||||
2) Type="固件格式";;
|
|
||||||
3) Type="下载次数";;
|
|
||||||
4) Type="校验信息";;
|
|
||||||
5) Type="固件版本";;
|
|
||||||
6) Type="发布日期";;
|
|
||||||
7) Type="固件体积";;
|
|
||||||
8) Type="固件链接";;
|
|
||||||
*) Type="未定义信息";;
|
|
||||||
esac
|
|
||||||
[[ ! ${Result} == "-" ]] && {
|
|
||||||
LOGGER "获取${Type}: ${Result}"
|
|
||||||
echo -e "${Result}"
|
|
||||||
} || {
|
|
||||||
LOGGER "[GET_FW_INFO] ${Type}获取失败!"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function UPGRADE() {
|
function UPGRADE() {
|
||||||
TITLE
|
TITLE
|
||||||
[[ $* =~ -f && $* =~ -F ]] && SHELL_HELP
|
[[ $* =~ -f && $* =~ -F ]] && SHELL_HELP
|
||||||
|
@ -1153,17 +1178,22 @@ function AutoUpdate_Main() {
|
||||||
;;
|
;;
|
||||||
--env-list)
|
--env-list)
|
||||||
shift
|
shift
|
||||||
[[ ! $* ]] && LIST_ENV 0 && EXIT 0
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
1 | 2)
|
1 | 2)
|
||||||
LIST_ENV $1
|
LIST_ENV $1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
SHELL_HELP
|
LIST_ENV 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
EXIT
|
EXIT
|
||||||
;;
|
;;
|
||||||
|
--flag)
|
||||||
|
shift
|
||||||
|
[[ -z $* ]] && SHELL_HELP
|
||||||
|
CHANGE_FLAG $1
|
||||||
|
EXIT
|
||||||
|
;;
|
||||||
-V)
|
-V)
|
||||||
shift
|
shift
|
||||||
[[ ! $* ]] && echo "${OP_VERSION}" && EXIT 0
|
[[ ! $* ]] && echo "${OP_VERSION}" && EXIT 0
|
||||||
|
@ -1250,11 +1280,6 @@ function AutoUpdate_Main() {
|
||||||
LOG $*
|
LOG $*
|
||||||
EXIT
|
EXIT
|
||||||
;;
|
;;
|
||||||
--fw-list)
|
|
||||||
ANALYZE_API
|
|
||||||
GET_FW_INFO -a 1
|
|
||||||
EXIT
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
SHELL_HELP
|
SHELL_HELP
|
||||||
EXIT
|
EXIT
|
||||||
|
|
Loading…
Reference in New Issue