Update AutoUpdate.sh

This commit is contained in:
Hyy2001X 2020-09-27 01:14:39 +08:00 committed by GitHub
parent 04d8ced4df
commit 7417e3d13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -3,8 +3,7 @@
# AutoBuild Module by Hyy2001 # AutoBuild Module by Hyy2001
# AutoUpdate # AutoUpdate
Author=Hyy2001 Version=V3.2-b
Version=V3.1
TARGET_PROFILE=d-team_newifi-d2 TARGET_PROFILE=d-team_newifi-d2
Github=https://github.com/Hyy2001X/AutoBuild-Actions Github=https://github.com/Hyy2001X/AutoBuild-Actions
@ -14,13 +13,18 @@ echo -ne "\n[$(date "+%H:%M:%S")] "
Github_Tags=$Github/releases/tag/AutoUpdate 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 "Openwrt-AutoUpdate Script $Version"
cd /etc cd /etc
CURRENT_VERSION=`awk 'NR==1' ./openwrt_date` CURRENT_VERSION=`awk 'NR==1' ./openwrt_info > /dev/null 2>&1`
if [ "$CURRENT_VERSION" == "" ]; then if [ "$CURRENT_VERSION" == "" ]; then
echo -e "\n警告:当前固件版本获取失败!" echo -e "\n警告:当前固件版本获取失败!"
CURRENT_VERSION=未知 CURRENT_VERSION=未知
fi fi
CURRENT_DEVICE=`awk 'NR==2' ./openwrt_info > /dev/null 2>&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'`
@ -45,7 +49,7 @@ if [ $CURRENT_VERSION == $GET_Version ];then
exit exit
esac esac
fi fi
Firmware_Info="AutoBuild-${TARGET_PROFILE}-Lede-${GET_Version}" Firmware_Info="AutoBuild-${CURRENT_DEVICE}-Lede-${GET_Version}"
Firmware="${Firmware_Info}.bin" Firmware="${Firmware_Info}.bin"
Firmware_Detail="${Firmware_Info}.detail" Firmware_Detail="${Firmware_Info}.detail"
echo "云端固件名称:$Firmware" echo "云端固件名称:$Firmware"