diff options
Diffstat (limited to 'scripts/lib/wic/kickstart')
4 files changed, 29 insertions, 15 deletions
diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py index 4f5b778b5d..600098293a 100644 --- a/scripts/lib/wic/kickstart/__init__.py +++ b/scripts/lib/wic/kickstart/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/env python -tt # # Copyright (c) 2007 Red Hat, Inc. # Copyright (c) 2009, 2010, 2011 Intel, Inc. diff --git a/scripts/lib/wic/kickstart/custom_commands/micboot.py b/scripts/lib/wic/kickstart/custom_commands/micboot.py index 66d1678aa7..d162142506 100644 --- a/scripts/lib/wic/kickstart/custom_commands/micboot.py +++ b/scripts/lib/wic/kickstart/custom_commands/micboot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/env python -tt # # Copyright (c) 2008, 2009, 2010 Intel, Inc. # diff --git a/scripts/lib/wic/kickstart/custom_commands/micpartition.py b/scripts/lib/wic/kickstart/custom_commands/micpartition.py index 59a87fb486..43d04f1294 100644 --- a/scripts/lib/wic/kickstart/custom_commands/micpartition.py +++ b/scripts/lib/wic/kickstart/custom_commands/micpartition.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/env python -tt # # Marko Saukko <marko.saukko@cybercom.com> # diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py index abf3498134..54a494e033 100644 --- a/scripts/lib/wic/kickstart/custom_commands/partition.py +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py @@ -184,7 +184,7 @@ class Wic_PartData(Mic_PartData): Prepare content for a rootfs partition i.e. create a partition and fill it from a /rootfs dir. - Currently handles ext2/3/4 and btrfs. + Currently handles ext2/3/4, btrfs and vfat. """ pseudo = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot pseudo += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir @@ -229,6 +229,7 @@ class Wic_PartData(Mic_PartData): extra_blocks = IMAGE_EXTRA_SPACE rootfs_size = actual_rootfs_size + extra_blocks + rootfs_size *= IMAGE_OVERHEAD_FACTOR msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ (extra_blocks, self.mountpoint, rootfs_size)) @@ -241,8 +242,10 @@ class Wic_PartData(Mic_PartData): mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \ (self.fstype, extra_imagecmd, rootfs, image_rootfs) - exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) - + (rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) + if rc: + print "rootfs_dir: %s" % rootfs_dir + msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir)) # get the rootfs size in the right units for kickstart (Mb) du_cmd = "du -Lbms %s" % rootfs @@ -274,6 +277,7 @@ class Wic_PartData(Mic_PartData): extra_blocks = IMAGE_EXTRA_SPACE rootfs_size = actual_rootfs_size + extra_blocks + rootfs_size *= IMAGE_OVERHEAD_FACTOR msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ (extra_blocks, self.mountpoint, rootfs_size)) @@ -284,7 +288,9 @@ class Wic_PartData(Mic_PartData): mkfs_cmd = "mkfs.%s -b %d -r %s %s" % \ (self.fstype, rootfs_size * 1024, image_rootfs, rootfs) - exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) + (rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) + if rc: + msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir)) # get the rootfs size in the right units for kickstart (Mb) du_cmd = "du -Lbms %s" % rootfs @@ -308,8 +314,8 @@ class Wic_PartData(Mic_PartData): extra_blocks = self.get_extra_block_count(blocks) - if extra_blocks < BOOTDD_EXTRA_SPACE: - extra_blocks = BOOTDD_EXTRA_SPACE + if extra_blocks < IMAGE_EXTRA_SPACE: + extra_blocks = IMAGE_EXTRA_SPACE blocks += extra_blocks @@ -318,9 +324,11 @@ class Wic_PartData(Mic_PartData): # Ensure total sectors is an integral number of sectors per # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - blocks += (16 - (blocks % 16)) + # generate images with 32 sectors per track. This calculation + # is done in blocks, thus the mod by 16 instead of 32. Apply + # sector count fix only when needed. + if blocks % 16 != 0: + blocks += (16 - (blocks % 16)) dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (rootfs, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) @@ -394,7 +402,9 @@ class Wic_PartData(Mic_PartData): extra_imagecmd = "-i 8192" mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs) - exec_native_cmd(mkfs_cmd, native_sysroot) + (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) + if rc: + msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) self.source_file = fs @@ -412,10 +422,14 @@ class Wic_PartData(Mic_PartData): exec_cmd(dd_cmd) mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs) - exec_native_cmd(mkfs_cmd, native_sysroot) + (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) + if rc: + msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs) - exec_native_cmd(mkfs_cmd, native_sysroot) + (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) + if rc: + msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) self.source_file = fs |