refactor: lazy load os-release

This commit is contained in:
Ming Di Leom 2023-05-20 11:22:33 +00:00
parent f85f5fe538
commit 2c7cdf816b
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 5 additions and 2 deletions

View File

@ -14,8 +14,11 @@ alias mkdir="mkdir -p"
alias rm="rm -rf"
## Use GNU grep, busybox grep is not as performant
. "/etc/os-release"
DISTRO="$ID"
DISTRO=""
if [ -f "/etc/os-release" ]; then
. "/etc/os-release"
DISTRO="$ID"
fi
check_grep() {
if [ -z "$(grep --help | grep 'GNU')" ]; then