diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-03-23 16:21:36 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-03-23 16:21:36 +0000 |
commit | 74e87b098a6678c072600091fbccd66b0cf88d94 (patch) | |
tree | f1d9f700d22102300a36ba0c06c0106d893b0862 /morphlib | |
parent | e775f9c908ee32fc1850cf19408e342a7dcfa823 (diff) | |
download | morph-74e87b098a6678c072600091fbccd66b0cf88d94.tar.gz |
Fix a few typos and so on.
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/builder.py | 2 | ||||
-rw-r--r-- | morphlib/fsutils.py | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index b822c61a..2463108e 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -463,7 +463,7 @@ class SystemBuilder(BlobBuilder): # pragma: no cover def _setup_device_mapping(self, image_name): with self.build_watch('setup-device-mapper'): - morphlib.fsutils.setup_device_mapping(self.ex, image_name) + return morphlib.fsutils.setup_device_mapping(self.ex, image_name) def _create_fs(self, partition): with self.build_watch('create-filesystem'): diff --git a/morphlib/fsutils.py b/morphlib/fsutils.py index 081ce0e8..dbe8b261 100644 --- a/morphlib/fsutils.py +++ b/morphlib/fsutils.py @@ -13,11 +13,13 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import os + def create_image(ex, image_name, size): # FIXME a pure python implementation may be better - self.ex.runv(['dd', 'if=/dev/zero', 'of=' + image_name, 'bs=1', - 'seek=%d' % size, 'count=0']) + ex.runv(['dd', 'if=/dev/zero', 'of=' + image_name, 'bs=1', + 'seek=%d' % size, 'count=0']) def partition_image(ex, image_name): # FIXME make this more flexible with partitioning options @@ -27,8 +29,8 @@ def install_mbr(ex, image_name): for path in ['/usr/lib/extlinux/mbr.bin', '/usr/share/syslinux/mbr.bin']: if os.path.exists(path): - self.ex.runv(['dd', 'if=' + path, 'of=' + image_name, - 'conv=notrunc']) + ex.runv(['dd', 'if=' + path, 'of=' + image_name, + 'conv=notrunc']) break def setup_device_mapping(ex, image_name): @@ -53,16 +55,16 @@ def create_fs(ex, partition): # FIXME: the hardcoded size of 4GB is icky but the default broke # when we used mkfs -t ext4 ex.runv(['mkfs', '-t', 'btrfs', '-L', 'baserock', - '-b', '4294967296', partition]) + '-b', '4294967296', partition]) def mount(ex, partition, mount_point): os.mkdir(mount_point) - self.ex.runv(['mount', partition, mount_point]) + ex.runv(['mount', partition, mount_point]) def unmount(ex, mount_point): ex.runv(['umount', mount_point]) -def undo_device_mapping(ex, image_name) +def undo_device_mapping(ex, image_name): out = ex.runv(['losetup', '-j', image_name]) for line in out.splitlines(): i = line.find(':') |