# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.5 2004/07/03 00:33:37 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.6 2004/07/06 13:48:00 zhen Exp $
"""
This class does all of the chroot setup, copying of files, etc. It is
print "Setting up directories..."
self.mount_safety_check()
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
- print "Directories previously setup, resuming..."
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_dir_setup"):
+ print "Resume point detected, skipping directory setup..."
else:
cmd("rm -rf "+self.settings["chroot_path"],\
"Could not remove existing directory: "+self.settings["chroot_path"])
-
+
+ if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
+ os.makedirs(self.settings["chroot_path"]+"/tmp")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_dir_setup")
+
if not os.path.exists(self.settings["chroot_path"]):
os.makedirs(self.settings["chroot_path"])
if self.settings.has_key("PKGCACHE"):
if not os.path.exists(self.settings["pkgcache_path"]):
os.makedirs(self.settings["pkgcache_path"])
-
+
+
def unpack_and_bind(self):
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack_and_bind"):
print "Resume point detected, skipping unpack and bind operation..."
else:
cmd("tar xjpf "+self.settings["snapshot_path"]+" -C "+\
self.settings["chroot_path"]+"/usr","Error unpacking snapshot")
- touch(self.settings["chroot_path"]+"/tmp/.unpack_and_bind")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_unpack_and_bind")
# for safety's sake, we really don't want to resume these either
print "Configuring profile link..."
# now make sure path exists
if not os.path.exists(mypath):
os.makedirs(mypath)
+
+ # clean resume points since they are no longer needed
+ if self.settings.has_key("AUTORESUME"):
+ cmd("rm -f "+self.settings["chroot_path"]+"/tmp/.clst*",\
+ "Couldn't remove resume points")
+
print "Creating stage tarball..."
if self.settings["target"]=="stage1":
# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.11 2004/07/03 00:33:37 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.12 2004/07/06 13:48:00 zhen Exp $
"""
Builder class for a LiveCD stage2 build.
def unpack_and_bind(self):
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["cdroot_path"]+"/tmp/.unpack_and_bind"):
- print "Detected resume point, skipping unpack and bind operation..."
+ and os.path.exists(self.settings["cdroot_path"]+"/tmp/.clst_unpack_and_bind"):
+ print "Resume point detected, skipping unpack and bind operation..."
else:
if os.path.exists(self.settings["chroot_path"]):
print "Copying livecd-stage1 result to new livecd-stage2 work directory..."
cmd("cp -a "+self.settings["source_path"]+"/* "+self.settings["chroot_path"],
"Error copying initial livecd-stage2")
- touch(self.settings["chroot_path"]+"/tmp/.unpack_and_bind")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_unpack_and_bind")
# we do not want to resume code below this line
print "Configuring profile link..."
def unmerge(self):
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/unmerge"):
- print "Detected resume point, skipping unmerge operation..."
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unmerge"):
+ print "Resume point detected, skipping unmerge operation..."
else:
if self.settings.has_key("livecd/unmerge"):
except CatalystError:
self.unbind()
raise
- touch(self.settings["chroot_path"]+"/tmp/unmerge")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_unmerge")
def clean(self):
- if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.clean"):
- print "Detected resume point, skipping clean operation..."
-
- else:
- generic_stage_target.clean(self)
- try:
- cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean",\
- "Clean runscript failed.")
- except:
- self.unbind()
- raise
- touch(self.settings["chroot_path"]+"/tmp/.clean")
+ try:
+ cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean",\
+ "Clean runscript failed.")
+ except:
+ self.unbind()
+ raise
def preclean(self):
- if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.preclean"):
- print "Detected resume point, skipping preclean operation..."
-
- else:
- try:
- cmd("/bin/bash "+self.settings["livecd/runscript"]+" preclean",
- "Preclean runscript failed.")
-
- except:
- self.unbind()
- raise
- touch(self.settings["chroot_path"]+"/tmp/.preclean")
+ try:
+ cmd("/bin/bash "+self.settings["livecd/runscript"]+" preclean",\
+ "Preclean runscript failed.")
+
+ except:
+ self.unbind()
+ raise
def cdroot_setup(self):
- if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.cdroot_setup"):
- print "Detected resume point, skipping cdroot setup..."
-
- else:
- cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","CDFS runscript failed.")
- if self.settings.has_key("livecd/overlay"):
- cmd("/bin/cp -a "+self.settings["livecd/overlay"]+"/* "+\
- self.settings["cdroot_path"],"LiveCD overlay copy failed.")
-
- touch(self.settings["chroot_path"]+"/tmp/.cdroot_setup")
+ cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","CDFS runscript failed.")
+ if self.settings.has_key("livecd/overlay"):
+ cmd("/bin/cp -a "+self.settings["livecd/overlay"]+"/* "+\
+ self.settings["cdroot_path"],"LiveCD overlay copy failed.")
+
+ # clean up the resume points
+ if self.settings.has_key("AUTORESUME"):
+ cmd("rm -f "+self.settings["chroot_path"]+"/tmp/.clst*",\
+ "Couldn't remove resume points")
+
# create the ISO - this is the preferred method (the iso scripts do not always work)
if self.settings.has_key("livecd/iso"):
cmd("/bin/bash "+self.settings["livecd/runscript"]+" iso "+\
# first clean up any existing cdroot stuff
# unless of course we are resuming
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_cdroot_clean"):
- print "Detected resume point, not cleaning cdroot_path..."
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_run_local_cdroot_clean"):
+ print "Resume point detected, not cleaning cdroot_path..."
else:
if os.path.exists(self.settings["cdroot_path"]):
"Could not remove existing directory: "+self.settings["cdroot_path"])
else:
os.makedirs(self.settings["cdroot_path"])
- touch(self.settings["chroot_path"]+"/tmp/.run_local_cdroot_clean")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_run_local_cdroot_clean")
# the runscripts do the real building, so execute them now
# this is the part that we want to resume on since it is the most time consuming
try:
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_kernel_script"):
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_run_local_kernel_script"):
print "Resume point detected, skipping kernel build runscript..."
else:
self.build_kernel()
- touch(self.settings["chroot_path"]+"/tmp/.run_local_kernel_script")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_run_local_kernel_script")
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_bootloader_script"):
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_run_local_bootloader_script"):
print "Resume point detected, skipping bootloader runscript..."
else:
cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader","Bootloader runscript failed.")
- touch(self.settings["chroot_path"]+"/tmp/.run_local_bootloader_script")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_run_local_bootloader_script")
except CatalystError:
self.unbind()
# what modules do we want to blacklist?
if self.settings.has_key("AUTORESUME") \
- and os.path.exists(self.settings["chroot_path"]+"/tmp/.run_local_blacklist"):
+ and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_run_local_blacklist"):
print "Resume point detected, skipping module blacklisting..."
else:
for x in self.settings["livecd/modblacklist"]:
myf.write("\n"+x)
myf.close()
- touch(self.settings["chroot_path"]+"/tmp/.run_local_blacklist")
+ touch(self.settings["chroot_path"]+"/tmp/.clst_run_local_blacklist")
def register(foo):
foo.update({"livecd-stage2":livecd_stage2_target})