diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-07-26 11:12:35 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-07-26 12:01:58 +0100 |
commit | 7fa0fe6fca5af3fc9b917ee6e10239efc265b1aa (patch) | |
tree | 8eece0119eb0cfac9bda13e7df023d4493d61048 /morphlib/builder2.py | |
parent | 05fe245d1771ec25d8675b2dd9e4aeee6b22802c (diff) | |
download | morph-7fa0fe6fca5af3fc9b917ee6e10239efc265b1aa.tar.gz |
Move fstab creation into base class
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r-- | morphlib/builder2.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index dd3c530b..83f5ae84 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -530,6 +530,26 @@ class SystemKindBuilder(BuilderBase): # pragma: no cover ldconfig(self.app.runcmd, path) + def create_fstab(self, path): + '''Create an /etc/fstab inside a system tree. + + The fstab is created using assumptions of the disk layout. + If the assumptions are wrong, extend this code so it can deal + with other cases. + + ''' + + self.app.status(msg='Creating fstab in %(path)s', + path=path, chatty=True) + with self.build_watch('create-fstab'): + fstab = os.path.join(path, 'etc', 'fstab') + if not os.path.exists(os.path.dirname(fstab)):# FIXME: should exist + os.makedirs(os.path.dirname(fstab)) + with open(fstab, 'w') as f: + f.write('proc /proc proc defaults 0 0\n') + f.write('sysfs /sys sysfs defaults 0 0\n') + f.write('/dev/sda1 / btrfs defaults,rw,noatime 0 1\n') + class SystemKindBuilderFactory(object): # pragma: no cover |