stages/fstab: add a stage to specify the fstab to be installed

This will allow us to boot in 'ro' mode, and remount later on.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-08-24 23:18:18 +02:00 committed by Lars Karlitski
parent 8398be54a4
commit 17d562e75f

25
stages/org.osbuild.fstab Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/python3
import json
import sys
def main(tree, options):
filesystems = options["filesystems"]
with open(f"{tree}/etc/fstab", "w") as f:
for filesystem in filesystems:
uuid = filesystem["uuid"]
path = filesystem["path"]
vfs_type = filesystem.get("vfs_type", "none")
options = filesystem.get("options", "defaults")
freq = filesystem.get("freq", "0")
passno = filesystem.get("passno", "0")
f.write(f"UUID={uuid}\t{path}\t{vfs_type}\t{options}\t{freq}\t{passno}\n")
if __name__ == '__main__':
args = json.load(sys.stdin)
r = main(args["tree"], args["options"])
sys.exit(r)