20 lines
443 B
Python
20 lines
443 B
Python
from __future__ import annotations
|
|
|
|
from os import getuid
|
|
from pathlib import Path
|
|
|
|
from typing import Any
|
|
|
|
DISK_BY_UUID = Path("/dev/disk/by-uuid")
|
|
MAPPER_PATH = Path("/dev/mapper")
|
|
|
|
|
|
def assert_type(instance: Any, object_type: Any, message: str) -> None:
|
|
if not isinstance(instance, object_type):
|
|
raise TypeError(message)
|
|
|
|
|
|
def verify_running_as_root() -> None:
|
|
if getuid() > 0:
|
|
raise PermissionError("Run as root.")
|