<span style="font-family: courier new,monospace;">The full script is available at<br><a href="https://bugzilla.redhat.com/show_bug.cgi?id=448030#c41">https://bugzilla.redhat.com/show_bug.cgi?id=448030#c41</a><br><br>[Patch 2/5]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Author: Frederick Grose <<a href="mailto:fgrose@sugarlabs.org">fgrose@sugarlabs.org</a>></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Date: Thu Apr 14 09:48:41 2011 -0400</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Support refreshing of attached LiveOS devices.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Provide a new feature to refresh an attached LiveOS source image with a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> renewed rootfs and freshed overlay and, optionally, skip building a new</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> .iso file.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Updated base_on() to support selinux contexts, provide a liveos_mount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> function, new functions to check disc space for building and refreshing</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (with an extra space option to test or adjust staging space). Provide</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> an option to bypass the break to shell or script to permit uninterrupted</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> processing. Include the kernel architecture of the source in the .iso</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> image name, support F15-style rd.luks=0 in the boot configuration</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> adjustment, and provide updated usage statements.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">diff --git a/tools/edit-livecd b/tools/edit-livecd</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">index 659cfae..e156895 100755</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- a/tools/edit-livecd</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+++ b/tools/edit-livecd</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -69,8 +69,24 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self.clone = False</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> """Signals when to copy a running LiveOS image as base."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self._include = None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- """A string of file or directory paths to include in __copy_img_root."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.refresh_only = False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Signals that a filesystem refresh only is requested. No iso9660</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ installation image will be produced. If the source has never been</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ configured, this value is set to None."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._overlay = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """Signals the existence of an filesystem overlay file in base_on."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._include = []</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """A string of file or directory paths in the outer device filesystem</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ to include in __copy_src_root()."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._exclude = []</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """A string of file or directory paths in the outer device filesystem</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ to exclude from __copy_src_root()."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._releasefile = []</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """A string of file or directory paths to include in _brand()."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._builder = os.getlogin()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> """The name of the Remix builder for _branding.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -82,10 +98,10 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> current compression or lack thereof. Compression type options vary with</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> the version of the kernel and SquashFS used."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.skip_compression = False</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.skip_compression = None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> """Controls whether to use squashfs to compress the image."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.skip_minimize = False</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.skip_minimize = None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> """Controls whether an image minimizing snapshot should be created."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._isofstype = "iso9660"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -110,6 +126,15 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._LiveImageCreatorBase__isodir = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> """directory where the iso is staged"""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.squashmnt = None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Mount object for the source LiveOS SquashFS."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.liveosmnt = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """Mount object for the source LiveOS image."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.extra_loops = []</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """List of extra loop devices created for block device sources."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # properties</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def __get_image(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if self._LoopImageCreator__imagedir is None:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -166,6 +191,7 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> os.unlink(path)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def mount(self, base_on, cachedir = None):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> """mount existing file system.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -176,7 +202,9 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> We also need to get some info about the image before we can mount it.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> base_on -- the <LIVEIMG.src> a LiveOS.iso file or an attached LiveOS</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- device, such as, /dev/live for a currently running image.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ device, such as, /dev/live for a currently running image,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ or <base_on>/mnt/live for a live-mounted (overlay-mounted)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ LiveOS device.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> cachedir -- a directory in which to store a Yum cache;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Not used in edit-liveos.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -196,13 +224,56 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> makedirs(self._LoopImageCreator__imagedir)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> makedirs(self._ImageCreator_outdir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- if self.clone:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._LiveImageCreatorBase__isodir = os.path.join(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._ImageCreator__builddir, 'iso')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'blk':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ srcmnt = DiskMount(RawDisk(None, base_on), self._mkdtemp('blk-'))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ elif self._src_type == 'iso':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ srcmnt = DiskMount(LoopbackDisk(base_on, None),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._mkdtemp('iso-'))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif self._src_type == 'live':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ srcmnt = Mount(os.path.join('/mnt', 'live'))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.srcmnt = srcmnt</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ srcmnt.mount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : %s" % (base_on, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ srcmntdir = srcmnt.mountdir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ liveosdir = os.path.join(srcmntdir, 'LiveOS')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not os.path.exists(liveosdir):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("No LiveOS directory on %s" % base_on)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ files = os.listdir(liveosdir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for f in files:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if f.find('overlay-') == 0:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._overlay = f</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ break</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if os.path.exists(os.path.join(liveosdir, 'ext3fs.img')):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.squashmnt = False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._space_to_proceed(srcmntdir, base_on):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__copy_src_root(srcmntdir, base_on)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError('''Insufficient space to stage a new build.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ Exiting...''')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ srcmnt.cleanup()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.clone and self._overlay:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # Need to clone base_on into ext3fs.img at this point</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._LoopImageCreator__fslabel = <a href="http://self.name">self.name</a></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._base_on(base_on)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.liveosmnt.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.squashmnt.mounted:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.squashmnt.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> LiveImageCreator._base_on(self, base_on)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._LoopImageCreator__fstype = get_fsvalue(self._image, 'TYPE')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._LoopImageCreator__fstype = get_fsvalue('value', 'TYPE', None,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._image)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._get_fslabel()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self.fslabel = self._LoopImageCreator__fslabel</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -210,140 +281,377 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._LoopImageCreator__instloop = ExtDiskMount(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ExistingSparseLoopbackDisk(self._image,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._LoopImageCreator__image_size),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._LoopImageCreator__image_size),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._ImageCreator_instroot,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._fstype,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._LoopImageCreator__blocksize,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self.fslabel,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.tmpdir)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ tmpdir=self.tmpdir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._LoopImageCreator__instloop.mount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> except MountError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> raise CreatorError("Failed to loopback mount '%s' : %s" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (self._image, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- cachesrc = cachedir or (self._ImageCreator__builddir + "/yum-cache")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- makedirs(cachesrc)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self._script or self._shell:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'iso':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ cachesrc = cachedir or (self._ImageCreator__builddir + "/yum-cache")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ makedirs(cachesrc)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- for (f, dest) in [("/sys", None), ("/proc", None),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- ("/dev/pts", None), ("/dev/shm", None),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- (cachesrc, "/var/cache/yum")]:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._ImageCreator__bindmounts.append(BindChrootMount(f, self._instroot, dest))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for (f, dest) in [("/sys", None), ("/proc", None),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ ("/dev/pts", None), ("/dev/shm", None),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ (cachesrc, "/var/cache/yum")]:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._ImageCreator__bindmounts.append(BindChrootMount(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ f, self._instroot, dest))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self._do_bindmounts()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._do_bindmounts()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- os.symlink("../proc/mounts", self._instroot + "/etc/mtab")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ os.symlink("/proc/self/mounts", self._instroot + "/etc/mtab")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.__copy_img_root(base_on)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._brand(self._builder)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- def _base_on(self, base_on):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- """Clone the running LiveOS image as the basis for the new image."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ def liveos_mount(self, srcmntdir, base_on, ops=None):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """Mount the LiveOS image in the iso, or installed device."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.__fstype = 'ext4'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.__image_size = 4096L * 1024 * 1024</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.__blocksize = 4096</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.liveosmnt and self.liveosmnt.mounted:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return self.liveosmnt</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ liveosdir = os.path.join(srcmntdir, 'LiveOS')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ squash_img = os.path.join(liveosdir, 'squashfs.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rootfs_img = os.path.join(liveosdir, 'ext3fs.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'live':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.extra_loops.extend([add_loop(8)])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.extra_loops.extend([add_loop(9)])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.extra_loops.extend([add_loop(10)])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'blk' and self._overlay:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not os.path.exists(rootfs_img):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt = LiveImageMount(RawDisk(None, base_on),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._mkdtemp('live-'), self._overlay,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._ImageCreator__builddir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif os.path.exists(squash_img):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.squashmnt = DiskMount(LoopbackDisk(squash_img, None),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._mkdtemp('squash-'), ops=ops)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rootfs_img = os.path.join(self.squashmnt.mountdir,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ 'LiveOS', 'ext3fs.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.squashmnt.mount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : %s" %</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ (squash_img, e))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(rootfs_img):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.liveosmnt = DiskMount(LoopbackDisk(rootfs_img, None),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._mkdtemp('ext3-'), ops=ops)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif not self.liveosmnt:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("No LiveOS image found on '%s', Exiting..." %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ base_on)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.__instloop = ExtDiskMount(SparseLoopbackDisk(self._image,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.__image_size),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._instroot,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.__fstype,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.__blocksize,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.fslabel,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.tmpdir)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.__instloop.mount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.mount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> except MountError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- raise CreatorError("Failed to loopback mount '%s' : %s" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- (self._image, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : %s" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (rootfs_img, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.squashmnt is None:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.squashmnt = self.liveosmnt.squashmnt</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- subprocess.call(['rsync', '-ptgorlHASx', '--specials', '--progress',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '--include', '/*/',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '--exclude', '/etc/mtab',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '--exclude', '/etc/blkid/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '--exclude', '/dev/*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '--exclude', '/proc/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '--exclude', '/home/*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '--exclude', '/media/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '--exclude', '/mnt/live',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '--exclude', '/sys/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '--exclude', '/tmp/*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '--exclude', '/.liveimg*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '--exclude', '/.autofsck',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- '/', self._instroot])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- subprocess.call(['sync'])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return self.liveosmnt</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._ImageCreator__create_minimal_dev()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.__instloop.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def _space_to_proceed(self, srcmntdir, base_on):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Provide estimated size requirements and availability of staging</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ resources for the build.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- def __copy_img_root(self, base_on):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- """helper function to copy root content of the base LiveIMG to </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- ISOdir"""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # Determine compression and minimization states</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ liveosdir = os.path.join(srcmntdir, 'LiveOS')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ squash_img = os.path.join(liveosdir, 'squashfs.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ img = squash_img</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not os.path.exists(squash_img):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ img = os.path.join(liveosdir, 'osmin.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not os.path.exists(img):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.skip_minimize is None:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.skip_minimize = True</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.skip_compression is None:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # default to compressed in all cases</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.skip_compression = False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.skip_compression is None:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.skip_compression = False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # 'self.compress_type = None' will force reading it from</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # base_on.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.compress_type is None:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.compress_type = squashfs_compression_type(img)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.compress_type == 'undetermined':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # 'gzip' for compatibility with older versions.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.compress_type = 'gzip'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ du_args = ['/usr/bin/du', '-csxb', '--files0-from=-']</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ignore_list = ['ext3fs.img', 'squashfs.img', 'osmin.img', 'home.img',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 'overlay-*']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if self.clone:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ignore_list.remove('home.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- includes = 'boot, /EFI, /syslinux, /LiveOS'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- if self._include:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- includes += ", " + self._include</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- imgmnt = DiskMount(RawDisk(0, base_on), self._mkdtemp())</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if os.path.exists(os.path.join(liveosdir, 'home.img')):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ du_args.extend(['--exclude=/home/*'])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for fn in ignore_list:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ du_args.extend(['--exclude=%s' % fn])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # remove duplicate files to reduce iso size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ efi_vmlinuz = os.path.join(srcmntdir, 'EFI', 'boot', 'vmlinuz0')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ efi_initrd = os.path.join(srcmntdir, 'EFI', 'boot', 'initrd0.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if os.path.exists(efi_vmlinuz):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._exclude.extend(['%s' % efi_vmlinuz])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._exclude.extend(['%s' % efi_initrd])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self._src_type == 'live':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ stdin = '/'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif self._src_type in ['blk', 'iso']:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt = self.liveos_mount(srcmntdir, base_on, 'ro')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ stdin = self.liveosmnt.mountdir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rootfs_size = long(rcall(du_args, stdin, stderr=False).split()[-2])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # staged copy</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ required = rootfs_size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.skip_compression:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # Space on iso image</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ required += rootfs_size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- imgmnt = DiskMount(LoopbackDisk(base_on, 0), self._mkdtemp())</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # assuming a 2:1 compression ratio, at most</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ required += rootfs_size / 2L</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if not self.skip_minimize:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ required += 8192L</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ tmp_available = long(disc_free_info(self.tmpdir, '-TB1')[4])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ e2img_size = 1024L * 1024L * 512L</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if tmp_available > e2img_size:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ e2img = tempfile.NamedTemporaryFile(dir=self.tmpdir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self._src_type == 'live':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ device = '/dev/mapper/live-rw'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif self._src_type in ['blk', 'iso']:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ device = disc_free_info(self.liveosmnt.mountdir)[0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ rcall(['/sbin/e2image', '-r', device, <a href="http://e2img.name">e2img.name</a>])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ e2img_size = tmp_available - long(disc_free_info(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.tmpdir, '-TB1')[4])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.stat(self.tmpdir).st_dev == os.stat(self.output).st_dev:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ available = tmp_available</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ required += e2img_size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ available = long(disc_free_info(self.output, '-TB1')[4])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self._LiveImageCreatorBase__isodir = self._ImageCreator__builddir + "/iso"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for fn in self._exclude:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ du_args.extend(['--exclude=%s' % os.path.join(srcmntdir,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ fn.lstrip(os.sep))])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- imgmnt.mount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- except MountError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- raise CreatorError("Failed to mount '%s' : %s" % (base_on, e))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.clone:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ includes = ['boot', 'EFI', 'isolinux', 'syslinux', 'LiveOS']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ files0from = ''</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for fn in includes:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._include.extend(['%s' % fn])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for i, fn in enumerate(self._include):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ src = os.path.join(srcmntdir, fn.lstrip(os.sep))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ files0from += '%s\0' % src</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._include[i] = src</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ files0from = srcmntdir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ tobe_copied = long(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rcall(du_args, files0from, stderr=False).split()[-2])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # 1 staged copy and another in iso9660 file.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ required += tobe_copied * 2L</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # amount for uncertain overhead</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ required += self._extra_space</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '\n{:20,} bytes set to be copied'.format(tobe_copied),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print 'from the source filesystem {:s}.'.format(base_on)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '{:20,} bytes are in the LiveOS filesystem.\n'.format(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ rootfs_size)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '{:20,} bytes are estimated to be required'.format(required),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print 'for staging this build.\n'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '{:20,} bytes are available'.format(available),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print 'on {:s} for staging the build.'.format(self.output)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if available <= required:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ needed = (required - available) / (1024 * 1024)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print >> sys.stderr, "\n"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ "There is insufficient space to build a remix on %s.\n"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ "%s MiB of additional space is needed." % (self.output, needed)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ liveosmnt.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return True</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def __copy_src_root(self, srcmntdir, base_on):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """helper function to copy root content of the base LiveOS source to</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ ISOdir</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ ignore_list = ['ext3fs.img', 'squashfs.img', 'osmin.img', 'home.img',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 'overlay-*']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.clone:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ ignore_list.remove('home.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ liveosdir = os.path.join(srcmntdir, 'LiveOS')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for fn in self._exclude:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ ignore_list.extend(['%s' % fn])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ isodir = self._LiveImageCreatorBase__isodir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.clone:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> # include specified files or directories</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- if self.clone:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- baseimg = os.path.join(imgmnt.mountdir, 'LiveOS',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- 'squashfs.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- # 'self.compress_type = None' will force reading it from</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- # base_on.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- if self.compress_type is None:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self.compress_type = squashfs_compression_type(baseimg)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- if self.compress_type == 'undetermined':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- # 'gzip' for compatibility with older versions.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- self.compress_type = 'gzip'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- dst = self._LiveImageCreatorBase__isodir</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- print includes</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- for fd in includes.split(', /'):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- src = os.path.join(imgmnt.mountdir, fd)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- if os.path.isfile(src):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- shutil.copy2(src, os.path.join(dst, fd))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- elif os.path.isdir(src):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- shutil.copytree(src, os.path.join(dst, fd),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ tgt_list = []</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for fp in self._include:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(fp):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ tgt_list.extend([os.path.basename(fp)])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.isfile(fp):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ shutil.copy2(fp, os.path.join(isodir, tgt_list[-1]))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ elif os.path.isdir(fp):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ shutil.copytree(fp, os.path.join(isodir, tgt_list[-1]),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> symlinks=True,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ignore=shutil.ignore_patterns(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> *ignore_list))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print """</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ \rDevice folders and files to be included in the new image:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ \r %s""" % tgt_list</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ #copy over everything but squashfs.img or ext3fs.img</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ \rDevice folders & files to be excluded from the source root copy:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ \r %s""" % ignore_list</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ shutil.copytree(srcmntdir, isodir,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ ignore=shutil.ignore_patterns(*ignore_list))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ bootfolder = os.path.join(isodir, 'isolinux')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ installedpath = os.path.join(isodir, 'syslinux')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(installedpath):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ os.rename(installedpath, bootfolder)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # build symlinks to reduce iso size</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ efi_vmlinuz = os.path.join(isodir, 'EFI', 'boot', 'vmlinuz0')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ isolinux_vmlinuz = os.path.join(bootfolder, 'vmlinuz0')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ efi_initrd = os.path.join(isodir, 'EFI', 'boot', 'initrd0.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ isolinux_initrd = os.path.join(bootfolder, 'initrd0.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if os.path.exists(os.path.join(srcmntdir, 'EFI', 'boot', 'vmlinuz0')):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ os.unlink(efi_vmlinuz)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ os.unlink(efi_initrd)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ os.symlink(isolinux_vmlinuz, efi_vmlinuz)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ os.symlink(isolinux_initrd, efi_initrd)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ subprocess.call(['sync'])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def _base_on(self, base_on):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Clone the running or /dev/mapper LiveOS image as the basis for the</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ new image.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'blk':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ base_on = self.liveosmnt.mountdir + os.sep</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.squashmnt:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ image = self.liveosmnt.imgloop</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- #copy over everything but squashfs.img or ext3fs.img</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- shutil.copytree(imgmnt.mountdir,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- self._LiveImageCreatorBase__isodir,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- ignore=shutil.ignore_patterns(*ignore_list))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- subprocess.call(['sync'])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ image = self.liveosmnt.disk</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.srcmnt.mount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : %s" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (self.srcmnt.device, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.__image_size = os.stat(image.lofile).st_size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ device = image.device</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ elif self._src_type == 'live':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ base_on = '/'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ device = '/dev/mapper/live-rw'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ liveosdir = os.path.join('/mnt', 'live', 'LiveOS')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rootfs_img = os.path.join(liveosdir, 'ext3fs.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ squashmnt = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if not os.path.exists(rootfs_img):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ squashloop = get_loop('/sysroot/LiveOS/squashfs.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ squashmnt = DiskMount(Disk(None, squashloop),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._mkdtemp('squash-'))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ squashmnt.mount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : %s" %</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ (squashloop, e))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ rootfs_img = os.path.join(squashmnt.mountdir,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 'LiveOS', 'ext3fs.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__image_size = os.stat(rootfs_img).st_size</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if squashmnt:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ squashmnt.unmount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.__fstype = get_fsvalue('value', 'TYPE', None, device)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__blocksize = os.stat(device).st_blksize</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.squashmnt is not None:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.srcmnt.unmount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__instloop = ExtDiskMount(SparseLoopbackDisk(self._image,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.__image_size),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self._instroot,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.__fstype,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__blocksize,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.fslabel,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ tmpdir=self.tmpdir)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__instloop.mount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to loop mount '%s' : %s" %</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ (self._image, e))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ livecfg = 'in'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dbusid = 'ex'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self.refresh_only:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dbusid = 'in'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if not os.path.exists(os.path.join(base_on,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '.liveimg-configured')):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.refresh_only = None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ home = 'in'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if os.path.exists(os.path.join(self._LiveImageCreatorBase__isodir,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 'LiveOS', 'home.img')):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ home = 'ex'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print "\nCopying the source image..."</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ subprocess.call(['rsync', '-ptgorlHASxXW', '--specials', '--stats',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--partial-dir=.rsync-partial',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--exclude', '- /selinux/',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--include', '/*/',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--exclude', '/dev/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--exclude', '/etc/blkid/*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--exclude', '/etc/mtab',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--%sclude' % home, '/home/*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--exclude', '/proc/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--exclude', '/mnt/live',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--exclude', '/sys/*',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--exclude', '/tmp/*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--%sclude' % dbusid, '/var/lib/dbus/machine-id',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '--%sclude' % livecfg, '/.liveimg*',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '--exclude', '/.autofsck',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '%s' % base_on, self._instroot])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ makedirs(os.path.join(self._instroot, 'selinux'))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ subprocess.call(['/bin/sync'])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'blk':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.liveosmnt.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- imgmnt.cleanup()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.__instloop.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- def _brand (self, _builder):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ def _brand(self, _builder):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> """Adjust the image branding to show its variation from original</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- source by builder and build date."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ source by builder and build date.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self.fslabel = <a href="http://self.name">self.name</a></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> dt = time.strftime('%d-%b-%Y')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- lst = ['isolinux/isolinux.cfg', 'syslinux/syslinux.cfg',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- 'syslinux/extlinux.conf']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ lst = ['isolinux/isolinux.cfg', 'isolinux/syslinux.cfg',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 'isolinux/extlinux.conf']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> for f in lst:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> fpath = os.path.join(self._LiveImageCreatorBase__isodir, f)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if os.path.exists(fpath):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -365,13 +673,17 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ntext = dt.translate(None, '-') + '-' + _builder + '-Remix-' + release</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # Update fedora-release message with Remix details.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- releasefiles = '/etc/fedora-release, /etc/generic-release'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ releasefiles = ['fedora-release', 'generic-release', 'issue']</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for i, rf in enumerate(releasefiles):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ releasefiles[i] = os.path.join(self._instroot, 'etc', rf)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if self._releasefile:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- releasefiles += ', ' + self._releasefile</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- for fn in releasefiles.split(', '):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- if os.path.exists(fn):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for fn in self._releasefile:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ releasefiles.extend([os.path.join(self._instroot,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ fn.lstrip(os.sep))])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for rfpath in releasefiles:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(rfpath):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- with open(self._instroot + fn, 'r') as f:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ with open(rfpath, 'r') as f:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> text = ntext + '\n' + f.read()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> open(<a href="http://f.name">f.name</a>, 'w').write(text)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> except IOError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -379,16 +691,16 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (<a href="http://f.name">f.name</a>, e))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._releasefile = ntext</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- <a href="http://self.name">self.name</a> += '-' + os.uname()[4] + '-' + time.strftime('%Y%m%d.%H%M')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ kernel = os.path.join(self._LiveImageCreatorBase__isodir, 'isolinux',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 'vmlinuz0')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ arch = get_file_info(kernel)[7].split('.')[-1]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ <a href="http://self.name">self.name</a> += '-' + arch + '-' + time.strftime('%Y%m%d.%H%M')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def _configure_bootloader(self, isodir):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> """Restore the boot configuration files for an iso image boot."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> bootfolder = os.path.join(isodir, 'isolinux')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- oldpath = os.path.join(isodir, 'syslinux')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- if os.path.exists(oldpath):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- os.rename(oldpath, bootfolder)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> cfgf = os.path.join(bootfolder, 'isolinux.cfg')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> for f in ['syslinux.cfg', 'extlinux.conf']:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -400,7 +712,9 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> '-e', 's/Welcome to .*/Welcome to ' + self._releasefile + '!/',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> '-e', 's/root=[^ ]*/root=live:CDLABEL=' + <a href="http://self.name">self.name</a> + '/',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> '-e', 's/rootfstype=[^ ]* [^ ]*/rootfstype=auto ro/',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- '-e', 's/liveimg .* quiet/liveimg quiet/', cfgf]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '-e', 's/liveimg .* rd_NO_LUKS/liveimg quiet rhgb rd_NO_LUKS/',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ '-e', 's/liveimg .* rd.luks=0/liveimg quiet rhgb rd.luks=0/',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ cfgf]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> dev_null = os.open("/dev/null", os.O_WRONLY)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -408,29 +722,209 @@ class LiveImageEditor(LiveImageCreator):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> stdout = subprocess.PIPE,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> stderr = dev_null).communicate()[0]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> except IOError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> raise CreatorError("Failed to configure bootloader file: %s" % e)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return 1</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> os.close(dev_null)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def no_new_iso(self, iso):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Hijacked the _LiveImageCreatorBase__create_iso base method to</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ prevent creating a new iso when the refresh_only option is selected.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.refresh(iso)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def refresh(self, iso):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Hijacked the _LiveImageCreatorBase__implant_md5sum base method to</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ insert code to refresh a running or livemounted image's ext3fs.img and</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ overlay files (just before the staged files are deleted).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not self.refresh_only:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # Implant an isomd5sum.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if os.path.exists("/usr/bin/implantisomd5"):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ implantisomd5 = "/usr/bin/implantisomd5"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif os.path.exists("/usr/lib/anaconda-runtime/implantisomd5"):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ implantisomd5 = "/usr/lib/anaconda-runtime/implantisomd5"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ logging.warn("isomd5sum not installed; not setting up mediacheck")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ subprocess.call([implantisomd5, iso])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._src_type == 'live':</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print """</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ \r Notice: Refreshing from running images is not yet supported.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif self._src_type == 'iso':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print "\nRefreshing the source device with the new image..."</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ isodir = self._LiveImageCreatorBase__isodir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.srcmnt.mount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : '%s'" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (self.srcmnt.mountdir, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self._space_for_refresh(self.srcmnt, isodir):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ liveosdir = os.path.join(self.srcmnt.mountdir, 'LiveOS')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self._overlay:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self._overlay = os.path.join(liveosdir, self._overlay)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dd_args = ['/bin/dd', 'if=/dev/zero',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 'of=%s' % self._overlay, 'bs=64k', 'count=1',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ 'conv=notrunc']</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ staged_LiveOS = os.path.join(isodir, 'LiveOS')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ def _proclists(fname, subt=None):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if fname:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ fpath = os.path.join(liveosdir, fname)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(fpath):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dellist.extend([fpath])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if subt:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ filelist.extend([os.path.join(staged_LiveOS, subt)])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ target = os.path.join(liveosdir, subt)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ tgtlist.extend([target])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ dellist.extend([target])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ filelist, tgtlist, dellist = ([], [], [])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.skip_minimize:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ _proclists('osmin.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ _proclists(None, 'osmin.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.skip_compression:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ _proclists('squashfs.img', 'ext3fs.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif self.squashmnt:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ _proclists('ext3fs.img', 'squashfs.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ filelist.extend([os.path.join(os.path.dirname(self._image),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ 'LiveOS', 'ext3fs.img')])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ target = os.path.join(liveosdir, 'ext3fs.img')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ tgtlist.extend([target])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ dellist.extend([target])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for f in ['syslinux.cfg', 'extlinux.conf']:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ cfgf = os.path.join(self.srcmnt.mountdir, 'syslinux', f)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(cfgf):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ cfgf_sed = ['/bin/sed', '-i', '-e',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ 's/Welcome to .*/Welcome to ' + self._releasefile + '!/',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ cfgf]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ environ = os.environ.copy()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ cmd_cp = '/bin/cp'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ cmd_rm = '/bin/rm'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # Copy new ext3fs.img or squashfs.img and osmin.img, and reset</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # the overlay.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for f in dellist:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rcall([cmd_rm, f], env=environ)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for i, f in enumerate(filelist):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rcall([cmd_cp, '--remove-destination', f, tgtlist[i]],</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ env=environ)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if self._overlay:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print "Resetting the overlay file..."</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rcall(dd_args, env=environ)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ rcall(cfgf_sed, env=environ)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ # flag refresh image as configured. (This has already been done</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ # for the refresh_only case.)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.refresh_only is not None:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.ops = 'rw'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.mount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ except MountError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to mount '%s' : %s" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (self.liveosmnt.mountdir, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ shutil.copy('/.liveimg-configured',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.mountdir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ shutil.copy('/.liveimg-late-configured',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.mountdir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.cleanup()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ finally:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ self.srcmnt.unmount()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def _space_for_refresh(self, srcmnt, isodir):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Check for sufficient space on the installation device for a refresh.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ du_args = ['/usr/bin/du', '-csxb', '--files0-from=-']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ include = ['squashfs.img', 'osmin.img', 'ext3fs.img',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ 'livecd-iso-to-disk']</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ include2 = include[:]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ files0from = ''</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for i, fn in enumerate(include):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ include[i] = os.path.join(isodir, 'LiveOS', fn)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ files0from += '%s\0' % include[i]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not self.squashmnt:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ files0from += '%s\0' % os.path.join(os.path.dirname(self._image),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ 'LiveOS', 'ext3fs.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ tobe_copied = long(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ rcall(du_args, files0from, stderr=False).split()[-2])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ files0from = ''</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ for i, fn in enumerate(include2):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ include2[i] = os.path.join(srcmnt.mountdir, 'LiveOS', fn)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ files0from += '%s\0' % include2[i]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ tobe_deleted = long(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ rcall(du_args, files0from, stderr=False).split()[-2])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ available = long(disc_free_info(srcmnt.mountdir,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ '-TB1')[4]) + tobe_deleted</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ files0from = os.path.join(srcmnt.mountdir, 'LiveOS', self._overlay)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ overlay_size = long(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ rcall(du_args, files0from, stderr=False).split()[-2])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ files0from = os.path.join(srcmnt.mountdir, 'LiveOS', 'home.img')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ home_size = long(rcall(du_args, files0from, stderr=False).split()[-2])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ reduced_overlay_size = available + overlay_size</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '\n{:20,} bytes to be copied'.format(tobe_copied)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print '{:20,} bytes to be deleted'.format(tobe_deleted)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '{:20,} bytes in home.img'.format(home_size)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print '{:20,} bytes in overlay'.format(overlay_size)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '{:20,} bytes available'.format(available)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if available <= 0:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print '{:20,} bytes in potential overlay'.format(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ reduced_overlay_size)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return True</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ def _unmount_instroot(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Undo anything performed in mount()."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.liveosmnt:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.liveosmnt.cleanup()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if self.squashmnt:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.squashmnt.cleanup()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def parse_options(args):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- parser = optparse.OptionParser(usage = """</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- %prog [-n=<name>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- [-o=<output>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- [-s=<script.sh>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- [-t=<tmpdir>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- [-e=<excludes>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- [-f=<exclude-file>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- [-i=<includes>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- [-r=<releasefile>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- [-b=<builder>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ parser = optparse.OptionParser(usage = '''</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ %prog [-n, --name <name>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ [-o, --output <output directory>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [-s, --script <script.sh>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ [-N, --noshell]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [-t, --tmpdir <tmpdir>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ [-e, --exclude <exclude, s>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [-i, --include <include, s>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ [-r, --releasefile <releasefile, s>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [-b, --builder <builder>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> [--clone]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- [-c=<compress_type>]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ [--refresh_only]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [--no-refresh]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ [-c, --compress-type <compression type>]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [--compress]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> [--skip-compression]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> [--skip-minimize]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- <LIVEIMG.src>""")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ [--extra-space]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ <LIVEIMG.src>''')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.add_option("-n", "--name", type="string", dest="name",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> help="name of new LiveOS (don't include .iso, it will "</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -443,46 +937,74 @@ def parse_options(args):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> help="specify script to run chrooted in the LiveOS "</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> "fsimage")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ parser.add_option("-N", "--noshell", action="store_false",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ dest="shell", default=True,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ help="Specify no break to shell after edit.")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.add_option("-t", "--tmpdir", type="string",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> dest="tmpdir", default="/var/tmp",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> help="Temporary directory to use (default: /var/tmp)")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.add_option("-e", "--exclude", type="string", dest="exclude",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- help="Specify directory or file patterns to be excluded "</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- "from the rsync copy of the filesystem.")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- parser.add_option("-f", "--exclude-file", type="string",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- dest="exclude_file",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- help="Specify a file containing file patterns to be "</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- "excluded from the rsync copy of the filesystem.")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ help='''A string of file or directory paths in the outer device</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ filesystem to exclude from __copy_src_root(). Include multiple files</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ as "file1, file2, ..." ''')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.add_option("-i", "--include", type="string", dest="include",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- help="Specify directory or file patterns to be included "</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- "in copy_img_root.")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ help='''A string of file or directory paths in the outer device</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ filesystem to include in __copy_src_root(). Include multiple files</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ as "file1, file2, ..." ''')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> parser.add_option("-r", "--releasefile", type="string", dest="releasefile",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- help="Specify release file/s for branding.")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ help='''Specify release file/s for branding. Include</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ multiple files as "file1, file2, ..." ''')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.add_option("-b", "--builder", type="string",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> dest="builder", default=os.getlogin(),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> help="Specify the builder of a Remix.")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- parser.add_option("", "--clone", action="store_true", dest="clone",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- help="Specify that source image is LiveOS block device.")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ parser.add_option("", "--clone", action="store_true",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ dest="clone", default=False,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ help="""Specify copying of the LiveOS root filesystem.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ This option will also refresh the source filesystem,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ unless the --no-refresh option is also invoked.""")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ parser.add_option("", "--refresh-only", action="store_true",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ dest="refresh_only", default=False,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ help='''Specify replacing the squashfs.img or ext3fs.img</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ of the source LiveOS installation instance with such</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ files from the new build, and resetting any overlay.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ No new iso installation file will be produced.''')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ parser.add_option("", "--no-refresh", action="store_true",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dest="no_refresh", default=False,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ help='''Specify no refresh of the source filesystems.''')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- parser.add_option("-c", "--compress_type", type="string",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ parser.add_option("-c", "--compress-type", type="string",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> dest="compress_type",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> help="Specify the compression type for SquashFS. Will "</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> "override the current compression or lack thereof.")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ parser.add_option("", "--compress", action="store_true",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dest="compress", default=None,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ help="Specify compression of the filesystem image, "</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ "ext3fs.img. Used when overriding the base_on "</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ "compression status.")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> parser.add_option("", "--skip-compression", action="store_true",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- dest="skip_compression", default=False,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- help="Specify no compression of filesystem, ext3fs.img")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dest="skip_compression", default=None,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ help="Specify no compression of filesystem image, "</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ "ext3fs.img")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.add_option("", "--skip-minimize", action="store_true",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- dest="skip_minimize", default=False,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dest="skip_minimize", default=None,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> help="Specify no osmin.img minimal snapshot.")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ parser.add_option("", "--extra-space", type="string",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ dest="extra_space", default='2',</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ help='''Specify extra space to reserve for unexpected</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ staging area needs.''')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> setup_logging(parser)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (options, args) = parser.parse_args()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -491,36 +1013,105 @@ def parse_options(args):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> parser.print_usage()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> sys.exit(1)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- print args[0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print "\nSource image at %s" % args[0]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> return (args[0], options)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-def get_fsvalue(filesystem, tag):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+def get_fsvalue(format=None, tag=None, token=None, filesystem=None):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """Return filesystem information based on a blkid tag, token, or device."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> dev_null = os.open('/dev/null', os.O_WRONLY)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- args = ['/sbin/blkid', '-s', tag, '-o', 'value', filesystem]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ args = ['/sbin/blkid', '-c', '/dev/null']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if format:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ args.extend(['-o', format])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if tag:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ args.extend(['-s', tag])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if token:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ args.extend(['-l', '-t', token])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if filesystem:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ args.extend([filesystem])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> fs_type = subprocess.Popen(args,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> stdout=subprocess.PIPE,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- stderr=dev_null).communicate()[0]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ stderr=dev_null).communicate()[0].rstrip()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> except IOError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- raise CreatorError("Failed to determine fs %s: %s" % value, e )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError("Failed to determine fs %s: %s" % value, e)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> os.close(dev_null)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return fs_type</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- return fs_type.rstrip()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-def rebuild_iso_symlinks(isodir):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- # remove duplicate files and rebuild symlinks to reduce iso size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- efi_vmlinuz = "%s/EFI/boot/vmlinuz0" % isodir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- isolinux_vmlinuz = "%s/isolinux/vmlinuz0" % isodir</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- efi_initrd = "%s/EFI/boot/initrd0.img" % isodir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- isolinux_initrd = "%s/isolinux/initrd0.img" % isodir</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+def rcall(args, stdin=None, stderr=True, env=None):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ out, err, p, environ = None, None, None, None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if env:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ environ = os.environ.copy()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ environ.update(env)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ p = subprocess.Popen(args, stdin=subprocess.PIPE, env=environ,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ out, err = p.communicate(stdin)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ except OSError, e:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError(u"Failed executing:\n'%s'\n'%s'" % (args, e))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ except:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ raise CreatorError(u"""Failed to execute:\n'%s'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ \renviron: '%s'\nstdout: '%s'\nstderr: '%s'""" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (args, environ, out, err))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if p.returncode != 0 and stderr:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError(u"""Error in call:\n'%s'\nenviron: '%s'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ \rstdout: '%s'\nstderr: '%s'\nreturncode: '%s'""" %</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ (args, environ, out, err, p.returncode))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return out</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+def disc_free_info(path, options=None):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Return the disc free information for a file or device path."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ info = [None] * 7</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(path):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ st_mode = os.stat(path).st_mode</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if stat.S_ISBLK(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ st_mode) or os.path.ismount(path) or stat.S_ISDIR(st_mode):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ df_args = ['/bin/df']</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if options:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ df_args.extend([options])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ df_args.extend([path])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ devinfo = rcall(df_args).splitlines()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ info = devinfo[1].split(None)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if len(info) == 1:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ info.extend(devinfo[2].split(None))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return info</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+def get_loop(path):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Return the loop device for a given mount point path."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ loopdevice = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for loop in rcall(['/sbin/losetup', '-a']).splitlines():</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ info = loop.split()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if path == info[2].strip('()'):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ loopdevice = info[0].rstrip(':')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ break</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return loopdevice</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- if os.path.exists(efi_vmlinuz):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- os.remove(efi_vmlinuz)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- os.remove(efi_initrd)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- os.symlink(isolinux_vmlinuz,efi_vmlinuz)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- os.symlink(isolinux_initrd,efi_initrd)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+def add_loop(n=8):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ """Add a loop device."""</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ while os.path.exists('/dev/loop%s' % n):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ n += 1</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ os.mknod('/dev/loop%s' % n, 0660 | stat.S_IFBLK, os.makedev(7, n))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ return '/dev/loop%s' % n</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+def get_file_info(path):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ """Retrieve file information."""</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ info = [None] * 16</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if os.path.exists(path):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ info = rcall(['/usr/bin/file', '-b', path]).split()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ return info</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def main():</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # LiveOS set to <LIVEIMG.src></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -530,51 +1121,91 @@ def main():</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> print >> sys.stderr, "You must run edit-liveos as root"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return 1</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- if stat.S_ISBLK(os.stat(LiveOS).st_mode):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- name = get_fsvalue(LiveOS, 'LABEL') + '.edited'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- elif <a href="http://options.name">options.name</a> and <a href="http://options.name">options.name</a> != os.path.basename(LiveOS):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ long(options.extra_space)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ except ValueError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise CreatorError('''Notice, --extra-space: %s is not a number.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ \rPlease correct this.''' % options.extra_space, e)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ name = os.path.basename(LiveOS) + ".edited"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ src_type = 'iso'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ st_mode = os.stat(LiveOS).st_mode</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if stat.S_ISBLK(st_mode):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ src_type = 'blk'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ name = get_fsvalue('value', 'LABEL', None, LiveOS) + '.edited'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if LiveOS == '/dev/live':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ src_type = 'live'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if <a href="http://options.name">options.name</a> and <a href="http://options.name">options.name</a> != os.path.basename(LiveOS):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> name = <a href="http://options.name">options.name</a></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- name = os.path.basename(LiveOS) + ".edited"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if options.output:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> output = options.output</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- output = os.path.dirname(LiveOS)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- if output == '/dev':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ output = os.path.dirname(os.path.normpath(LiveOS))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if output in ['/dev']:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> output = options.tmpdir</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> editor = LiveImageEditor(name)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- editor._exclude = options.exclude</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- editor._exclude_file = options.exclude_file</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- editor._include = options.include</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._src_type = src_type</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if options.exclude:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._exclude = options.exclude.split(', ')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if options.include:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._include = options.include.split(', ')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ editor._script = options.script</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._shell = options.shell</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor.clone = options.clone</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if options.refresh_only:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ editor.refresh_only = options.refresh_only</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor.clone = True</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor.tmpdir = options.tmpdir</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor.output = output</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor._builder = options.builder</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- editor._releasefile = options.releasefile</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if options.releasefile:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._releasefile = options.releasefile.split(', ')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor.compress_type = options.compress_type</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> editor.skip_compression = options.skip_compression</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if options.compress:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor.skip_compression = False</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor.skip_minimize = options.skip_minimize</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._extra_space = long(options.extra_space) * 1024L * 1024L</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor.mount(LiveOS, cachedir = None)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ editor._brand(editor._builder)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> editor._configure_bootloader(editor._LiveImageCreatorBase__isodir)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if options.script:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> print "Running edit script '%s'" % options.script</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor._run_script(options.script)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif editor._shell:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> print "Launching shell. Exit to continue."</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> print "----------------------------------"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> editor.launch_shell()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">- rebuild_iso_symlinks(editor._LiveImageCreatorBase__isodir)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> editor.unmount()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if options.refresh_only:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ self.refresh_only = True</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ editor._LiveImageCreatorBase__create_iso = editor.no_new_iso</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if not editor.skip_compression:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print '''\nThe new image will now be resquashed.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ Please wait...'''</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ elif options.clone and not options.no_refresh:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ editor._LiveImageCreatorBase__implant_md5sum = editor.refresh</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ print '\nThe new image will now be packaged. Please wait...'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> editor.package(output)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ call(['/bin/sync'])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <a href="http://logging.info">logging.info</a>("%s.iso saved to %s" % (<a href="http://editor.name">editor.name</a>, output))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> except CreatorError, e:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- logging.error(u"Error editing LiveOS : %s" % e)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ logging.error(u"Error editing LiveOS : '%s'" % e)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print "\nError editing LiveOS: '%s'" % e</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> return 1</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> finally:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ name = <a href="http://editor.name">editor.name</a></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ for loop in editor.extra_loops:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if loop:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ call(['/bin/rm', '-f', loop])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> editor.cleanup()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print 'LiveOS edit has completed.'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ if not editor.refresh_only:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ print ' See %s in %s' % (name, output)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return 0</span><span style="font-family: courier new,monospace;"><br>
</span>