From bdad1de09b0b1e885772b9043cdf1798a6c4758b Mon Sep 17 00:00:00 2001 From: minoplhy Date: Mon, 3 Feb 2025 23:03:31 +0700 Subject: [PATCH] Gitea-ui-customized: update 7-test-suite: init --- 7-test-suite/vpsinfo.sh | 30 +++++++++++++++++++ .../templates/base/head_navbar.tmpl | 14 ++++----- 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 7-test-suite/vpsinfo.sh diff --git a/7-test-suite/vpsinfo.sh b/7-test-suite/vpsinfo.sh new file mode 100644 index 0000000..bce4012 --- /dev/null +++ b/7-test-suite/vpsinfo.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# +# 7 Test Suite +# + + +CPU_INFO=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//') +CPU_AES=$(grep aes /proc/cpuinfo) +CPU_VIRT=$(lscpu | grep "Virtualization:" | awk '{print $2}') +CPU_VIRT_VENDOR=$(systemd-detect-virt 2>/dev/null) + +MEM_TOTAL=$(free -h | awk 'NR==2 {print $2}') +MEM_READ_SPEED=$(sysbench memory --memory-oper=read run | grep -i transferred | grep -o '[0-9]\+\.[0-9]\+ MiB/sec') +MEM_WRITE_SPEED=$(sysbench memory --memory-oper=write run | grep -i transferred | grep -o '[0-9]\+\.[0-9]\+ MiB/sec') + +DISK_TOTAL=$(df -h -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs -t swap -t exfat --total 2>/dev/null | grep total | awk '{ print $2 }') + +[[ -z "$CPU_AES" ]] || CPU_AES="yes" + +echo "{{< vpsinfo +cpu=\"$CPU_INFO\" +aesni=\"$CPU_AES\" +virt=\"$CPU_VIRT\" +hypervisor=\"$CPU_VIRT_VENDOR\" +memory_total=\"$MEM_TOTAL\" +memory_read=\"$MEM_READ_SPEED\" +memory_write=\"$MEM_WRITE_SPEED\" +disk_total=\"$DISK_TOTAL\" +>}}" \ No newline at end of file diff --git a/Gitea-ui-customized/templates/base/head_navbar.tmpl b/Gitea-ui-customized/templates/base/head_navbar.tmpl index e586b79..fbaf296 100644 --- a/Gitea-ui-customized/templates/base/head_navbar.tmpl +++ b/Gitea-ui-customized/templates/base/head_navbar.tmpl @@ -11,7 +11,7 @@ -