新增 花里胡哨 shell 界面

This commit is contained in:
Hyy2001X 2021-08-05 15:27:21 +08:00
parent b89b8356fa
commit 6aa74f0c60
5 changed files with 27 additions and 22 deletions

View File

@ -1,12 +1,15 @@
\e[36m
_____ __ __________ .__.__ .___
/ _ \ __ ___/ |_ ____\______ \__ __|__| | __| _/
/ /_\ \| | \ __\/ _ \| | _/ | \ | | / __ |
/ | \ | /| | ( <_> ) | \ | / | |__/ /_/ |
\____|__ /____/ |__| \____/|______ /____/|__|____/\____ |
\/ \/ \/
By
\e[33m By
\e[0m
\e[32m | MSG |
\e[36m
———————————————————————————————————————————————————
Openwrt
———————————————————————————————————————————————————
\e[0m

View File

@ -2,22 +2,18 @@ Sysinfo() {
source /rom/etc/AutoBuild/Default_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;d=($1%60)} {printf("%d 天 %d 小时 %d 分钟 %d 秒\n",a,b,c,d)}' /proc/uptime)
local Overlay_Available="$(df -hT / | grep 'overlay' | awk '{print $5}' | awk 'NR==1')"
local Tmp_Available="$(df -hT /tmp | grep '/tmp' | awk '{print $5}' | awk 'NR==1')"
local TEMP=$(sensors 2>/dev/null | grep 'Core 0' | awk '{print $3}')
cat <<EOF
$(echo -e "设备名称: ${Yellow}${TARGET_PROFILE}${Grey} | ${Yellow}$(uname -n)${White}")
$(echo -e "固件版本: ${Grey}${CURRENT_Version}${White}")
内核版本: $(uname -rs)$([ -n "${TEMP}" ] && echo -e "\n 核心温度: ${TEMP}")
后台地址: ${IP_Address}
$(echo -e "可用空间: /: ${Overlay_Available}${Grey} | ${White}/tmp: ${Tmp_Available}")
运行时间: ${Startup}$([ -n "${CoreMark}" ] && echo -e "\n 性能得分: ${CoreMark}")
EOF
local TEMP=$(sensors 2>/dev/null | grep 'Core 0' | awk '{print $3}' | cut -d '+' -f2 | cut -d '.' -f1 | awk '{a=$1;b=32+$1*1.8} {printf("%d°C \e[36m|\e[0m %.1f°F\n",a,b)}')
echo
echo -e " 设备信息: ${Yellow}${TARGET_PROFILE} ${Div} $(uname -n)"
echo -e " 内核版本: K$(uname -rs | egrep -o "[0-9].+")"
echo -e " 可用内存: $(free | grep Mem | awk '{a=$7*100/$2};b=$7/1024 {printf("%.1fM \e[36m|\e[0m %.1f\n",b,a)}')%"
echo -e " 可用存储: $(df -T / | grep 'overlay' | awk '{a=$5*100/$3;b=$5/1024} {printf("%.1fM \e[36m|\e[0m %.1f\n",b,a)}')%"
[ -n "${TEMP}" ] && echo -e " 设备温度: ${TEMP}"
[ -n "${CoreMark}" ] && echo -e " 性能得分: ${CoreMark} Scores"
echo -e " 运行时间: ${Startup}"
echo
}
export White="\e[0m"
@ -26,6 +22,7 @@ export Red="\e[31m"
export Blue="\e[34m"
export Grey="\e[36m"
export Green="\e[32m"
Div="${Grey}|${White}"
clear
@ -73,6 +70,7 @@ Sysinfo
alias reload='/etc/profile'
alias autoupdate='bash /bin/AutoUpdate.sh'
alias tools='bash /bin/AutoBuild_Tools.sh'
alias coremarkd='bash /etc/coremark.sh'
alias shutdown='sync && poweroff'
alias ls='ls --color=auto'
alias ll='ls -alF'
@ -80,4 +78,4 @@ alias la='ls -A'
alias l='ls -CF'
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'

View File

@ -54,6 +54,8 @@ AutoBuild-Actions 稳定版/模板地址: [AutoBuild-Actions-Template](https://g
**AutoBuild_DiyScript.sh: Diy_Core() 函数中的变量解释:**
```
Author 作者名称,若留空将自动获取为 Github 用户名
Message 特殊信息,与作者名称一同在 Shell banner 展示
Default_LAN_IP 固件默认 LAN IP 地址

View File

@ -5,6 +5,7 @@
Diy_Core() {
Author=Hyy2001
Message="Powered by AutoBuild-Actions"
Default_LAN_IP=192.168.1.1
Load_CustomPackages_List=true
Short_Firmware_Date=true

View File

@ -92,6 +92,7 @@ Scripts=${GITHUB_WORKSPACE}/Scripts
feeds_luci=${GITHUB_WORKSPACE}/openwrt/package/feeds/luci
feeds_pkgs=${GITHUB_WORKSPACE}/openwrt/package/feeds/packages
base_files=${GITHUB_WORKSPACE}/openwrt/package/base-files/files
Message=${Message}
EOF
echo "$(cat ${Home}/VARIABLE_Main)" >> ${Home}/VARIABLE_FILE
echo -e "### SYS-VARIABLE LIST ###\n$(cat ${Home}/VARIABLE_FILE)\n"
@ -136,16 +137,16 @@ Firmware-Diy_Main() {
sed -i "s?ImmortalWrt?ImmortalWrt @ ${Author} [${Display_Date}]?g" ${Version_File}
;;
esac
[[ -z ${Message} ]] && Message="Powered by AutoBuild-Actions"
sed -i "s?By?By ${Author}?g" ${CustomFiles}/Depends/banner
sed -i "s?Openwrt?Openwrt ${CURRENT_Version} / AutoUpdate ${AutoUpdate_Version}?g" ${CustomFiles}/Depends/banner
sed -i "s?MSG?${Message}?g" ${CustomFiles}/Depends/banner
case "${OP_Maintainer}/${OP_REPO_NAME}" in
immortalwrt/immortalwrt)
Copy ${CustomFiles}/Depends/banner ${Home}/$(PKG_Finder d package default-settings)/files openwrt_banner
sed -i "s?By?By ${Author}?g" $(PKG_Finder d package default-settings)/files/openwrt_banner
sed -i "s?Openwrt?Openwrt ${CURRENT_Version} / AutoUpdate ${AutoUpdate_Version}?g" $(PKG_Finder d package default-settings)/files/openwrt_banner
;;
*)
Copy ${CustomFiles}/Depends/banner ${base_files}/etc
sed -i "s?By?By ${Author}?g" ${base_files}/etc/banner
sed -i "s?Openwrt?Openwrt ${CURRENT_Version} / AutoUpdate ${AutoUpdate_Version}?g" ${base_files}/etc/banner
;;
esac
fi