#!/bin/bash # https://github.com/Hyy2001X/AutoBuild-Actions # AutoBuild Module by Hyy2001 # AutoUpdate for Openwrt Version=V4.5 DEFAULT_DEVICE=d-team_newifi-d2 Github=https://github.com/Hyy2001X/AutoBuild-Actions TIME() { echo -ne "\n[$(date "+%H:%M:%S")] " } Github_Download=${Github}/releases/download/AutoUpdate Author=${Github##*com/} Github_Tags=https://api.github.com/repos/${Author}/releases/latest 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 [[ -z "$1" ]];then Upgrade_Options="-q" && TIME && echo "执行: 保留配置更新固件[静默模式]" else case $1 in -n) TIME && echo "执行: 不保留配置更新固件" ;; -q) TIME && echo "执行: 保留配置更新固件[静默模式]" ;; -v) TIME && echo "执行: 保留配置更新固件[详细模式]" ;; -f) Force_Update="1" Upgrade_Options="-q" TIME && echo "执行: 强制更新固件并保留配置" ;; *) echo -e "\nUsage: bash /bin/AutoUpdate.sh [