refactor(darwin): make uname use portable between Darwin and Linux

This commit is contained in:
Martin Wimpress 2024-05-14 17:04:23 +01:00 committed by Martin Wimpress
parent c30c4612b5
commit 6000546e35
1 changed files with 4 additions and 9 deletions

View File

@ -1028,9 +1028,9 @@ function vm_boot() {
VGA=""
VIDEO=""
KERNEL_NAME="$(${UNAME} --kernel-name)"
KERNEL_NODE="$(${UNAME} --nodename)"
KERNEL_VER="$(${UNAME} --kernel-release | cut -d'.' -f1-2)"
KERNEL_NAME="$(uname -s)"
KERNEL_NODE="$(uname -n | cut -d'.' -f 1)"
KERNEL_VER="$(uname -r)"
if [ -e /etc/os-release ]; then
LSB_DESCRIPTION=$(grep PRETTY_NAME /etc/os-release | cut -d'"' -f2)
@ -1763,18 +1763,13 @@ if [ ! -e "${QEMU}" ] || [ ! -e "${QEMU_IMG}" ]; then
fi
# Check for gnu tools on macOS
UNAME="uname"
if command -v guname &>/dev/null; then
UNAME="guname"
fi
STAT="stat"
if command -v gstat &>/dev/null; then
STAT="gstat"
fi
DARWIN=0
if [ "${UNAME}" == "Darwin" ]; then
if [ "$(uname -s)" == "Darwin" ]; then
DARWIN=1
fi