From 17d562e75f1866b765ae2bdaa65f0fa4e3e37bab Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 24 Aug 2019 23:18:18 +0200 Subject: [PATCH] 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 --- stages/org.osbuild.fstab | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 stages/org.osbuild.fstab diff --git a/stages/org.osbuild.fstab b/stages/org.osbuild.fstab new file mode 100755 index 00000000..851afa98 --- /dev/null +++ b/stages/org.osbuild.fstab @@ -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)