index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2022-05-18 11:28:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 11:28:59 +0200 |
commit | 493cccc18fa8c77c362b6abee2c3dc89d331c792 (patch) | |
tree | 5778ffbf361ecf80360b4848bc683c8387965d9a /archinstall/lib/udev | |
parent | 561ea7e8f5c326312cc61c03d1b2329111f7634b (diff) |
-rw-r--r-- | archinstall/lib/udev/__init__.py | 1 | ||||
-rw-r--r-- | archinstall/lib/udev/udevadm.py | 17 |
diff --git a/archinstall/lib/udev/__init__.py b/archinstall/lib/udev/__init__.py new file mode 100644 index 00000000..86c8cc29 --- /dev/null +++ b/archinstall/lib/udev/__init__.py @@ -0,0 +1 @@ +from .udevadm import udevadm_info
\ No newline at end of file diff --git a/archinstall/lib/udev/udevadm.py b/archinstall/lib/udev/udevadm.py new file mode 100644 index 00000000..84ec9cfd --- /dev/null +++ b/archinstall/lib/udev/udevadm.py @@ -0,0 +1,17 @@ +import typing +import pathlib +from ..general import SysCommand + +def udevadm_info(path :pathlib.Path) -> typing.Dict[str, str]: + if path.resolve().exists() is False: + return {} + + result = SysCommand(f"udevadm info {path.resolve()}") + data = {} + for line in result: + if b': ' in line and b'=' in line: + _, obj = line.split(b': ', 1) + key, value = obj.split(b'=', 1) + data[key.decode('UTF-8').lower()] = value.decode('UTF-8').strip() + + return data
\ No newline at end of file |