This commit is contained in:
Marc Beninca 2024-09-13 15:53:20 +02:00
parent e306971534
commit 63d30013a3
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,3 +1,5 @@
"""Operations involving FileSystems."""
import os import os
import shutil import shutil
@ -6,7 +8,8 @@ from rwx import ps
CHARSET = "UTF-8" CHARSET = "UTF-8"
def create_image(file_path: str, size_bytes: int): def create_image(file_path: str, size_bytes: int) -> None:
"""Create a virtual device image file."""
ps.run( ps.run(
("qemu-img", "create"), ("qemu-img", "create"),
("-f", "qcow2"), ("-f", "qcow2"),
@ -14,11 +17,13 @@ def create_image(file_path: str, size_bytes: int):
) )
def empty_file(path: str): def empty_file(path: str) -> None:
"""Empty the file at provided path."""
write(path, "") write(path, "")
def get_mount_uuid(path: str): def get_mount_uuid(path: str) -> str:
"""Return the UUID of provided mountpoint path."""
return ps.run_line( return ps.run_line(
("findmnt",), ("findmnt",),
("--noheadings",), ("--noheadings",),