This commit is contained in:
Hyy2001X 2021-05-11 22:14:58 +08:00
parent f9a38d13bf
commit fe562eab9b
3 changed files with 37 additions and 23 deletions

View File

@ -7,6 +7,6 @@
\/ \/ \/
By
—————————————————————————————————————————————————
—————————————————————————————————————————————————
Openwrt
—————————————————————————————————————————————————
—————————————————————————————————————————————————

View File

@ -1,34 +1,48 @@
Sysinfo() {
[ -f /etc/openwrt_info ] && {
source /etc/openwrt_info
Target=${DEFAULT_Device}
}
[[ -n "${CURRENT_Version}" ]] && Version="${CURRENT_Version}" || Version=Unknown
[[ -z "${Target}" ]] && Target=$(jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_')
IP_Address=$(ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d "addr:" | awk 'NR==1')
CoreMark=$([ -f /etc/bench.log ] && egrep -o "[0-9]+" /etc/bench.log | awk 'NR==1')
[[ -z "${CoreMark}" ]] && CoreMark=Unknown
Startup=$(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d 天 %d 小时 %d 分钟\n",a,b,c)}' /proc/uptime)
Overlay_Available="$(df -h | grep ":/overlay" | awk '{print $4}' | awk 'NR==1')"
[ -f /etc/openwrt_info ] && source /etc/openwrt_info
export Target=${DEFAULT_Device}
[ -n "${CURRENT_Version}" ] && export Version="${CURRENT_Version}" || Version=Unknown
[ -z "${Target}" ] && export Target=$(jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_')
export IP_Address=$(ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d "addr:" | awk 'NR==1')
export CoreMark=$([ -f /etc/bench.log ] && egrep -o "[0-9]+" /etc/bench.log | awk 'NR==1')
export Startup=$(awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d 天 %d 小时 %d 分钟\n",a,b,c)}' /proc/uptime)
export Overlay_Available="$(df -h | grep ":/overlay" | awk '{print $4}' | awk 'NR==1')"
export TEMP=$(sensors 2>/dev/null | grep 'Core 0' | awk '{print $3}')
echo -e "\n"
echo " 设备名称: $(uname -n) / ${Target}"
echo " 固件版本: ${Version}"
echo -e " 设备名称: ${Yellow}$(uname -n) / ${Target}${White}"
[ -n "${TEMP}" ] && echo " 核心温度: ${TEMP}"
echo " 内核版本: $(uname -rs)"
echo -e " 固件版本: ${Skyb}${Version}${White}"
echo " IP 地址 : ${IP_Address}"
echo " 运行时间: ${Startup}"
echo " 性能得分: ${CoreMark}"
echo " 可用空间: ${Overlay_Available}"
echo " 运行时间: ${Startup}"
[ -n "${CoreMark}" ] && echo " 性能得分: ${CoreMark}"
echo ""
}
[ -e /tmp/.failsafe ] && export FAILSAFE=1
clear
[ -f /etc/banner ] && cat /etc/banner
[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
export White="\e[0m"
export Yellow="\e[33m"
export Red="\e[31m"
export Blue="\e[34m"
export Skyb="\e[36m"
clear
[ -e /tmp/.failsafe ] && export FAILSAFE=1
[ -f /etc/banner ] && {
echo -e "$Blue"
cat /etc/banner
echo -e "$White"
}
[ -n "$FAILSAFE" ] && {
echo -e "$Red"
cat /etc/banner.failsafe
echo -e "$White"
}
fgrep -sq '/ overlay ro,' /proc/mounts && {
echo -e "$Red"
echo "警告: 您的固件空间已满,接下来保存的数据将会面临丢失的风险."
echo "请尝试从 /overlay 删除一些文件并重启设备!"
echo -e "$White"
}
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"

View File

@ -9,7 +9,7 @@ AutoBuild_Tools() {
while :
do
clear
cat /etc/banner
echo "" && cat /etc/banner
echo -e "\n\nAutoBuild 固件工具箱 ${Version}\n"
echo "1. USB 空间扩展"
echo "2. Samba 一键共享"