From eac387d50335d0266aaadec477a32ecf688f3f03 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 7 Jul 2022 13:58:15 +0200 Subject: [PATCH] base: fix xx-info failing on macOS macOS doesn't have a /etc/os-release, which caused the script to fail when running on the host. Also adds detection if /etc/os-release exists. Signed-off-by: Sebastiaan van Stijn --- base/xx-info | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/base/xx-info b/base/xx-info index 9a60b76..638cc00 100755 --- a/base/xx-info +++ b/base/xx-info @@ -99,13 +99,13 @@ if [ -n "$TARGETPLATFORM" ]; then fi # detect distro vendor -# shellcheck disable=SC1091 -if . /etc/os-release 2>/dev/null; then - XX_VENDOR=$ID -fi - if [ "$TARGETOS" = "darwin" ]; then XX_VENDOR="apple" +elif [ -f /etc/os-release ]; then + # shellcheck disable=SC1091 + if . /etc/os-release 2>/dev/null; then + XX_VENDOR=$ID + fi fi vendor="" @@ -328,7 +328,7 @@ case "$1" in echo $XX_TRIPLE ;; "vendor") - echo $XX_VENDOR + echo "$XX_VENDOR" ;; "libc") # this is not abi, just the prefix echo $XX_LIBC