From c4a7c48dd9061acaeb0d828b5fe307fd0bf8d1e2 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 24 Jul 2019 16:51:20 +0200 Subject: [PATCH] libstd.bash: fix issue in getting OS release - try to get the OS release via lsb_release first - then via /etc/os-release - abort if both fail --- Pmodules/libstd.bash | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Pmodules/libstd.bash b/Pmodules/libstd.bash index 8447915..544f435 100644 --- a/Pmodules/libstd.bash +++ b/Pmodules/libstd.bash @@ -272,7 +272,19 @@ There is NO WARRANTY, to the extent permitted by law." } std.get_os_release_linux() { - source /etc/os-release + local lsb_release=$(which lsb_release) + local ID='' + local VERSION_ID='' + + if [[ -n $(which lsb_release) ]]; then + ID=$(lsb_release -is) + VERSION_ID=$(lsb_release -rs) + elif [[ -r '/etc/os-release' ]]; then + source /etc/os-release + else + std::die 4 "Cannot determin OS release!\n" + fi + case "${ID}" in science | rhel | centos | fedora ) echo "rhel${VERSION_ID%.*}"