Fix bug in livecd stage2 so that it doesnt try to use tar
authorEric Edgar <rocket@gentoo.org>
Tue, 15 Nov 2005 21:03:04 +0000 (21:03 +0000)
committerEric Edgar <rocket@gentoo.org>
Tue, 15 Nov 2005 21:03:04 +0000 (21:03 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@888 d1e1f19c-881f-0410-ab34-b69fee027534

modules/livecd_stage2_target.py

index 338cc500c741f6a09f8c19ba9a42d81af96a12ea..cf419452e9be1a41f4da91ba2e82654264f8634d 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.50 2005/11/07 16:27:54 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.51 2005/11/15 21:03:04 rocket Exp $
 
 """
 Builder class for a LiveCD stage2 build.
@@ -71,6 +71,57 @@ class livecd_stage2_target(generic_stage_target):
                        for x in self.settings["livecd/modblacklist"]:
                                myf.write("\n"+x)
                        myf.close()
+        def unpack(self):
+                unpack=True
+
+                clst_unpack_md5sum=read_from_clst(self.settings["autoresume_path"]+"unpack")
+
+                if os.path.isdir(self.settings["source_path"]):
+                        unpack_cmd="rsync -a --delete "+self.settings["source_path"]+" "+self.settings["chroot_path"]
+                        display_msg="\nStarting rsync from "+self.settings["source_path"]+"\nto "+\
+                                self.settings["chroot_path"]+" (This may take some time) ...\n"
+                        error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed."
+                        invalid_snapshot=False
+
+                if self.settings.has_key("AUTORESUME"):
+                    if os.path.isdir(self.settings["source_path"]) and \
+                            os.path.exists(self.settings["autoresume_path"]+"unpack"):
+                                print "Resume point detected, skipping unpack operation..."
+                                unpack=False
+                    elif self.settings.has_key("source_path_md5sum"):
+                        if self.settings["source_path_md5sum"] != clst_unpack_md5sum:
+                                invalid_snapshot=True
+
+                if unpack:
+                        self.mount_safety_check()
+
+                        if invalid_snapshot:
+                                print "No Valid Resume point detected, cleaning up  ..."
+                                #os.remove(self.settings["autoresume_path"]+"dir_setup")
+                                self.clear_autoresume()
+                                self.clear_chroot()
+                                #self.dir_setup()
+
+                        if not os.path.exists(self.settings["chroot_path"]):
+                                os.makedirs(self.settings["chroot_path"])
+
+                        if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
+                                os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
+
+                        if self.settings.has_key("PKGCACHE"):
+                                if not os.path.exists(self.settings["pkgcache_path"]):
+                                        os.makedirs(self.settings["pkgcache_path"],0755)
+
+                        print display_msg
+                        cmd(unpack_cmd,error_msg)
+
+                        if self.settings.has_key("source_path_md5sum"):
+                                myf=open(self.settings["autoresume_path"]+"unpack","w")
+                                myf.write(self.settings["source_path_md5sum"])
+                                myf.close()
+                        else:
+                                touch(self.settings["autoresume_path"]+"unpack")
+
 
        def set_action_sequence(self):
            self.settings["action_sequence"]=["unpack","unpack_snapshot",\