修复 X86_64 支持,移除更新到 稳定版 功能

This commit is contained in:
Hyy2001X 2021-02-21 20:23:35 +08:00
parent 431644a4a8
commit b43693c961
3 changed files with 159 additions and 167 deletions

View File

@ -1,22 +1,39 @@
CONFIG_TARGET_ramips=y CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_d-team_newifi-d2=y CONFIG_TARGET_ramips_mt7621_DEVICE_d-team_newifi-d2=y
CONFIG_BUILD_PATENTED=y
# IPv6 相关
CONFIG_IPV6=y CONFIG_IPV6=y
CONFIG_KERNEL_IPV6=y CONFIG_KERNEL_IPV6=y
# CONFIG_PACKAGE_luci-app-arpbind is not set CONFIG_PACKAGE_ipv6helper=y
# CONFIG_PACKAGE_luci-app-mtwifi is not set CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y
# CONFIG_PACKAGE_luci-app-rclone_INCLUDE_fuse-utils is not set CONFIG_PACKAGE_6rd=y
# CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-ng is not set CONFIG_PACKAGE_6to4=y
# CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-webui is not set
# CONFIG_PACKAGE_mt_wifi is not set # 加密相关
# CONFIG_PACKAGE_kmod-mt7603e is not set
# CONFIG_PACKAGE_kmod-mt76x2e is not set
CONFIG_BUILD_PATENTED=y
CONFIG_PACKAGE_kmod-crypto-gcm=y CONFIG_PACKAGE_kmod-crypto-gcm=y
CONFIG_PACKAGE_kmod-crypto-md5=y CONFIG_PACKAGE_kmod-crypto-md5=y
CONFIG_PACKAGE_kmod-crypto-sha256=y CONFIG_PACKAGE_kmod-crypto-sha256=y
CONFIG_PACKAGE_luci-ssl-openssl=y
# Wireless 驱动程序
CONFIG_PACKAGE_kmod-mt76=y CONFIG_PACKAGE_kmod-mt76=y
CONFIG_PACKAGE_kmod-tun=y # CONFIG_PACKAGE_luci-app-mtwifi is not set
# CONFIG_PACKAGE_mt_wifi is not set
# CONFIG_PACKAGE_kmod-mt7603e is not set
# CONFIG_PACKAGE_kmod-mt76x2e is not set
CONFIG_PACKAGE_wpad=y
# USB 相关
CONFIG_PACKAGE_automount=y
CONFIG_PACKAGE_e2fsprogs=y
CONFIG_PACKAGE_luci-app-usb3disable=y
CONFIG_PACKAGE_luci-app-hd-idle=y
CONFIG_PACKAGE_luci-app-usb-printer=y
## USB 网络共享
CONFIG_PACKAGE_kmod-usb-net=y CONFIG_PACKAGE_kmod-usb-net=y
CONFIG_PACKAGE_kmod-usb-net-asix=y CONFIG_PACKAGE_kmod-usb-net-asix=y
CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y
@ -27,27 +44,47 @@ CONFIG_PACKAGE_kmod-usb-net-ipheth=y
CONFIG_PACKAGE_kmod-usb-net-kalmia=y CONFIG_PACKAGE_kmod-usb-net-kalmia=y
CONFIG_PACKAGE_kmod-usb-net-kaweth=y CONFIG_PACKAGE_kmod-usb-net-kaweth=y
CONFIG_PACKAGE_kmod-usb-net-rndis=y CONFIG_PACKAGE_kmod-usb-net-rndis=y
CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y CONFIG_PACKAGE_libudev-fbsd=y
CONFIG_PACKAGE_automount=y CONFIG_PACKAGE_usbutils=y
## USB 网络存储
CONFIG_PACKAGE_autosamba=y CONFIG_PACKAGE_autosamba=y
CONFIG_PACKAGE_ipv6helper=y CONFIG_PACKAGE_luci-app-samba=y
CONFIG_PACKAGE_luci-ssl-openssl=y CONFIG_PACKAGE_luci-app-vsftpd=y
# 主题包
CONFIG_PACKAGE_luci-theme-argon=y CONFIG_PACKAGE_luci-theme-argon=y
CONFIG_PACKAGE_luci-app-argon-config=y
# DDNS 相关
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_ddns-scripts_aliyun=y
CONFIG_PACKAGE_ddns-scripts_dnspod=y
CONFIG_PACKAGE_ddns-scripts_cloudflare.com-v4=y
CONFIG_PACKAGE_ddns-scripts_freedns_42_pl=y
CONFIG_PACKAGE_ddns-scripts_godaddy.com-v1=y
CONFIG_PACKAGE_ddns-scripts_no-ip_com=y
CONFIG_PACKAGE_ddns-scripts_nsupdate=y
CONFIG_PACKAGE_ddns-scripts_route53-v1=y
## Download Manager
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_wget=y
# CONFIG_PACKAGE_luci-app-rclone_INCLUDE_fuse-utils is not set
# CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-ng is not set
# CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-webui is not set
# LUCI Appliciations
CONFIG_PACKAGE_luci-app-accesscontrol=y CONFIG_PACKAGE_luci-app-accesscontrol=y
CONFIG_PACKAGE_luci-app-adbyby-plus=y CONFIG_PACKAGE_luci-app-adbyby-plus=y
CONFIG_PACKAGE_luci-app-adguardhome=y CONFIG_PACKAGE_luci-app-adguardhome=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-autoupdate=y CONFIG_PACKAGE_luci-app-autoupdate=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-filetransfer=y CONFIG_PACKAGE_luci-app-filetransfer=y
# CONFIG_PACKAGE_luci-app-frpc is not set
CONFIG_PACKAGE_luci-app-hd-idle=y
CONFIG_PACKAGE_luci-app-mwan3=y CONFIG_PACKAGE_luci-app-mwan3=y
CONFIG_PACKAGE_luci-app-mwan3helper=y CONFIG_PACKAGE_luci-app-mwan3helper=y
CONFIG_PACKAGE_luci-app-nlbwmon=y CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-openclash=y CONFIG_PACKAGE_luci-app-openclash=y
CONFIG_PACKAGE_luci-app-samba=y
CONFIG_PACKAGE_luci-app-sqm=y CONFIG_PACKAGE_luci-app-sqm=y
CONFIG_PACKAGE_luci-app-smartdns=y CONFIG_PACKAGE_luci-app-smartdns=y
CONFIG_PACKAGE_luci-app-ssr-plus=y CONFIG_PACKAGE_luci-app-ssr-plus=y
@ -60,39 +97,21 @@ CONFIG_PACKAGE_luci-app-socat=y
CONFIG_SOCAT_SSL=y CONFIG_SOCAT_SSL=y
CONFIG_PACKAGE_luci-app-syncdial=y CONFIG_PACKAGE_luci-app-syncdial=y
CONFIG_PACKAGE_luci-app-ttyd=y CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-usb3disable=y
CONFIG_PACKAGE_luci-app-uhttpd=y CONFIG_PACKAGE_luci-app-uhttpd=y
CONFIG_PACKAGE_luci-app-upnp=y CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-unblockmusic=y CONFIG_PACKAGE_luci-app-unblockmusic=y
CONFIG_UnblockNeteaseMusic_Go=y CONFIG_UnblockNeteaseMusic_Go=y
CONFIG_PACKAGE_luci-app-usb-printer=y
CONFIG_PACKAGE_luci-app-vsftpd=y
CONFIG_PACKAGE_luci-app-webadmin=y CONFIG_PACKAGE_luci-app-webadmin=y
CONFIG_PACKAGE_luci-app-wol=y CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-wireguard=y CONFIG_PACKAGE_luci-app-wireguard=y
CONFIG_PACKAGE_luci-app-zerotier=y CONFIG_PACKAGE_luci-app-zerotier=y
CONFIG_PACKAGE_6rd=y
CONFIG_PACKAGE_6to4=y # Other Appliciations
CONFIG_PACKAGE_ariang=y
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_ddns-scripts_aliyun=y
CONFIG_PACKAGE_ddns-scripts_dnspod=y
CONFIG_PACKAGE_ddns-scripts_cloudflare.com-v4=y
CONFIG_PACKAGE_ddns-scripts_freedns_42_pl=y
CONFIG_PACKAGE_ddns-scripts_godaddy.com-v1=y
CONFIG_PACKAGE_ddns-scripts_no-ip_com=y
CONFIG_PACKAGE_ddns-scripts_nsupdate=y
CONFIG_PACKAGE_ddns-scripts_route53-v1=y
CONFIG_PACKAGE_iperf3=y
CONFIG_PACKAGE_usbutils=y
CONFIG_PACKAGE_e2fsprogs=y
CONFIG_PACKAGE_httping=y
CONFIG_PACKAGE_libudev-fbsd=y
CONFIG_PACKAGE_ppp-mod-pppol2tp=y CONFIG_PACKAGE_ppp-mod-pppol2tp=y
CONFIG_PACKAGE_ppp-mod-pptp=y CONFIG_PACKAGE_ppp-mod-pptp=y
CONFIG_PACKAGE_wpad=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_xz=y CONFIG_PACKAGE_xz=y
CONFIG_PACKAGE_xz-utils=y CONFIG_PACKAGE_xz-utils=y
# CONFIG_XRAY_CORE_COMPRESS_GOPROXY is not set
# CONFIG_UnblockNeteaseMusicGo_INCLUDE_GOPROXY is not set ## Network Performance
CONFIG_PACKAGE_iperf3=y
CONFIG_PACKAGE_httping=y

View File

@ -118,22 +118,23 @@ Diy_Part3_Base() {
case "${TARGET_PROFILE}" in case "${TARGET_PROFILE}" in
x86_64) x86_64)
cd ${Firmware_Path} cd ${Firmware_Path}
Firmware=openwrt-${TARGET_BOARD}-${TARGET_SUBTARGET}-generic-squashfs-combined Legacy_Firmware=openwrt-${TARGET_BOARD}-${TARGET_SUBTARGET}-generic-squashfs-combined.${Firmware_sfx}
EFI_Firmware=openwrt-${TARGET_BOARD}-${TARGET_SUBTARGET}-generic-squashfs-combined-efi.${Firmware_sfx}
AutoBuild_Firmware="AutoBuild-${TARGET_PROFILE}-${Openwrt_Version}" AutoBuild_Firmware="AutoBuild-${TARGET_PROFILE}-${Openwrt_Version}"
if [ -f "${Firmware}${Firmware_sfx}" ];then if [ -f "${Legacy_Firmware}" ];then
_MD5=$(md5sum ${Firmware}${Firmware_sfx} | cut -d ' ' -f1) _MD5=$(md5sum ${Legacy_Firmware} | cut -d ' ' -f1)
_SHA256=$(sha256sum ${Firmware}${Firmware_sfx} | cut -d ' ' -f1) _SHA256=$(sha256sum ${Legacy_Firmware} | cut -d ' ' -f1)
touch ${Home}/bin/Firmware/${AutoBuild_Firmware}.detail touch ${Home}/bin/Firmware/${AutoBuild_Firmware}.detail
echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.detail echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.detail
mv -f ${Firmware}.${Firmware_sfx} ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy${Firmware_sfx} mv -f ${Legacy_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.${Firmware_sfx}
echo "Legacy Firmware is detected !" echo "Legacy Firmware is detected !"
fi fi
if [ -f "${Firmware}-efi${Firmware_sfx}" ];then if [ -f "${EFI_Firmware}" ];then
_MD5=$(md5sum ${Firmware}-efi${Firmware_sfx} | cut -d ' ' -f1) _MD5=$(md5sum ${EFI_Firmware} | cut -d ' ' -f1)
_SHA256=$(sha256sum ${Firmware}-efi${Firmware_sfx} | cut -d ' ' -f1) _SHA256=$(sha256sum ${EFI_Firmware} | cut -d ' ' -f1)
touch ${Home}/bin/Firmware/${AutoBuild_Firmware}.detail touch ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail
echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail
cp ${Firmware}-efi.${Firmware_sfx} ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI${Firmware_sfx} cp ${EFI_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.${Firmware_sfx}
echo "UEFI Firmware is detected !" echo "UEFI Firmware is detected !"
fi fi
;; ;;

View File

@ -3,7 +3,7 @@
# AutoBuild Module by Hyy2001 # AutoBuild Module by Hyy2001
# AutoUpdate for Openwrt # AutoUpdate for Openwrt
Version=V5.1 Version=V5.2
TIME() { TIME() {
echo -ne "\n[$(date "+%H:%M:%S")] " echo -ne "\n[$(date "+%H:%M:%S")] "
@ -36,6 +36,40 @@ Install_Pkg() {
fi fi
} }
List_Info() {
echo -e "\n/overlay 可用: ${Overlay_Available}"
echo "/tmp 可用: ${TMP_Available}M"
echo "固件下载位置: /tmp/Downloads"
echo "当前设备: ${CURRENT_Device}"
echo "默认设备: ${DEFAULT_Device}"
echo "当前固件版本: ${CURRENT_Version}"
echo "固件名称: AutoBuild-${CURRENT_Device}-${CURRENT_Version}${Firmware_SFX}"
echo "Github 地址: ${Github}"
echo "解析 API 地址: ${Github_Tags}"
echo "固件下载地址: ${Github_Download}"
echo "作者/仓库: ${Author}"
if [[ ${DEFAULT_Device} == "x86_64" ]];then
echo "EFI 引导: ${EFI_Boot}"
echo "固件压缩: ${Compressed_x86}"
fi
echo "固件格式: ${Firmware_SFX}"
exit
}
Shell_Helper() {
echo -e "\n使用方法: bash /bin/AutoUpdate.sh [参数1] [参数2]"
echo -e "\n支持下列参数:\n"
echo " -q 更新固件,不打印备份信息日志[保留配置]"
echo " -n 更新固件[不保留配置]"
echo " -f 强制更新固件,即跳过版本号验证,自动下载以及安装必要软件包[保留配置]"
echo " -u 适用于定时更新 LUCI 的参数[保留配置]"
echo " -c [参数2:<地址>] 更换 Github 检查更新以及固件下载地址"
echo " -l 列出所有信息"
echo " -d 清除固件下载缓存"
echo -e " -h 打印此帮助信息\n"
exit
}
opkg list | awk '{print $1}' > /tmp/Package_list opkg list | awk '{print $1}' > /tmp/Package_list
Input_Option="$1" Input_Option="$1"
Input_Other="$2" Input_Other="$2"
@ -43,6 +77,8 @@ CURRENT_Version="$(awk 'NR==1' /etc/openwrt_info)"
Github="$(awk 'NR==2' /etc/openwrt_info)" Github="$(awk 'NR==2' /etc/openwrt_info)"
DEFAULT_Device="$(awk 'NR==3' /etc/openwrt_info)" DEFAULT_Device="$(awk 'NR==3' /etc/openwrt_info)"
Firmware_Type="$(awk 'NR==4' /etc/openwrt_info)" Firmware_Type="$(awk 'NR==4' /etc/openwrt_info)"
TMP_Available="$(df -m | grep "/tmp" | awk '{print $4}' | awk 'NR==1')"
Overlay_Available="$(df -h | grep ":/overlay" | awk '{print $4}' | awk 'NR==1')"
case ${DEFAULT_Device} in case ${DEFAULT_Device} in
x86_64) x86_64)
[[ -z ${Firmware_Type} ]] && Firmware_Type="img" [[ -z ${Firmware_Type} ]] && Firmware_Type="img"
@ -59,50 +95,20 @@ x86_64)
BOOT_Type="-Legacy" BOOT_Type="-Legacy"
fi fi
Firmware_SFX="${BOOT_Type}.${Firmware_Type}" Firmware_SFX="${BOOT_Type}.${Firmware_Type}"
Firmware_Detail="${BOOT_Type}.detail" Detail_SFX="${BOOT_Type}.detail"
CURRENT_Device="x86_64" CURRENT_Device="x86_64"
Space_RQM=500
;; ;;
*) *)
CURRENT_Device="$(jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_')" CURRENT_Device="$(jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_')"
Firmware_SFX=".${Firmware_Type}" Firmware_SFX=".${Firmware_Type}"
[[ -z ${Firmware_SFX} ]] && Firmware_SFX="bin" [[ -z ${Firmware_SFX} ]] && Firmware_SFX=".bin"
Firmware_Detail=".detail" Detail_SFX=".detail"
Space_RQM=50
esac esac
Github_Download="${Github}/releases/download/AutoUpdate" Github_Download="${Github}/releases/download/AutoUpdate"
Author="${Github##*com/}" Author="${Github##*com/}"
Github_Tags="https://api.github.com/repos/${Author}/releases/latest" Github_Tags="https://api.github.com/repos/${Author}/releases/latest"
Disk_List="/tmp/disk_list"
[ -f ${Disk_List} ] && rm -f ${Disk_List}
Check_Disk="$(mount | egrep -o "mnt/+sd[a-zA-Z][0-9]+")"
if [ ! -z "${Check_Disk}" ];then
echo "${Check_Disk}" > ${Disk_List}
Disk_Number=$(sed -n '$=' ${Disk_List})
if [ ${Disk_Number} -gt 1 ];then
for Disk_Name in $(cat ${Disk_List})
do
Disk_Available="$(df -m | grep "${Disk_Name}" | awk '{print $4}')"
if [ "${Disk_Available}" -gt 20 ];then
Download_Path="/${Disk_Name}"
break
else
Download_Path="/tmp"
fi
done
else
Disk_Name="${Check_Disk}"
Disk_Available="$(df -m | grep "${Disk_Name}" | awk '{print $4}')"
if [ "${Disk_Available}" -gt 200 ];then
Download_Path="/${Disk_Name}"
else
Download_Path="/tmp"
fi
fi
else
Disk_Number="0"
Disk_Available="0"
Download_Path="/tmp"
fi
[ ! -d "${Download_Path}/Downloads" ] && mkdir -p ${Download_Path}/Downloads
cd /etc cd /etc
clear && echo "Openwrt-AutoUpdate Script ${Version}" clear && echo "Openwrt-AutoUpdate Script ${Version}"
if [[ -z "${Input_Option}" ]];then if [[ -z "${Input_Option}" ]];then
@ -116,78 +122,49 @@ else
TIME && echo "执行: 更新固件(保留配置)" TIME && echo "执行: 更新固件(保留配置)"
;; ;;
-f) -f)
Force_Update="1" Force_Update=1
Upgrade_Options="-q" Upgrade_Options="-q"
TIME && echo "执行: 强制更新固件(保留配置)" TIME && echo "执行: 强制更新固件(保留配置)"
;; ;;
-u) -u)
AutoUpdate_Mode="1" AutoUpdate_Mode=1
Upgrade_Options="-q" Upgrade_Options="-q"
;; ;;
-s)
Stable_Mode="1"
Upgrade_Options="-q"
TIME && echo "执行: 更新固件到最新稳定版本(保留配置)"
;;
-sn|-ns)
Stable_Mode="1"
Upgrade_Options="-n"
TIME && echo "执行: 更新固件到最新稳定版本(不保留配置)"
;;
-c) -c)
if [[ ! -z "${Input_Other}" ]];then if [[ ! -z "${Input_Other}" ]];then
sed -i "s?${Github}?${Input_Other}?g" /etc/openwrt_info > /dev/null 2>&1 sed -i "s?${Github}?${Input_Other}?g" /etc/openwrt_info > /dev/null 2>&1
echo -e "\nGithub 地址已更换为: ${Input_Other}" echo -e "\nGithub 地址已更换为: ${Input_Other}"
unset Input_Other unset Input_Other
else else
echo -e "\n使用方法: bash /bin/AutoUpdate.sh -c [地址]" Shell_Helper
fi fi
exit exit
;; ;;
-l) -l)
Overlay_Size="$(df -h | grep ":/overlay" | awk '{print $4}')" List_Info
TMP_Size="$(df -h | grep "tmp" | awk '{print $4}' | awk 'NR==1')" ;;
echo -e "\n传入参数: bash ${0} ${@}" -d)
echo "参数个数: $#" rm -f /tmp/Downloads/* /tmp/Github_Tags
echo "/overlay 可用: ${Overlay_Size}" TIME && echo "固件下载缓存清理完成!"
echo "/tmp 可用: ${TMP_Size}" sleep 1
echo "硬盘个数: ${Disk_Number}"
echo "硬盘可用: ${Disk_Available}M"
echo "固件下载位置: ${Download_Path}/Downloads"
echo "当前版本: ${CURRENT_Version}"
echo "Github 地址: ${Github}"
echo "默认设备: ${DEFAULT_Device}"
echo "当前设备: ${CURRENT_Device}"
echo "固件下载地址: ${Github_Download}"
echo "API地址: ${Github_Tags}"
echo "作者/仓库: ${Author}"
if [[ ${DEFAULT_Device} == "x86_64" ]];then
echo "EFI 引导: ${EFI_Boot}"
echo "gz 压缩: ${Compressed_x86}"
fi
echo "固件格式: ${Firmware_SFX}"
exit exit
;; ;;
-h | --help)
Shell_Helper
;;
*) *)
echo -e "\n使用方法: bash /bin/AutoUpdate.sh [参数1] [参数2]" echo -e "\nERROR INPUT: [$*]"
echo -e "\n可供使用的[参数]:\n" Shell_Helper
echo " -q 更新固件,不打印备份信息日志[保留配置]"
echo " -n 更新固件[不保留配置]"
echo " -f 强制更新固件,即跳过版本号验证,自动下载以及安装必要软件包[保留配置]"
echo " -u 适用于定时更新的参数,自动下载以及安装必要软件包[保留配置]"
echo " -s 更新/回退固件到最新的稳定版本[保留配置]"
echo " -sn 更新/回退固件到最新的稳定版本[不保留配置]"
echo " -c [地址] 更换 Github 检查更新地址"
echo " -l 列出所有信息"
echo -e "\nGithub地址: ${Github}"
echo -e "当前设备: ${DEFAULT_Device}\n"
exit
;; ;;
esac esac
if [[ ! "${Force_Update}" == "1" ]] && [[ ! "${AutoUpdate_Mode}" == "1" ]] && [[ ! "${Stable_Mode}" == "1" ]];then if [[ ! "${Force_Update}" == "1" ]] && [[ ! "${AutoUpdate_Mode}" == "1" ]];then
Upgrade_Options="${Input_Option}" Upgrade_Options="${Input_Option}"
fi fi
fi fi
if [[ "${TMP_Available}" -lt "${Space_RQM}" ]];then
TIME && echo "/tmp 空间不足: [${Space_RQM}M],无法执行程序!"
exit
fi
if [[ ! "${Force_Update}" == "1" ]] && [[ ! "${AutoUpdate_Mode}" == "1" ]];then if [[ ! "${Force_Update}" == "1" ]] && [[ ! "${AutoUpdate_Mode}" == "1" ]];then
grep "curl" /tmp/Package_list > /dev/null 2>&1 grep "curl" /tmp/Package_list > /dev/null 2>&1
if [[ ! $? -ne 0 ]];then if [[ ! $? -ne 0 ]];then
@ -206,51 +183,46 @@ if [[ -z "${CURRENT_Device}" ]];then
CURRENT_Device="${DEFAULT_Device}" CURRENT_Device="${DEFAULT_Device}"
fi fi
TIME && echo "正在检查版本更新..." TIME && echo "正在检查版本更新..."
[ ! -f /tmp/Github_Tags ] && touch /tmp/Github_Tags
wget -q ${Github_Tags} -O - > /tmp/Github_Tags wget -q ${Github_Tags} -O - > /tmp/Github_Tags
if [[ ! "$?" == 0 ]];then if [[ ! "$?" == 0 ]];then
TIME && echo "检查更新失败,请稍后重试!" TIME && echo "检查更新失败,请稍后重试!"
exit exit
fi fi
if [[ ${Stable_Mode} == 1 ]];then TIME && echo "正在获取云端固件版本..."
GET_Version_Type="-Stable" GET_Firmware=$(cat /tmp/Github_Tags | egrep -o "AutoBuild-${CURRENT_Device}-R[0-9].+-[0-9]+${Firmware_SFX}" | awk 'END {print}')
else GET_Version=$(echo ${GET_Firmware} | egrep -o "R[0-9].+-[0-9]+")
GET_Version_Type="" if [[ -z "${GET_Firmware}" ]] || [[ -z "${GET_Version}" ]];then
fi TIME && echo "云端固件版本获取失败!"
GET_FullVersion=$(cat /tmp/Github_Tags | egrep -o "AutoBuild-${CURRENT_Device}-R[0-9]+.[0-9]+.[0-9]+.[0-9]+${GET_Version_Type}" | awk 'END {print}')
GET_Version="${GET_FullVersion#*${CURRENT_Device}-}"
if [[ -z "${GET_FullVersion}" ]] || [[ -z "${GET_Version}" ]];then
TIME && echo "检查更新失败,请稍后重试!"
exit exit
fi fi
Firmware_Info="$(echo ${GET_Firmware} | egrep -o "AutoBuild-${CURRENT_Device}-R[0-9].+-[0-9]+")"
Firmware="${GET_Firmware}"
Firmware_Detail="${Firmware_Info}${Detail_SFX}"
echo -e "\n固件作者: ${Author%/*}" echo -e "\n固件作者: ${Author%/*}"
echo "设备名称: ${DEFAULT_Device}" echo "设备名称: ${CURRENT_Device}"
echo "固件格式: ${Firmware_SFX}" echo "固件格式: ${Detail_SFX}"
echo -e "\n当前固件版本: ${CURRENT_Version}" echo -e "\n当前固件版本: ${CURRENT_Version}"
echo "云端固件版本: ${GET_Version}" echo "云端固件版本: ${GET_Version}"
[[ -z "${Firmware_Type}" ]] && TIME && echo "[固件格式] 获取失败!" && exit
Check_Stable_Version=$(echo ${GET_Version} | egrep -o "R[0-9]+.[0-9]+.[0-9]+.[0-9]+")
if [[ ! ${Force_Update} == 1 ]];then if [[ ! ${Force_Update} == 1 ]];then
if [[ "${CURRENT_Version}" == "${Check_Stable_Version}" ]];then if [[ ${CURRENT_Version} == ${GET_Version} ]];then
[[ "${AutoUpdate_Mode}" == "1" ]] && exit [[ "${AutoUpdate_Mode}" == "1" ]] && exit
TIME && read -p "已是最新版本,是否强制更新固件?[Y/n]:" Choose TIME && read -p "已是最新版本,是否强制更新固件?[Y/n]:" Choose
if [[ "${Choose}" == Y ]] || [[ "${Choose}" == y ]];then if [[ "${Choose}" == Y ]] || [[ "${Choose}" == y ]];then
TIME && echo "开始强制更新固件..." TIME && echo "开始强制更新固件..."
else else
TIME && echo "已取消强制更新,即将退出更新程序..." TIME && echo "已取消强制更新,即将退出更新程序..."
sleep 1 sleep 2
exit exit
fi fi
fi fi
fi fi
Firmware_Info="${GET_FullVersion}"
Firmware="${Firmware_Info}${Firmware_SFX}"
Firmware_Detail="${Firmware_Info}${Firmware_Detail}"
echo -e "\n云端固件名称: ${Firmware}" echo -e "\n云端固件名称: ${Firmware}"
echo "固件下载地址: ${Github_Download}" echo "固件下载地址: ${Github_Download}"
cd ${Download_Path}/Downloads echo "固件保存位置: /tmp/Downloads"
echo "固件保存位置: ${Download_Path}/Downloads" [ ! -d "/tmp/Downloads" ] && mkdir -p /tmp/Downloads
TIME && echo "正在删除旧版本固件..." && rm -f /tmp/Downloads/*
TIME && echo "正在下载固件,请耐心等待..." TIME && echo "正在下载固件,请耐心等待..."
cd /tmp/Downloads
wget -q "${Github_Download}/${Firmware}" -O ${Firmware} wget -q "${Github_Download}/${Firmware}" -O ${Firmware}
if [[ ! "$?" == 0 ]];then if [[ ! "$?" == 0 ]];then
TIME && echo "固件下载失败,请检查网络后重试!" TIME && echo "固件下载失败,请检查网络后重试!"
@ -277,21 +249,21 @@ if [[ ! "${GET_MD5}" == "${CURRENT_MD5}" ]];then
else else
TIME && echo -e "MD5 对比通过!" TIME && echo -e "MD5 对比通过!"
fi fi
if [[ ${Compressed_x86} == "1" ]];then if [[ ${Compressed_x86} == 1 ]];then
TIME && echo "检测到固件为 [.gz] 压缩格式,开始解压固件..." TIME && echo "检测到固件为 [.gz] 压缩格式,开始解压固件..."
Install_Pkg gzip Install_Pkg gzip
Firmware="${Firmware_Info}${BOOT_Type}.img"
rm -f ${Firmware} > /dev/null 2>&1
gzip -dk ${Firmware} > /dev/null 2>&1 gzip -dk ${Firmware} > /dev/null 2>&1
Firmware="${Firmware_Info}${BOOT_Type}.img"
if [ -f "${Firmware}" ];then if [ -f "${Firmware}" ];then
TIME && echo "固件解压成功,固件名称: ${Firmware}" TIME && echo "固件解压成功,名称: ${Firmware}"
else else
TIME && echo "固件解压失败,请检查相关信息!" TIME && echo "固件解压失败!"
exit exit
fi fi
fi fi
TIME && echo -e "开始更新固件,请耐心等待路由器重启...\n" TIME && echo -e "一切准备就绪,5s 后开始更新固件...\n"
sleep 3 sleep 5
TIME && echo -e "正在更新固件,期间请耐心等待..."
sysupgrade ${Upgrade_Options} ${Firmware} sysupgrade ${Upgrade_Options} ${Firmware}
if [[ $? -ne 0 ]];then if [[ $? -ne 0 ]];then
TIME && echo "固件刷写失败,请尝试不保留配置[-n]或手动下载固件!" TIME && echo "固件刷写失败,请尝试不保留配置[-n]或手动下载固件!"