From 3e76535cff799ad8ea3b9e0dad23b6cd4a889fd9 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Tue, 22 Mar 2022 23:09:04 +0800 Subject: [PATCH] =?UTF-8?q?profile:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomFiles/Depends/profile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CustomFiles/Depends/profile b/CustomFiles/Depends/profile index e181369..3c2ce82 100755 --- a/CustomFiles/Depends/profile +++ b/CustomFiles/Depends/profile @@ -2,15 +2,18 @@ Sysinfo() { local TARGET_PROFILE TARGET_BOOTABLE TEMP CoreMark 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 + [ -z "${TARGET_PROFILE}" ] && echo if [ "${TARGET_BOARD}" == x86 ] then [ -d /sys/firmware/efi ] && TARGET_BOOTABLE="UEFI" || TARGET_BOOTABLE="BIOS" fi [ -f /etc/bench.log ] && CoreMark=$(egrep -o "[0-9]+" /etc/bench.log | awk 'NR==1') - [ -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) + if [ -n "$(sensors 2> /dev/null | grep Core)" ] + then + 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) + fi [ -n "${TARGET_BOOTABLE}" ] && printf " 设备信息: %-7s ${Div} ${Green}%-12s${White}\n" ${TARGET_PROFILE} ${TARGET_BOOTABLE} || \ - printf " 设备信息: ${TARGET_PROFILE}\n" + [ -n "${TARGET_PROFILE}" ] && 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 -v File | awk '{a=$5*100/$3;b=$5/1024;c=$3/1024} {printf("%.1fM %.1f%% %.1fM",b,a,c)}') @@ -22,7 +25,7 @@ Sysinfo() { } getinf() { - local i=$(grep $1 $2 | awk 'END {print}') + local i=$(grep $1 $2 2> /dev/null | awk 'END {print}') [ -z "${i}" ] && return 1 eval echo ${i} | sed "s/^[$1=]*//g" 2> /dev/null }