mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-03-30 05:41:48 +02: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 ""
|
echo ""
|
||||||
if [[ "${OSTYPE}" =~ "BSD" ]]; then
|
if [[ "${OSTYPE}" =~ "BSD" ]]; then
|
||||||
echo "OS: $(uname -sr)"
|
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
|
else
|
||||||
echo "OS: $(cat /etc/issue | grep -v ^$ | head -n1 | _sed 's/\\(r|n|l) .*//g')"
|
echo "OS: $(cat /etc/issue | grep -v ^$ | head -n1 | _sed 's/\\(r|n|l) .*//g')"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user