FDS/OS 1.0
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Apply the FDS-owned layout to a new, empty image staging directory."""
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
root = pathlib.Path(sys.argv[1])
|
||||
layout = json.loads(pathlib.Path(sys.argv[2]).read_text())
|
||||
if any(root.iterdir()):
|
||||
sys.exit("ERROR: layout must be applied to an empty root")
|
||||
for path, mode in layout["directories"].items():
|
||||
target = root / path
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
target.chmod(int(mode, 8))
|
||||
for path, target in layout["symlinks"].items():
|
||||
(root / path).symlink_to(target)
|
||||
Reference in New Issue
Block a user