summaryrefslogtreecommitdiff
path: root/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
commit099f2ef05cd52dd623b47901ecc361754aa729f7 (patch)
treebcef2930c7e81cd2bc588d806e19f4f612e4db5e /rawdisk.write
parent769c0ae2808a3c3e383c470795510b72c45c5a76 (diff)
downloaddefinitions-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-xrawdisk.write21
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()