profile: 合并上游改动
This commit is contained in:
parent
f94a88a395
commit
b40ef7e65c
|
|
@ -7,13 +7,14 @@ Sysinfo() {
|
||||||
local CoreMark=$([ -f /etc/bench.log ] && egrep -o "[0-9]+" /etc/bench.log | 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 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 Overlay_Available="$(df -h | grep ":/overlay" | awk '{print $4}' | awk 'NR==1')"
|
||||||
|
local Tmp_Available="$(df -h | grep "/tmp" | awk '{print $4}' | awk 'NR==1')"
|
||||||
local TEMP=$(sensors 2>/dev/null | grep 'Core 0' | awk '{print $3}')
|
local TEMP=$(sensors 2>/dev/null | grep 'Core 0' | awk '{print $3}')
|
||||||
echo -e "\n 设备名称: ${Yellow}$(uname -n) / ${TARGET_PROFILE}${White}"
|
echo -e "\n 设备名称: ${Yellow}$(uname -n) / ${TARGET_PROFILE}${White}"
|
||||||
[ -n "${TEMP}" ] && echo " 核心温度: ${TEMP}"
|
[ -n "${TEMP}" ] && echo " 核心温度: ${TEMP}"
|
||||||
echo " 内核版本: $(uname -rs)"
|
echo " 内核版本: $(uname -rs)"
|
||||||
echo -e " 固件版本: ${Skyb}${CURRENT_Version}${White}"
|
echo -e " 固件版本: ${Skyb}${CURRENT_Version}${White}"
|
||||||
echo " IP 地址 : ${IP_Address}"
|
echo " IP 地址 : ${IP_Address}"
|
||||||
echo " 可用空间: ${Overlay_Available}"
|
echo " 可用空间: ${Overlay_Available} / ${Tmp_Available}"
|
||||||
[ -n "${CoreMark}" ] && echo " 性能得分: ${CoreMark}"
|
[ -n "${CoreMark}" ] && echo " 性能得分: ${CoreMark}"
|
||||||
echo " 运行时间: ${Startup}"
|
echo " 运行时间: ${Startup}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -25,26 +26,17 @@ export Red="\e[31m"
|
||||||
export Blue="\e[34m"
|
export Blue="\e[34m"
|
||||||
export Skyb="\e[36m"
|
export Skyb="\e[36m"
|
||||||
|
|
||||||
clear
|
|
||||||
[ -e /tmp/.failsafe ] && export FAILSAFE=1
|
[ -e /tmp/.failsafe ] && export FAILSAFE=1
|
||||||
[ -f /etc/banner ] && {
|
|
||||||
echo -e "$Skyb"
|
[ -f /etc/banner ] && cat /etc/banner
|
||||||
cat /etc/banner
|
[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
|
||||||
echo -e "$White"
|
|
||||||
}
|
|
||||||
[ -n "$FAILSAFE" ] && {
|
|
||||||
echo -e "$Red"
|
|
||||||
cat /etc/banner.failsafe
|
|
||||||
echo -e "$White"
|
|
||||||
}
|
|
||||||
fgrep -sq '/ overlay ro,' /proc/mounts && {
|
fgrep -sq '/ overlay ro,' /proc/mounts && {
|
||||||
echo -e "$Red"
|
echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
|
||||||
echo "警告: 您的固件空间已满,接下来保存的数据将会面临丢失的风险."
|
echo 'Please try to remove files from /overlay/upper/... and reboot!'
|
||||||
echo "请尝试从 /overlay 删除一些文件并重启设备!"
|
|
||||||
echo -e "$White"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
export PATH="%PATH%"
|
||||||
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
||||||
export HOME=${HOME:-/root}
|
export HOME=${HOME:-/root}
|
||||||
export PS1='\u@\h:\w\$ '
|
export PS1='\u@\h:\w\$ '
|
||||||
|
|
@ -57,21 +49,23 @@ case "$TERM" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$FAILSAFE" ] || {
|
[ -n "$FAILSAFE" ] || {
|
||||||
for FILE in /etc/profile.d/*.sh
|
for FILE in /etc/profile.d/*.sh; do
|
||||||
do
|
|
||||||
[ -e "$FILE" ] && . "$FILE"
|
[ -e "$FILE" ] && . "$FILE"
|
||||||
done
|
done
|
||||||
unset FILE
|
unset FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
service() {
|
if ( grep -qs '^root::' /etc/shadow && \
|
||||||
[ -f "/etc/init.d/$1" ] || {
|
[ -z "$FAILSAFE" ] )
|
||||||
echo -e "${Red}service "'"'"$1"'"'" not found, the following services are available:${White}\n"
|
then
|
||||||
ls "/etc/init.d"
|
cat << EOF
|
||||||
return 1
|
=== WARNING! =====================================
|
||||||
}
|
There is no root password defined on this device!
|
||||||
/etc/init.d/$@
|
Use the "passwd" command to set up a new password
|
||||||
}
|
in order to prevent unauthorized SSH logins.
|
||||||
|
--------------------------------------------------
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
Sysinfo
|
Sysinfo
|
||||||
alias reload='clear && /etc/profile'
|
alias reload='clear && /etc/profile'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue