]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
fix OS name detection
authorDaniel Molkentin <dmolkentin@suse.com>
Thu, 17 Sep 2020 22:15:04 +0000 (00:15 +0200)
committerLukas Schauer <lukas2511@users.noreply.github.com>
Sun, 27 Sep 2020 18:35:18 +0000 (20:35 +0200)
before applying heuristics, use PRETTY_NAME from os-release(3),
which reliably exists on all common linux distributions.

keep the /etc/issue parsing as fallback.

dehydrated

index dbbebbbab84d7e04d0fe7307abaa1c5b04093725..dad9f9fdaa52f69b2f56da6101e8bcfbbe4ca7ee 100755 (executable)
@@ -1369,6 +1369,10 @@ command_version() {
   echo ""
   if [[ "${OSTYPE}" =~ "BSD" ]]; then
     echo "OS: $(uname -sr)"
+  elif [[ -e /etc/os-release ]]; then
+    ( . /etc/os-release && echo "OS: $PRETTY_NAME" )
+  elif [[ -e /usr/lib/os-release ]]; then
+    ( . /usr/lib/os-release && echo "OS: $PRETTY_NAME" )
   else
     echo "OS: $(cat /etc/issue | grep -v ^$ | head -n1 | _sed 's/\\(r|n|l) .*//g')"
   fi