!60 modify system-info.sh to show more ip address when login and fix /sbin/ip not found error

From: @si-gui
Reviewed-by: @overweight
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2021-07-09 08:10:23 +00:00 committed by Gitee
commit cedd46a1cc
2 changed files with 16 additions and 5 deletions

View File

@ -49,8 +49,11 @@ processes=$(ps aux | wc -l)
user_num=$(users | wc -w)
# Ip address
ip_pre=$(/sbin/ip a|grep inet|grep -v 127.0.0.1|grep -v inet6 | awk '{print $2}' | head -1)
ip_address=${ip_pre%/*}
ip_pre=""
if [ -x "/sbin/ip" ]
then
ip_pre=$(/sbin/ip a | grep inet | grep -v "127.0.0.1" | grep -v inet6 | awk '{print $2}')
fi
echo -e "\n"
echo -e "Welcome to $welcome\n"
@ -60,8 +63,12 @@ echo -e "Processes: \t$processes"
echo -e "Memory used: \t$memory_usage"
echo -e "Swap used: \t$swap_mem"
echo -e "Usage On: \t$usageof"
echo -e "IP address: \t$ip_address"
echo -e "Users online: \t$user_num\n"
for line in $ip_pre
do
ip_address=${line%/*}
echo -e "IP address: \t$ip_address"
done
echo -e "Users online: \t$user_num"
if [ "$whoiam"=="root" ]
then
echo -e "\n"

View File

@ -5,7 +5,7 @@
%define dist_release_version 8
%define generic_version 20.03
%define generic_patch_level LTS
%define generic_release 39
%define generic_release 40
%define builtin_release_version 1.0
%define current_arch %{_arch}
@ -169,6 +169,10 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) /root/.cshrc
%changelog
* Fri 09 Jul 2021 sunguoshuai <sunguoshuai@huawei.com> - 1.0-40
- modify system-info.sh to show more ip address when login
- /sbin/ip not found err fix
* Tue May 18 2021 solar.hu <solar.hu@foxmail.com> - 1.0-39
- Disable for GOMP issue with rpmbuild