diff --git a/UnblockNeteaseMusic/Makefile b/UnblockNeteaseMusic/Makefile index 9be7ac3dd..d9885d78a 100644 --- a/UnblockNeteaseMusic/Makefile +++ b/UnblockNeteaseMusic/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=UnblockNeteaseMusic PKG_BASE_VERSION:=0.27.0-rc.4 -PKG_RELEASE:=58 +PKG_RELEASE:=59 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/UnblockNeteaseMusic/server.git PKG_SOURCE_DATE:=2021-12-21 -PKG_SOURCE_VERSION:=982c921e1861714685e046a7d9a17d1af749693b +PKG_SOURCE_VERSION:=217831d3f3d61aa8c8b33057fa0a8d4255f9b752 PKG_MIRROR_HASH:=skip PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION)) diff --git a/luci-app-easyupdate/root/usr/bin/easyupdate.sh b/luci-app-easyupdate/root/usr/bin/easyupdate.sh old mode 100644 new mode 100755 index 3c3d2f1e9..6f48f74b6 --- a/luci-app-easyupdate/root/usr/bin/easyupdate.sh +++ b/luci-app-easyupdate/root/usr/bin/easyupdate.sh @@ -4,21 +4,26 @@ function checkEnv() { if !type sysupgrade >/dev/null 2>&1; then - echo 'Your firmware does not contain sysupgrade and does not support automatic updates(您的固件未包含sysupgrade,暂不支持自动更新)' + writeLog 'Your firmware does not contain sysupgrade and does not support automatic updates(您的固件未包含sysupgrade,暂不支持自动更新)' exit fi } +function writeLog() { + now_time='['$(date +"%Y-%m-%d %H:%M:%S")']' + echo ${now_time} $1 | tee -a '/tmp/easyupdatemain.log' +} + function shellHelp() { checkEnv cat </tmp/easyupdate.log 2>&1 & } @@ -63,9 +68,9 @@ function downCloudVer() { function flashFirmware() { checkEnv if [[ -z "$file" ]]; then - echo 'Please specify the file name(请指定文件名)' + writeLog 'Please specify the file name(请指定文件名)' else - echo 'Get whether to save the configuration(读取是否保存配置)' + writeLog 'Get whether to save the configuration(读取是否保存配置)' keepconfig=$(uci get easyupdate.main.keepconfig) if [ $keepconfig -eq 1 ]; then keepconfig=' ' @@ -74,14 +79,65 @@ function flashFirmware() { keepconfig='-n ' res='no' fi - echo "Whether to save the configuration(读取是否保存配置):$res" - echo 'Start flash firmware, log output in /tmp/easyupdate.log(开始刷写固件,日志输出在/tmp/easyupdate.log)' + writeLog "Whether to save the configuration(读取是否保存配置):$res" + writeLog 'Start flash firmware, log output in /tmp/easyupdate.log(开始刷写固件,日志输出在/tmp/easyupdate.log)' sysupgrade $keepconfig$file >/tmp/easyupdate.log 2>&1 & fi } function updateCloud() { checkEnv + writeLog 'Get the local firmware version(获取本地固件版本)' + lFirVer=$(cat /etc/openwrt_release | sed -n "s/DISTRIB_VERSIONS='\(.*\)'/\1/p") + writeLog "Local firmware version(本地固件版本):$lFirVer" + writeLog 'Get the cloud firmware version(获取云端固件版本)' + cFirVer=$(getCloudVer) + writeLog "Cloud firmware version(云端固件版本):$cFirVer" + lFirVer=$(date -d "${lFirVer:0:4}-${lFirVer:4:2}-${lFirVer:6:2} ${lFirVer:9:2}:${lFirVer:11:2}:${lFirVer:13:2}" +%s) + cFirVer=$(date -d "${cFirVer:0:4}-${cFirVer:4:2}-${cFirVer:6:2} ${cFirVer:9:2}:${cFirVer:11:2}:${cFirVer:13:2}" +%s) + if [ $cFirVer -gt $lFirVer ]; then + writeLog 'Need to be updated(需要更新)' + downCloudVer + i=0 + while [ $i -le 100 ]; do + log=$(cat /tmp/easyupdate.log) + str=' error' + if [[ $log =~ $str ]]; then + writeLog 'Download error(下载出错)' + i=101 + break + else + str='Connection reset' + if [[ $log =~ $str ]]; then + writeLog 'Download error(下载出错)' + i=101 + break + else + str='Download completed' + if [[ $log =~ $str ]]; then + writeLog 'Download completes(下载完成)' + i=100 + break + else + echo $log | sed -n '$p' + if [[ $i -eq 99 ]]; then + writeLog 'Download the timeout(下载超时)' + break + fi + fi + fi + fi + i++ + sleep 3 + done + if [[ $i -eq 100 ]]; then + writeLog 'Prepare flash firmware(准备刷写固件)' + file=$(cat /tmp/easyupdate.log | sed -n "s/Writing to '\(.*\)'/\1/p") + flashFirmware + fi + else + writeLog "Is the latest(已是最新)" + fi } if [[ -z "$1" ]]; then @@ -105,4 +161,4 @@ else shellHelp ;; esac -fi \ No newline at end of file +fi