about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-08-03 15:57:24 +0200
committerGitHub <noreply@github.com>2023-08-03 15:57:24 +0200
commit2a1f1797be6e4125ade0be6ac32bb70106ff7245 (patch)
tree0623c2c7d1d0b3d54bcdf25742f7dbbc60f0a5f4 /nixos
parent939ba40498564c0bd6fc54fe43b9181a0c3627b7 (diff)
parent5fd478506d4867e52311d63cb56dc5e01c0f46ad (diff)
Merge pull request #246941 from yaxitech/image-amend-repart-r13y
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/image/amend-repart-definitions.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/nixos/modules/image/amend-repart-definitions.py b/nixos/modules/image/amend-repart-definitions.py
index e50ed6fd39a79..52f10303eb5ea 100644
--- a/nixos/modules/image/amend-repart-definitions.py
+++ b/nixos/modules/image/amend-repart-definitions.py
@@ -15,8 +15,6 @@ files using the same mechanism.
 import json
 import sys
 import shutil
-import os
-import tempfile
 from pathlib import Path
 
 
@@ -92,12 +90,13 @@ def main() -> None:
         print("Partition config is empty.")
         sys.exit(1)
 
-    temp = tempfile.mkdtemp()
-    shutil.copytree(repart_definitions, temp, dirs_exist_ok=True)
+    target_dir = Path("amended-repart.d")
+    target_dir.mkdir()
+    shutil.copytree(repart_definitions, target_dir, dirs_exist_ok=True)
 
     for name, config in partition_config.items():
-        definition = Path(f"{temp}/{name}.conf")
-        os.chmod(definition, 0o644)
+        definition = target_dir.joinpath(f"{name}.conf")
+        definition.chmod(0o644)
 
         contents = config.get("contents")
         add_contents_to_definition(definition, contents)
@@ -106,7 +105,7 @@ def main() -> None:
         strip_nix_store_prefix = config.get("stripStorePaths")
         add_closure_to_definition(definition, closure, strip_nix_store_prefix)
 
-    print(temp)
+    print(target_dir.absolute())
 
 
 if __name__ == "__main__":