[explorer/os_release] Add fallbacks to /usr/lib/os-release and /var/run/os-release
This commit is contained in:
parent
0f420993e1
commit
984e0dc8c4
1 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2018 Adam Dej (dejko.a at gmail.com)
|
# 2018 Adam Dej (dejko.a at gmail.com)
|
||||||
|
# 2020 Dennis Camera (dennis.camera at ssrq-sds-fds.ch)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -21,6 +22,17 @@
|
||||||
|
|
||||||
# See os-release(5) and http://0pointer.de/blog/projects/os-release
|
# See os-release(5) and http://0pointer.de/blog/projects/os-release
|
||||||
|
|
||||||
set +e
|
if test -f /etc/os-release
|
||||||
|
then
|
||||||
|
# Linux and FreeBSD (usually a symlink)
|
||||||
|
cat /etc/os-release
|
||||||
|
elif test -f /usr/lib/os-release
|
||||||
|
then
|
||||||
|
# systemd
|
||||||
|
cat /usr/lib/os-release
|
||||||
|
elif test -f /var/run/os-release
|
||||||
|
then
|
||||||
|
# FreeBSD (created by os-release service)
|
||||||
|
cat /var/run/os-release
|
||||||
|
fi
|
||||||
|
|
||||||
cat /etc/os-release || cat /usr/lib/os-release || true
|
|
||||||
|
|
Loading…
Reference in a new issue