From: John P. Davis Date: Wed, 14 Jul 2004 17:23:16 +0000 (+0000) Subject: fixed livecd-stage2 cleaning X-Git-Tag: CATALYST_2_0_6_916~955 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=74a51b2d6cead599c62b3f96be5f70a4fa90ed89;p=catalyst.git fixed livecd-stage2 cleaning git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@418 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 7144144e..ba56f9d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.71 2004/07/13 14:06:44 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.72 2004/07/14 17:23:16 zhen Exp $ + + 14 Jul 2004; John Davis + livecd/runscript-support/livecdfs-update.sh, + modules/generic_stage_target.py, modules/livecd_stage2_target.py: + fixed a bug for livecd-stage2. somehow, the inheritance got mucked up and the + livecds were not cleaning out livecd/empty livecd/rm etc. I moved the code for + this out of generic_stage_target and into livecd-stage2 since the + livecd-stage2 class was overriding generic_stage_target for cleaning anyway. 13 Jul 2004; livecd/runscript-support/livecdfs-update.sh: changed the behavior of rcadd/ rcdel. it was getting hokey to have to add the diff --git a/livecd/runscript-support/livecdfs-update.sh b/livecd/runscript-support/livecdfs-update.sh index c648c02b..ce272744 100755 --- a/livecd/runscript-support/livecdfs-update.sh +++ b/livecd/runscript-support/livecdfs-update.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/livecd/runscript-support/Attic/livecdfs-update.sh,v 1.7 2004/07/13 14:06:44 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/livecd/runscript-support/Attic/livecdfs-update.sh,v 1.8 2004/07/14 17:23:16 zhen Exp $ /usr/sbin/env-update source /etc/profile @@ -16,6 +16,7 @@ fi # fix /etc/issue for mingetty and friends echo "This is \n.gentoo (\s \m \r) \t" > /etc/issue +# switch the order of rcadd/ rcdel if [ -n "${clst_livecd_rcadd}" ] || [ -n "${clst_livecd_rcdel}" ] then if [ -n "${clst_livecd_rcadd}" ] diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index cce16062..c4b1588d 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -1,6 +1,6 @@ # 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.6 2004/07/06 13:48:00 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.7 2004/07/14 17:23:16 zhen Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -335,10 +335,7 @@ class generic_stage_target(generic_target): def clean(self): destpath=self.settings["chroot_path"] - cleanables=["/etc/resolv.conf","/var/tmp/*","/tmp/*","/root/*"] - if self.settings["target"] not in ["livecd-stage2"]: - # we don't need to clean up a livecd-stage2 - cleanables.append("/usr/portage") + cleanables=["/etc/resolv.conf","/var/tmp/*","/tmp/*","/root/*","/usr/portage"] if self.settings["target"]=="stage1": destpath+="/tmp/stage1root" @@ -352,39 +349,8 @@ class generic_stage_target(generic_target): print "Cleaning chroot: "+x+"..." cmd("rm -rf "+destpath+x,"Couldn't clean "+x) - if self.settings["target"]=="livecd-stage2": - - if self.settings.has_key("livecd/empty"): - - if type(self.settings["livecd/empty"])==types.StringType: - self.settings["livecd/empty"]=[self.settings["livecd/empty"]] - - for x in self.settings["livecd/empty"]: - myemp=self.settings["chroot_path"]+x - if not os.path.isdir(myemp): - print x,"not a directory or does not exist, skipping 'empty' operation." - continue - print "Emptying directory",x - # stat the dir, delete the dir, recreate the dir and set the proper perms and ownership - mystat=os.stat(myemp) - shutil.rmtree(myemp) - os.makedirs(myemp) - os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) - os.chmod(myemp,mystat[ST_MODE]) - - if self.settings.has_key("livecd/rm"): - - if type(self.settings["livecd/rm"])==types.StringType: - self.settings["livecd/rm"]=[self.settings["livecd/rm"]] - - for x in self.settings["livecd/rm"]: - # we're going to shell out for all these cleaning operations, so we get easy glob handling - print "livecd: removing "+x - os.system("rm -rf "+self.settings["chroot_path"]+x) - - if self.settings["target"]!="livecd-stage2": - cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\ - "/"+self.settings["target"]+".sh clean","clean script failed.") + cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\ + "/"+self.settings["target"]+".sh clean","clean script failed.") def preclean(self): # cleanup after distcc diff --git a/modules/livecd_stage2_target.py b/modules/livecd_stage2_target.py index 09c37bb1..605c6f21 100644 --- a/modules/livecd_stage2_target.py +++ b/modules/livecd_stage2_target.py @@ -1,12 +1,12 @@ # 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.14 2004/07/14 04:26:45 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.15 2004/07/14 17:23:16 zhen Exp $ """ Builder class for a LiveCD stage2 build. """ -import os,string,types +import os,string,types,stat,shutil from catalyst_support import * from generic_stage_target import * @@ -111,6 +111,36 @@ class livecd_stage2_target(generic_stage_target): touch(self.settings["chroot_path"]+"/tmp/.clst_unmerge") def clean(self): + if self.settings.has_key("livecd/empty"): + + if type(self.settings["livecd/empty"])==types.StringType: + self.settings["livecd/empty"]=[self.settings["livecd/empty"]] + + for x in self.settings["livecd/empty"]: + myemp=self.settings["chroot_path"]+x + if not os.path.isdir(myemp): + print x,"not a directory or does not exist, skipping 'empty' operation." + continue + print "Emptying directory",x + # stat the dir, delete the dir, recreate the dir and set + # the proper perms and ownership + mystat=os.stat(myemp) + shutil.rmtree(myemp) + os.makedirs(myemp) + os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) + os.chmod(myemp,mystat[ST_MODE]) + + if self.settings.has_key("livecd/rm"): + + if type(self.settings["livecd/rm"])==types.StringType: + self.settings["livecd/rm"]=[self.settings["livecd/rm"]] + + for x in self.settings["livecd/rm"]: + # we're going to shell out for all these cleaning operations, + # so we get easy glob handling + print "livecd: removing "+x + os.system("rm -rf "+self.settings["chroot_path"]+x) + try: cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean",\ "Clean runscript failed.")