From 074d1e719a763b2cdb512db81d66c1fbd250bed7 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Fri, 10 Sep 2021 22:43:29 +0800 Subject: [PATCH] =?UTF-8?q?profile:=20=E4=BC=98=E5=8C=96=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomFiles/Depends/profile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CustomFiles/Depends/profile b/CustomFiles/Depends/profile index 48e9151..00936b0 100755 --- a/CustomFiles/Depends/profile +++ b/CustomFiles/Depends/profile @@ -1,23 +1,23 @@ Sysinfo() { - local TARGET_PROFILE CoreMark Startup TEMP + local TARGET_PROFILE CoreMark TEMP TARGET_PROFILE=$(getinf TARGET_PROFILE /rom/etc/AutoBuild/Default_Variable) TARGET_BOARD=$(getinf TARGET_BOARD /rom/etc/AutoBuild/Default_Variable) [ -z "${TARGET_PROFILE}" ] && return 1 if [ "${TARGET_BOARD}" == x86 ] then - [ -d /sys/firmware/efi ] && TARGET_BOOTABLE="${Grey}UEFI" || TARGET_BOOTABLE="${Grey}Legacy" + [ -d /sys/firmware/efi ] && TARGET_BOOTABLE="UEFI" || TARGET_BOOTABLE="Legacy" fi [ -f /etc/bench.log ] && CoreMark=$(egrep -o "[0-9]+" /etc/bench.log | awk 'NR==1') - [ -f /proc/uptime ] && Startup=$(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60;d=($1%60)} {printf("%d 天 %d 小时 %d 分钟 %d 秒\n",a,b,c,d)}' /proc/uptime) - [ -n "$(sensors 2> /dev/null | grep Core)" ] && TEMP=$(echo "$(sensors 2> /dev/null | grep Core | awk '{Sum += $3};END {print Sum}') / $(sensors 2>/dev/null | grep Core | wc -l)" | bc 2>/dev/null | awk '{a=$1;b=32+$1*1.8} {printf("%d°C \e[36m|\e[0m %.1f°F\n",a,b)}') - echo -e " 设备信息: ${Yellow}${TARGET_PROFILE} ${TARGET_BOOTABLE}${White}" - echo -e " 内核版本: $(uname -rs)" - echo -e " 可用内存: $(free | grep Mem | awk '{a=$7*100/$2;b=$7/1024;c=$2/1024} {printf("%.1fM \e[36m|\e[0m %.1f%% of %.1fM\n",b,a,c)}')" - echo -e " 可用存储: $(df -T / | grep 'overlay' | awk '{a=$5*100/$3;b=$5/1024;c=$3/1024} {printf("%.1fM \e[36m|\e[0m %.1f%% of %.1fM\n",b,a,c)}')" - [ -n "${TEMP}" ] && echo -e " 设备温度: ${TEMP}" - [ -n "${CoreMark}" ] && echo -e " 性能得分: ${CoreMark} Scores" - echo -e " 运行时间: ${Startup}" - [ -n "${SSH_CONNECTION}" ] && echo -e " 登录用户: ${LOGNAME} ${Div} ${Grey}$(echo ${SSH_CONNECTION} | awk '{print $1":"$2}')" + [ -n "$(sensors 2> /dev/null | grep Core)" ] && TEMP=$(echo "$(sensors 2> /dev/null | grep Core | awk '{Sum += $3};END {print Sum}') / $(sensors 2>/dev/null | grep Core | wc -l)" | bc 2>/dev/null | awk '{a=$1;b=32+$1*1.8} {printf("%.1f°C %.1f°F\n",a,b)}') + [ -n "${TARGET_BOOTABLE}" ] && printf " 设备信息: %-7s ${Div} ${Green}%-12s${White}\n" ${TARGET_PROFILE} ${TARGET_BOOTABLE} || \ + printf " 设备信息: ${TARGET_PROFILE}\n" + printf " 内核版本: $(uname -rs | cut -d ' ' -f2)\n" + printf " 可用内存: %-7s ${Div} %s of %s\n" $(free | grep Mem | awk '{a=$7*100/$2;b=$7/1024;c=$2/1024} {printf("%.1fM %.1f%% %.1fM",b,a,c)}') + printf " 可用存储: %-7s ${Div} %s of %s\n" $(df -T / | grep 'overlay' | awk '{a=$5*100/$3;b=$5/1024;c=$3/1024} {printf("%.1fM %.1f%% %.1fM",b,a,c)}') + [ -n "${TEMP}" ] && printf " 设备温度: %-8s ${Div} %s\n" ${TEMP} + [ -n "${CoreMark}" ] && printf " 性能得分: ${CoreMark} Scores\n" + [ -f /proc/uptime ] && printf " 运行时间: $(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60;d=($1%60)} {printf("%d 天 %d 小时 %d 分钟 %d 秒\n",a,b,c,d)}' /proc/uptime)\n" + [ -n "${SSH_CONNECTION}" ] && printf " 登录用户: %-7s ${Div} %s\n" ${LOGNAME} $(echo ${SSH_CONNECTION} | awk '{print $1":"$2}') echo -e "${White}" }