From 2c7cdf816b560dba7c5387c1234b349b82df3ab4 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Sat, 20 May 2023 11:22:33 +0000 Subject: [PATCH] refactor: lazy load os-release --- src/script.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/script.sh b/src/script.sh index 9a39e24..5b07c35 100644 --- a/src/script.sh +++ b/src/script.sh @@ -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