Skip to content

Commit

Permalink
qvm-template: Eliminate use of lsb_release
Browse files Browse the repository at this point in the history
  • Loading branch information
WillyPillow committed Aug 29, 2020
1 parent 2e06e30 commit 32a38c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions qubesadmin/tools/qvm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,16 @@ def qubes_release() -> str:
with open('/usr/share/qubes/marker-vm', 'r') as fd:
# Get last line (in the format `x.x`)
return fd.readlines()[-1].strip()
return subprocess.check_output(['lsb_release', '-sr'],
encoding='UTF-8').strip()
with open('/etc/os-release', 'r') as fd:
for line in fd:
line = line.strip()
if not line or line[0] == '#':
continue
key, val = line.split('=', 1)
if key != 'VERSION_ID':
continue
val = val.strip('\'"') # strip possible quotes
return val

def parser_gen() -> argparse.ArgumentParser:
"""Generate argument parser for the application."""
Expand Down

0 comments on commit 32a38c7

Please sign in to comment.