qvm-template: Eliminate use of lsb_release
This commit is contained in:
parent
2e06e300e6
commit
32a38c7183
@ -41,8 +41,16 @@ def qubes_release() -> str:
|
|||||||
with open('/usr/share/qubes/marker-vm', 'r') as fd:
|
with open('/usr/share/qubes/marker-vm', 'r') as fd:
|
||||||
# Get last line (in the format `x.x`)
|
# Get last line (in the format `x.x`)
|
||||||
return fd.readlines()[-1].strip()
|
return fd.readlines()[-1].strip()
|
||||||
return subprocess.check_output(['lsb_release', '-sr'],
|
with open('/etc/os-release', 'r') as fd:
|
||||||
encoding='UTF-8').strip()
|
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:
|
def parser_gen() -> argparse.ArgumentParser:
|
||||||
"""Generate argument parser for the application."""
|
"""Generate argument parser for the application."""
|
||||||
|
Loading…
Reference in New Issue
Block a user