Check /usr/lib/os-release in addition to /etc/os-release
This commit is contained in:
parent
aa9fc8646a
commit
253d1f6021
1 changed files with 5 additions and 2 deletions
|
@ -34,8 +34,11 @@ JINJA_ENV = jinja2.Environment(
|
|||
lstrip_blocks=True)
|
||||
|
||||
def get_default_target():
|
||||
# TODO: add fallback for /usr/lib/os-release
|
||||
with open("/etc/os-release") as os_release_file:
|
||||
try:
|
||||
os_release_file = open('/etc/os-release')
|
||||
except FileNotFoundError:
|
||||
os_release_file = open('/usr/lib/os-release')
|
||||
with os_release_file:
|
||||
conf = configparser.ConfigParser()
|
||||
conf.read_file(itertools.chain(["[os-release]"], os_release_file))
|
||||
os_release = conf["os-release"]
|
||||
|
|
Loading…
Reference in a new issue