summaryrefslogtreecommitdiff
path: root/kvmd/helpers
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-08-20 07:13:52 +0300
committerMaxim Devaev <[email protected]>2024-08-20 07:14:28 +0300
commit721a80ef03ffe43c832f1942d057c6250472c149 (patch)
tree0f0789f2db78f4150164462a7ed8978c0550b592 /kvmd/helpers
parenta55948bf8e381eebedf4206f70969805d2dc805b (diff)
fixed pst chgrp and chmod
Diffstat (limited to 'kvmd/helpers')
-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 716b9c72..b8e71e4f 100644
--- a/kvmd/helpers/remount/__init__.py
+++ b/kvmd/helpers/remount/__init__.py
@@ -22,6 +22,7 @@
import sys
import os
+import stat
import pwd
import grp
import shutil
@@ -103,11 +104,12 @@ def _chgrp(path: str, group: str) -> None:
def _chmod(path: str, mode: int) -> None:
- _log(f"CHMOD --- 0o{mode:o} - {path}")
- try:
- os.chmod(path, mode)
- except Exception as err:
- raise SystemExit(f"Can't change permissions: {err}")
+ if stat.S_IMODE(os.stat(path).st_mode) != mode:
+ _log(f"CHMOD --- 0o{mode:o} - {path}")
+ try:
+ os.chmod(path, mode)
+ except Exception as err:
+ raise SystemExit(f"Can't change permissions: {err}")
# =====
@@ -141,7 +143,7 @@ def _fix_pst(part: Partition) -> None:
_chown(part.root_path, part.user)
_chown(path, part.user)
if part.group:
- _chown(part.root_path, part.group)
+ _chgrp(part.root_path, part.group)
_chgrp(path, part.group)
if part.user and part.group:
_chmod(part.root_path, 0o1775)