feat: Display emulated CPU

This commit is contained in:
Kroese 2023-12-16 01:00:42 +01:00 committed by GitHub
parent f1fbbb5623
commit c335078aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,17 +10,22 @@ set -Eeuo pipefail
: ${HOST_MODEL:=''}
: ${GUEST_SERIAL:=''}
if [ -z "$HOST_CPU" ]; then
if [ -z "$HOST_CPU" ] && [ "$CPU_MODEL" == "host" ]; then
HOST_CPU=$(lscpu | grep 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')
fi
if [ -n "$HOST_CPU" ]; then
HOST_CPU="$HOST_CPU,,"
HOST_CPU="${HOST_CPU%%,*},,"
else
if [ "$ARCH" == "amd64" ]; then
HOST_CPU="QEMU, Virtual CPU, X86_64"
if [ "$CPU_MODEL" == "host" ]; then
HOST_CPU="QEMU"
else
HOST_CPU="QEMU, Virtual CPU, $ARCH"
HOST_CPU="${CPU_MODEL%%,*}"
fi
if [ "$ARCH" == "amd64" ]; then
HOST_CPU="${HOST_CPU%%,*}, Virtual CPU, X86_64"
else
HOST_CPU="${HOST_CPU%%,*}, Virtual CPU, $ARCH"
fi
fi