diff --git a/src/python/jw/pkg/cmds/CmdDistro.py b/src/python/jw/pkg/cmds/CmdDistro.py index 678fb4f9..c471ea20 100644 --- a/src/python/jw/pkg/cmds/CmdDistro.py +++ b/src/python/jw/pkg/cmds/CmdDistro.py @@ -22,10 +22,10 @@ class CmdDistro(CmdBase): # export else: os_release = '/etc/os-release' with open(os_release, 'r') as file: - matches = re.findall(r'^ID="?([^"]+)"?$', file.read(), re.MULTILINE) - if len(matches) != 1: + m = re.search(r'^\s*ID\s*=\s*("?)([^"\n]+)\1\s*$', file.read(), re.MULTILINE) + if m is None: raise Exception(f'Could not read "ID=" from "{os_release}"') - self.__id = matches[0] + self.__id = m.group(2) return self.__id def add_arguments(self, p: ArgumentParser) -> None: