summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-06-13 21:01:49 +0300
committerMaxim Devaev <[email protected]>2022-06-13 21:01:49 +0300
commit6eb02a2bd5d1f4d326651432f095b9c97a239182 (patch)
treea2792b6c6d63d390f777d2be350e4094a7aa5852
parentb906d7f74c88475b729533a9a387c2891798db50 (diff)
Revert "deprecated X-kvmd.[otgmsd|pst]-root"
This reverts commit b906d7f74c88475b729533a9a387c2891798db50.
-rw-r--r--kvmd/helpers/remount/__init__.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/kvmd/helpers/remount/__init__.py b/kvmd/helpers/remount/__init__.py
index 0fee683f..960339f3 100644
--- a/kvmd/helpers/remount/__init__.py
+++ b/kvmd/helpers/remount/__init__.py
@@ -38,7 +38,8 @@ _FSTAB_PATH = "/etc/fstab"
# =====
@dataclasses.dataclass(frozen=True)
class _Storage:
- path: str
+ mount_path: str
+ root_path: str
user: str
@@ -55,10 +56,11 @@ def _find_storage(target: str) -> _Storage:
if line and not line.startswith("#"):
parts = line.split()
if len(parts) == 6:
- options = dict(re.findall(r"X-kvmd\.%s-(user)=([^,]+)" % (target), parts[3]))
+ options = dict(re.findall(r"X-kvmd\.%s-(root|user)=([^,]+)" % (target), parts[3]))
if options:
return _Storage(
- path=parts[1],
+ mount_path=parts[1],
+ root_path=options.get("root", ""),
user=options.get("user", ""),
)
raise SystemExit(f"Can't find {target!r} mountpoint in {_FSTAB_PATH}")
@@ -110,10 +112,10 @@ def main() -> None:
rw = (sys.argv[1] == "rw")
storage = _find_storage(target)
- _remount(storage.path, rw)
- if rw:
+ _remount(storage.mount_path, rw)
+ if rw and storage.root_path:
for name in dirs:
- path = os.path.join(storage.path, name)
+ path = os.path.join(storage.root_path, name)
_mkdir(path)
if storage.user:
_chown(path, storage.user)