V6.8.5 适配 luci-app-autoupdate V2.2-1

This commit is contained in:
Hyy2001X 2022-01-04 14:12:44 +08:00
parent 4ec9938137
commit 5498c73c1f
1 changed files with 23 additions and 8 deletions

View File

@ -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.4 Version=V6.8.5
function TITLE() { function TITLE() {
clear && echo "Openwrt-AutoUpdate Script by Hyy2001 ${Version}" clear && echo "Openwrt-AutoUpdate Script by Hyy2001 ${Version}"
@ -351,7 +351,7 @@ function CHANGE_GITHUB() {
then then
uci set autoupdate.@autoupdate[0].github="$1" 2> /dev/null uci set autoupdate.@autoupdate[0].github="$1" 2> /dev/null
uci commit autoupdate uci commit autoupdate
LOGGER "UCI 地址已修改为 [$1]" LOGGER "UCI Github 地址已修改为 [$1]"
fi fi
if [[ ! ${Github} == $1 ]] if [[ ! ${Github} == $1 ]]
then then
@ -374,7 +374,7 @@ function CHANGE_BOOT() {
UEFI | BIOS) UEFI | BIOS)
EDIT_VARIABLE edit ${Custom_Variable} x86_Boot_Method $1 EDIT_VARIABLE edit ${Custom_Variable} x86_Boot_Method $1
ECHO r "警告: 修改此设置后更新固件后可能导致设备无法启动!" ECHO r "警告: 修改此设置后更新固件后可能导致设备无法启动!"
ECHO y "固件引导格式已指定为: [$1]" ECHO y "固件引导格式已修改为: $1"
EXIT 0 EXIT 0
;; ;;
*) *)
@ -388,16 +388,30 @@ function CHANGE_FLAG() {
case $1 in case $1 in
reset) reset)
EDIT_VARIABLE rm ${Custom_Variable} TARGET_FLAG EDIT_VARIABLE rm ${Custom_Variable} TARGET_FLAG
uci set autoupdate.@autoupdate[0].flag="$(GET_VARIABLE TARGET_FLAG ${Default_Variable})" 2> /dev/null
uci commit autoupdate
ECHO y "固件标签已恢复为默认!" ECHO y "固件标签已恢复为默认!"
ECHO y "当前固件标签: [$(GET_VARIABLE TARGET_FLAG ${Default_Variable})]" ECHO y "当前固件标签: $(GET_VARIABLE TARGET_FLAG ${Default_Variable})"
EXIT 0 EXIT 0
;; ;;
*) *)
if [[ ! $1 =~ (\"|=|-|_|\.|\#|\|) && $1 =~ [a-zA-Z0-9] ]] if [[ ! $1 =~ (\"|=|-|_|\.|\#|\|) && $1 =~ [a-zA-Z0-9] ]]
then then
EDIT_VARIABLE edit ${Custom_Variable} TARGET_FLAG $1 UCI_Flag="$(uci get autoupdate.@autoupdate[0].flag 2> /dev/null)"
ECHO r "警告: 修改此设置后更新固件后可能导致无法检测到更新!" if [[ ${UCI_Flag} && ! ${UCI_Flag} == $1 ]]
ECHO y "固件标签已指定为: [$1]" then
uci set autoupdate.@autoupdate[0].flag="$1" 2> /dev/null
uci commit autoupdate
LOGGER "UCI 固件标签已修改为: $1"
fi
if [[ ! ${TARGET_FLAG} == $1 ]]
then
EDIT_VARIABLE edit ${Custom_Variable} TARGET_FLAG $1
ECHO r "警告: 修改此设置后可能导致无法检测到更新!"
ECHO y "固件标签已修改为: $1"
else
ECHO g "固件标签未修改!"
fi
EXIT 0 EXIT 0
else else
ECHO r "错误的参数: [$1], 当前仅支持 [a-zA-Z0-9] 且不能包含 <\" = - _ # |> 等特殊字符!" ECHO r "错误的参数: [$1], 当前仅支持 [a-zA-Z0-9] 且不能包含 <\" = - _ # |> 等特殊字符!"
@ -1194,7 +1208,7 @@ function AutoUpdate_Main() {
;; ;;
--flag) --flag)
shift shift
[[ -z $* ]] && SHELL_HELP [[ -z $* || $# != 1 ]] && SHELL_HELP
CHANGE_FLAG $1 CHANGE_FLAG $1
EXIT EXIT
;; ;;
@ -1272,6 +1286,7 @@ function AutoUpdate_Main() {
;; ;;
-C) -C)
shift shift
[[ -z $* || $# != 1 ]] && SHELL_HELP
CHANGE_GITHUB $* CHANGE_GITHUB $*
EXIT EXIT
;; ;;