Skip to content

Commit

Permalink
base: fix xx-info failing on macOS, set default vendor to "unknown"
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
thaJeztah committed Jul 7, 2022
1 parent 3bceb46 commit c5f2a6a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions base/xx-info
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down

0 comments on commit c5f2a6a

Please sign in to comment.