Fix upgrade error

This commit is contained in:
Hyy2001X 2020-09-27 00:57:50 +08:00 committed by GitHub
parent 7c2ba2cae6
commit a0bcdcfe34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 12 deletions

View File

@ -4,10 +4,8 @@
# AutoUpdate # AutoUpdate
Author=Hyy2001 Author=Hyy2001
Version=V3.0 Version=V3.1
Updated=2020.09.25
TARGET_PROFILE=d-team_newifi-d2 TARGET_PROFILE=d-team_newifi-d2
FIRMWARE_SUFFIX=bin
Github=https://github.com/Hyy2001X/AutoBuild-Actions Github=https://github.com/Hyy2001X/AutoBuild-Actions
function TIME() { function TIME() {
@ -18,16 +16,11 @@ Github_Tags=$Github/releases/tag/AutoUpdate
Github_Download=$Github/releases/download/AutoUpdate Github_Download=$Github/releases/download/AutoUpdate
clear && echo "Auto-Update Script $Version by $Author" clear && echo "Auto-Update Script $Version by $Author"
cd /etc cd /etc
CURRENT_VERSION=`cat ./openwrt_date 2> /dev/null` CURRENT_VERSION=`awk 'NR==1' ./openwrt_date`
if [ "$CURRENT_VERSION" == "" ]; then if [ "$CURRENT_VERSION" == "" ]; then
echo -e "\n警告:当前固件版本获取失败!" echo -e "\n警告:当前固件版本获取失败!"
CURRENT_VERSION=未知 CURRENT_VERSION=未知
fi fi
CURRENT_DEVICE=`cat ./openwrt_device 2> /dev/null | awk 'NR==1'`
if [ "$CURRENT_DEVICE" == "" ]; then
echo -e "\n警告:当前设备名称获取失败,使用预设名称[$TARGET_PROFILE]"
CURRENT_DEVICE=$TARGET_PROFILE
fi
cd /tmp cd /tmp
TIME && echo "正在获取云端固件版本..." TIME && echo "正在获取云端固件版本..."
GET_Version=`wget --no-check-certificate -q $Github_Tags -O - | egrep -o 'R[0-9]+.[0-9]+.[0-9]+.[0-9]+' | awk 'NR==1'` GET_Version=`wget --no-check-certificate -q $Github_Tags -O - | egrep -o 'R[0-9]+.[0-9]+.[0-9]+.[0-9]+' | awk 'NR==1'`
@ -52,8 +45,8 @@ if [ $CURRENT_VERSION == $GET_Version ];then
exit exit
esac esac
fi fi
Firmware_Info="AutoBuild-${CURRENT_DEVICE}-Lede-${GET_Version}" Firmware_Info="AutoBuild-${TARGET_PROFILE}-Lede-${GET_Version}"
Firmware="${Firmware_Info}.${FIRMWARE_SUFFIX}" Firmware="${Firmware_Info}.bin"
Firmware_Detail="${Firmware_Info}.detail" Firmware_Detail="${Firmware_Info}.detail"
echo "云端固件名称:$Firmware" echo "云端固件名称:$Firmware"
Google_Check=`curl -I -s --connect-timeout 5 www.google.com -w %{http_code} | tail -n1` Google_Check=`curl -I -s --connect-timeout 5 www.google.com -w %{http_code} | tail -n1`
@ -88,4 +81,4 @@ fi
TIME && echo "MD5对比通过,准备升级固件..." TIME && echo "MD5对比通过,准备升级固件..."
sleep 3 sleep 3
TIME && echo -e "开始升级固件,请耐心等待...\n" TIME && echo -e "开始升级固件,请耐心等待...\n"
sysupgrade $Firmware sysupgrade $Firmware