mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-01-17 08:56:53 +01:00
fix OS name detection
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.
This commit is contained in:
committed by
Lukas Schauer
parent
b3abc41dbe
commit
5f8cfa50ba
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user