summaryrefslogtreecommitdiff
path: root/morphlib/exts/rawdisk.write
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-02-07 11:41:04 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-02-07 14:34:42 +0000
commit794301e1e1ec1b35145ae7bdd9093909c6488478 (patch)
tree1ca39c748baebf5ba94d7c24d12c2d88aca1343f /morphlib/exts/rawdisk.write
parente3bb31154b259eb04019e7f63f1e0270d1606e06 (diff)
downloadmorph-794301e1e1ec1b35145ae7bdd9093909c6488478.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 'morphlib/exts/rawdisk.write')
-rwxr-xr-xmorphlib/exts/rawdisk.write21
1 files changed, 3 insertions, 18 deletions
diff --git a/morphlib/exts/rawdisk.write b/morphlib/exts/rawdisk.write
index 89e9e82b..a55473f2 100755
--- a/morphlib/exts/rawdisk.write
+++ b/morphlib/exts/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()