imgcreate/creator.py | 20 ++++++++++++-------- imgcreate/live.py | 4 ++-- imgcreate/yuminst.py | 3 +++ 3 files changed, 17 insertions(+), 10 deletions(-)
New commits: commit 2a57a06e1c6d43a7d4d55dccda4270ff63a7b44d Author: Jeremy Katz katzj@redhat.com Date: Tue Aug 5 18:04:09 2008 -0400
And make --base-on really work
--base-on still wasn't quite working for the livecd case. This makes it so that we actually pass the iso to base on as well as call the implementation's method
diff --git a/imgcreate/creator.py b/imgcreate/creator.py index 846373d..e63e96d 100644 --- a/imgcreate/creator.py +++ b/imgcreate/creator.py @@ -895,7 +895,7 @@ class LoopImageCreator(ImageCreator): """ return self.__instloop.resparse(size)
- def __base_on(self, base_on): + def _base_on(self, base_on): shutil.copyfile(base_on, self._image)
# @@ -905,8 +905,7 @@ class LoopImageCreator(ImageCreator): self.__imgdir = self._mkdtemp()
if not base_on is None: - self.__base_on(base_on) - shutil.copyfile(base_on, self._image) + self._base_on(base_on)
self.__instloop = SparseExtLoopbackMount(self._image, self._instroot, diff --git a/imgcreate/live.py b/imgcreate/live.py index e0bac09..49d524b 100644 --- a/imgcreate/live.py +++ b/imgcreate/live.py @@ -129,7 +129,7 @@ class LiveImageCreatorBase(LoopImageCreator): # # Actual implementation # - def __base_on(self, base_on): + def _base_on(self, base_on): """helper function to extract ext3 file system from a live CD ISO""" isoloop = LoopbackMount(base_on, self._mkdtemp())
@@ -175,7 +175,7 @@ class LiveImageCreatorBase(LoopImageCreator): isoloop.cleanup()
def _mount_instroot(self, base_on = None): - LoopImageCreator._mount_instroot(self) + LoopImageCreator._mount_instroot(self, base_on) self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")
def _unmount_instroot(self):
commit 305eaabc1c4329ad4ad17bf3a665be4f6a84aaa6 Author: Jeremy Katz katzj@redhat.com Date: Tue Aug 5 18:02:26 2008 -0400
Don't fail if devices already exist
When in base-on mode, we could already have the device nodes created, so we should only create them if they don't already exist
diff --git a/imgcreate/creator.py b/imgcreate/creator.py index e61f034..846373d 100644 --- a/imgcreate/creator.py +++ b/imgcreate/creator.py @@ -414,12 +414,17 @@ class ImageCreator(object): ('ptmx', 5, 2, 0666), ('tty', 5, 0, 0666), ('zero', 1, 5, 0666)) + links = (("/proc/self/fd", "/dev/fd"), + ("/proc/self/fd/0", "/dev/stdin"), + ("/proc/self/fd/1", "/dev/stdout"), + ("/proc/self/fd/2", "/dev/stderr")) + for (node, major, minor, perm) in devices: - os.mknod(self._instroot + "/dev/" + node, perm | stat.S_IFCHR, os.makedev(major,minor)) - os.symlink('/proc/self/fd', self._instroot + "/dev/fd") - os.symlink('/proc/self/fd/0', self._instroot + "/dev/stdin") - os.symlink('/proc/self/fd/1', self._instroot + "/dev/stdout") - os.symlink('/proc/self/fd/2', self._instroot + "/dev/stderr") + if not os.path.exists(self._instroot + "/dev/" + node): + os.mknod(self._instroot + "/dev/" + node, perm | stat.S_IFCHR, os.makedev(major,minor)) + for (src, dest) in links: + if not os.path.exists(self._instroot + dest): + os.symlink(src, self._instroot + dest) os.umask(origumask)
def __create_selinuxfs(self):
commit 985092a541cbafbc91bccb73fd9d1bede2c4d283 Author: Jeremy Katz katzj@redhat.com Date: Tue Aug 5 18:00:58 2008 -0400
Ensure we don't have (stale) rpmdb locks
If we're basing on a previous ISO, we may have rpmdb locks left in the image which could be from a different version of rpm than the version we're using. So remove any before trying to open the rpmdb
diff --git a/imgcreate/yuminst.py b/imgcreate/yuminst.py index dd5b189..a7b04b6 100644 --- a/imgcreate/yuminst.py +++ b/imgcreate/yuminst.py @@ -16,6 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import glob import os import sys import logging @@ -70,6 +71,8 @@ class LiveCDYum(yum.YumBase):
def setup(self, confpath, installroot): self._writeConf(confpath, installroot) + for f in glob.glob(installroot + "/var/lib/rpm/__db*"): + os.unlink(f) self.doConfigSetup(fn = confpath, root = installroot) self.conf.cache = 0 self.doTsSetup()
livecd@lists.fedoraproject.org