!94 恢复openEuler-release对bc的依赖

From: @yaokai13
Reviewed-by: @miao_kaibo
Signed-off-by: @miao_kaibo
This commit is contained in:
openeuler-ci-bot 2021-11-29 09:10:01 +00:00 committed by Gitee
commit 1577b44b5f
2 changed files with 18 additions and 6 deletions

View File

@ -13,19 +13,28 @@
welcome=$(uname -r)
# Memory
memory_total=$(free -m | awk '/Mem:/ { printf($2)}')
memory_total=$(cat /proc/meminfo | awk '/^MemTotal:/ {printf($2)}')
memory_free=$(cat /proc/meminfo | awk '/^MemFree:/ { printf($2)}')
buffers=$(cat /proc/meminfo | awk '/^Buffers:/ { printf($2)}')
cached=$(cat /proc/meminfo | awk '/^Cached:/ { printf($2)}')
sreclaimable=$(cat /proc/meminfo | awk '/^SReclaimable:/ { printf($2)}')
swap_total=$(cat /proc/meminfo | awk '/^SwapTotal:/ { printf($2)}')
swap_free=$(cat /proc/meminfo | awk '/^SwapFree:/ { printf($2)}')
if [ $memory_total -gt 0 ]
then
memory_usage=$(free -m | awk '/Mem:/ { printf("%3.1f%%", $3/$2*100)}')
memory_usage=`echo "scale=1; ($memory_total - $memory_free - $buffers - $cached - $sreclaimable) * 100.0 / $memory_total" |bc`
memory_usage="${memory_usage}%"
else
memory_usage=0.0%
fi
# Swap memory
swap_total=$(free -m | awk '/Swap:/ { printf($2)}')
if [ $swap_total -gt 0 ]
then
swap_mem=$(free -m | awk '/Swap:/ { printf("%3.1f%%", $3/$2*100)}')
swap_mem=`echo "scale=1; ($swap_total - $swap_free) * 100.0 / $swap_total" |bc`
swap_mem="${swap_mem}%"
else
swap_mem=0.0%
fi

View File

@ -4,7 +4,7 @@
%define variant_lowercase server
%define dist_release_version 8
%define generic_version 21.09
%define generic_release 49
%define generic_release 50
%define builtin_release_version 1.0
%define current_arch %{_arch}
@ -27,7 +27,7 @@ Source2: 90-default.preset
Source3: 99-default-disable.preset
BuildRequires: python3
Requires: %{product_family}-repos
Requires: %{product_family}-repos bc
Obsoletes: yum-utils yum-utils-help yum-utils-plugins
%description
@ -135,6 +135,9 @@ rm -rf $RPM_BUILD_ROOT
/etc/profile.d/performance.sh
%changelog
* Mon Nov 29 2021 yaokai <yaokai13@huawei.com> - 1.0.50
- recover the dependency for bc
* Mon Nov 22 2021 miao_kaibo <miaokaibo@outlook.com> - 1.0-49
- delete dependency bc