From e58fd955a0e54beba41daeaf30eb69f7863c2b7f Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Sun, 6 Jun 2021 13:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=20AutoUpdate=20V6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomFiles/Depends/Custom_Variable | 3 +++ CustomFiles/Depends/profile | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 CustomFiles/Depends/Custom_Variable diff --git a/CustomFiles/Depends/Custom_Variable b/CustomFiles/Depends/Custom_Variable new file mode 100644 index 0000000..ccc4a26 --- /dev/null +++ b/CustomFiles/Depends/Custom_Variable @@ -0,0 +1,3 @@ +## 请在下方输入你的自定义变量,一行写一个 +## 该文件将在运行 AutoUpdate.sh 时读取,变量优先级高于 Default_Variable +## 示例: TARGET_PROFILE=x86_64 \ No newline at end of file diff --git a/CustomFiles/Depends/profile b/CustomFiles/Depends/profile index 2b1a1d4..dd0db13 100644 --- a/CustomFiles/Depends/profile +++ b/CustomFiles/Depends/profile @@ -1,17 +1,17 @@ Sysinfo() { - [ -f /etc/openwrt_info ] && source /etc/openwrt_info > /dev/null 2>&1 - local Target=${DEFAULT_Device} - [ -n "${CURRENT_Version}" ] && local Version="${CURRENT_Version}" || Version=未知 - [ -z "${Target}" ] && local Target=$(jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_') + source /etc/AutoBuild/Default_Variable > /dev/null 2>&1 + source /etc/AutoBuild/Custom_Variable > /dev/null 2>&1 + [ -z "${CURRENT_Version}" ] && CURRENT_Version=未知 + [ -z "${TARGET_PROFILE}" ] && local TARGET_PROFILE=$(jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_') local IP_Address=$(ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d "addr:" | awk 'NR==1') local CoreMark=$([ -f /etc/bench.log ] && egrep -o "[0-9]+" /etc/bench.log | awk 'NR==1') local Startup=$(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d 天 %d 小时 %d 分钟\n",a,b,c)}' /proc/uptime) local Overlay_Available="$(df -h | grep ":/overlay" | awk '{print $4}' | awk 'NR==1')" local TEMP=$(sensors 2>/dev/null | grep 'Core 0' | awk '{print $3}') - echo -e "\n 设备名称: ${Yellow}$(uname -n) / ${Target}${White}" + echo -e "\n 设备名称: ${Yellow}$(uname -n) / ${TARGET_PROFILE}${White}" [ -n "${TEMP}" ] && echo " 核心温度: ${TEMP}" echo " 内核版本: $(uname -rs)" - echo -e " 固件版本: ${Skyb}${Version}${White}" + echo -e " 固件版本: ${Skyb}${CURRENT_Version}${White}" echo " IP 地址 : ${IP_Address}" echo " 可用空间: ${Overlay_Available}" [ -n "${CoreMark}" ] && echo " 性能得分: ${CoreMark}" @@ -87,4 +87,4 @@ alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias cls='clear' alias dh='df -h' -alias ramfree='sync && echo 3 > /proc/sys/vm/drop_caches' +alias ramfree='sync && echo 3 > /proc/sys/vm/drop_caches' \ No newline at end of file