From be782102ace6fee024c1afde103610e16f0d8a83 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Sat, 3 Oct 2020 02:04:28 +0800 Subject: [PATCH] Bump to V3.6 --- Customize/AutoUpdate.sh | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Customize/AutoUpdate.sh b/Customize/AutoUpdate.sh index bcea761..b4a1d4c 100644 --- a/Customize/AutoUpdate.sh +++ b/Customize/AutoUpdate.sh @@ -3,7 +3,7 @@ # AutoBuild Module by Hyy2001 # AutoUpdate -Version=V3.5 +Version=V3.6 DEFAULT_DEVICE=d-team_newifi-d2 Github=https://github.com/Hyy2001X/AutoBuild-Actions @@ -17,20 +17,18 @@ cd /etc CURRENT_VERSION=`awk 'NR==1' ./openwrt_info` CURRENT_DEVICE=`jsonfilter -e '@.model.id' < "/etc/board.json" | tr ',' '_'` clear && echo "Openwrt-AutoUpdate Script $Version" -if [[ ! $1 == "" ]];then - Upgrade_Option="$1" - [ "$Upgrade_Option" == "-n" ] && TIME && echo "不保留配置升级." +if [[ $1 == "" ]];then + Upgrade_Option="-q" && TIME && echo "执行: 保留配置升级" else - Upgrade_Option="-q" + Upgrade_Option="$1" + [ "$Upgrade_Option" == "-n" ] && TIME && echo "执行: 不保留配置升级" + if [ "$Upgrade_Option" == "-x" ];then + Upgrade_Option="-q" + Force_Update=1 + TIME && echo "执行: 保留配置强制升级" + fi fi -opkg list | awk '{print $1}' > /tmp/Package_list -grep "curl" /tmp/Package_list > /dev/null 2>&1 -if [ ! $? -ne 0 ];then - Google_Check=`curl -I -s --connect-timeout 5 www.google.com -w %{http_code} | tail -n1` - [ ! "$Google_Check" == 200 ] && TIME && echo "Google 连接失败,可能导致固件下载速度缓慢!" -fi -grep "wget" /tmp/Package_list > /dev/null 2>&1 -[ $? -ne 0 ] && TIME && echo "未安装 wget!请先执行[opkg update && opkg install wget]" && exit + if [ "$CURRENT_VERSION" == "" ];then echo -e "\n警告:当前固件版本获取失败!" CURRENT_VERSION=未知 @@ -48,14 +46,16 @@ if [ "$GET_Version" == "" ];then fi echo -e "\n当前固件版本:$CURRENT_VERSION" echo -e "云端固件版本:$GET_Version\n" -if [ $CURRENT_VERSION == $GET_Version ];then - read -p "已是最新版本,是否强制更新固件?[Y/n]:" Choose - if [ $Choose == Y ] || [ $Choose == y ];then - TIME && echo -e "开始强制更新固件...\n" - else - TIME && echo "用户已取消强制更新,即将退出更新程序..." - sleep 2 - exit +if [[ ! $Force_Update == 1 ]];then + if [ $CURRENT_VERSION == $GET_Version ];then + read -p "已是最新版本,是否强制更新固件?[Y/n]:" Choose + if [ $Choose == Y ] || [ $Choose == y ];then + TIME && echo -e "开始强制更新固件...\n" + else + TIME && echo "用户已取消强制更新,即将退出更新程序..." + sleep 2 + exit + fi fi fi Firmware_Info="AutoBuild-${CURRENT_DEVICE}-Lede-${GET_Version}" @@ -90,4 +90,4 @@ fi TIME && echo "MD5对比通过!" sleep 3 TIME && echo -e "开始升级固件,请耐心等待...\n" -sysupgrade ${Upgrade_Option} $Firmware \ No newline at end of file +sysupgrade ${Upgrade_Option} $Firmware