diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-02-07 11:41:04 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-02-07 14:34:42 +0000 |
commit | 099f2ef05cd52dd623b47901ecc361754aa729f7 (patch) | |
tree | bcef2930c7e81cd2bc588d806e19f4f612e4db5e /rawdisk.write | |
parent | 769c0ae2808a3c3e383c470795510b72c45c5a76 (diff) | |
download | definitions-099f2ef05cd52dd623b47901ecc361754aa729f7.tar.gz |
Refactor: Add WriteExtension.create_local_system method
This allows code sharing amongst all the places that create a
system in a raw disk image. This also adds the creation of
a factory-run subvolume, and fixes error messages for errors
that happen during a disk image creation.
Suggested-By: Richard Maw
Suggested-By: Sam Thursfield
Diffstat (limited to 'rawdisk.write')
-rwxr-xr-x | rawdisk.write | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/rawdisk.write b/rawdisk.write index 89e9e82b..a55473f2 100755 --- a/rawdisk.write +++ b/rawdisk.write @@ -19,6 +19,7 @@ import os +import sys import time import tempfile @@ -40,24 +41,8 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension): temp_root, location = args - size = self.get_disk_size() - self.status(msg='Disk size is %(size)d bytes', size=size) - - self.create_raw_disk_image(location, size) - self.mkfs_btrfs(location) - mp = self.mount(location) - try: - self.create_factory(mp, temp_root) - self.create_fstab(mp) - self.install_extlinux(mp) - except BaseException, e: - self.status(msg='EEK') - self.unmount(mp) - raise - else: - self.unmount(mp) - - self.status(msg='Disk image has been created') + self.create_local_system(temp_root, location) + self.status(msg='Disk image has been created at %s' % location) RawDiskWriteExtension().run() |