From 735994f82ea47118aa31278af1c9a596d35469ed Mon Sep 17 00:00:00 2001 From: Paul Gierz Date: Fri, 7 Sep 2018 11:52:21 +0200 Subject: [PATCH 1/2] Fix for #974 --- functions/utilities.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 127007fb..cedf5493 100755 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -102,7 +102,9 @@ case $(uname) in ;; Linux) OS='Linux' - os_release_id="$(grep -E '^ID=([a-zA-Z]*)' /etc/os-release | cut -d '=' -f 2)" + if [ -f /etc/os-release ]; then + os_release_id="$(grep -E '^ID=([a-zA-Z]*)' /etc/os-release | cut -d '=' -f 2)" + fi case "$os_release_id" in *arch*) OS_ICON=$(print_icon 'LINUX_ARCH_ICON') From 938b0d49a13c2d69181595234e9eda4d72049396 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 23 Jan 2019 23:11:01 +0100 Subject: [PATCH 2/2] Avoid externals when parsing the os release on linux --- functions/utilities.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index cedf5493..95f89d99 100755 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -103,7 +103,7 @@ case $(uname) in Linux) OS='Linux' if [ -f /etc/os-release ]; then - os_release_id="$(grep -E '^ID=([a-zA-Z]*)' /etc/os-release | cut -d '=' -f 2)" + [[ ${(f)"$((/dev/null)"} =~ "ID=([A-Za-z]+)" ]] && os_release_id="${match[1]}" fi case "$os_release_id" in *arch*)