install: adjustment to account for /etc/os-release that does not have an ID_LIKE field

This commit is contained in:
Blake Harnden 2020-12-11 18:46:29 -08:00
parent e7320a61a6
commit d6b95bab24

View file

@ -100,6 +100,7 @@ class OsInfo:
if not os_like: if not os_like:
like = " ".join(like) like = " ".join(like)
print(f"unsupported os install type({like})") print(f"unsupported os install type({like})")
print("trying using the -i option to specify an install type")
sys.exit(1) sys.exit(1)
if version: if version:
try: try:
@ -141,7 +142,7 @@ def get_os(install_type: Optional[str]) -> OsInfo:
key, value = line.split("=") key, value = line.split("=")
d[key] = value.strip("\"") d[key] = value.strip("\"")
name_value = d["ID"] name_value = d["ID"]
like_value = d["ID_LIKE"] like_value = d.get("ID_LIKE", "")
version_value = d["VERSION_ID"] version_value = d["VERSION_ID"]
return OsInfo.get(name_value, like_value.split(), version_value) return OsInfo.get(name_value, like_value.split(), version_value)