From c5f2a6a3dab768a866be3695606f81c14fb1b969 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, set default vendor to "unknown" 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, and setting vendor to "unknown" as a default. Signed-off-by: Sebastiaan van Stijn --- base/xx-info | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/base/xx-info b/base/xx-info index 9a60b76..b119148 100755 --- a/base/xx-info +++ b/base/xx-info @@ -99,13 +99,14 @@ if [ -n "$TARGETPLATFORM" ]; then fi # detect distro vendor -# shellcheck disable=SC1091 -if . /etc/os-release 2>/dev/null; then - XX_VENDOR=$ID -fi - +XX_VENDOR="unknown" 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=""