From: Eric Edgar Date: Thu, 17 Nov 2005 22:04:26 +0000 (+0000) Subject: Move checks of running catalyst into the target which is simpler X-Git-Tag: CATALYST_2_0_6_916~600 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ad6d775644717863394c08b0a6e7ff24b1b235be;p=catalyst.git Move checks of running catalyst into the target which is simpler git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@894 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 90c92ab1..3c3165cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.382 2005/11/17 20:56:15 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.383 2005/11/17 22:04:26 rocket Exp $ + + 17 Nov 2005; Eric Edgar catalyst, + modules/generic_stage_target.py: + Move checks of running catalyst into the target which is simpler 17 Nov 2005; Eric Edgar modules/generic_stage_target.py: diff --git a/catalyst b/catalyst index 9b9c5458..c80fbb60 100755 --- a/catalyst +++ b/catalyst @@ -1,7 +1,7 @@ #!/usr/bin/python # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.97 2005/11/17 20:27:57 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.98 2005/11/17 22:04:26 rocket Exp $ # Maintained in full by: # Eric Edgar @@ -190,27 +190,11 @@ def build_target(addlargs, targetmap): mytarget=targetmap[addlargs["target"]](conf_values, addlargs) - # Kill any pids in the chroot - mytarget.kill_chroot_pids() - - # Check for mounts right away and abort if we cannot unmount them. - mytarget.mount_safety_check() - - if conf_values.has_key("CLEAR_AUTORESUME"): - mytarget.clear_autoresume() - - if conf_values.has_key("PURGE"): - mytarget.purge() - mytarget.run() - except CatalystError: - try: - mytarget.mount_safety_check() - except: - pass - sys.exit(1) - + except: + raise + if __name__ == "__main__": targetmap={} diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index a02d4e7c..f356826d 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -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/generic_stage_target.py,v 1.76 2005/11/17 20:56:16 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.77 2005/11/17 22:04:26 rocket Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -478,14 +478,14 @@ class generic_stage_target(generic_target): if ismount(mypath+x): #something is still mounted try: - print x+" is still mounted; performing auto-bind-umount..." + print x+" is still mounted; performing auto-bind-umount...", # try to umount stuff ourselves self.unbind() if ismount(mypath+x): raise CatalystError, "Auto-unbind failed for "+x else: - print "Auto-unbind successful, continuing..." + print "Auto-unbind successful..." except CatalystError: raise CatalystError, "Unable to auto-unbind "+x @@ -923,13 +923,24 @@ class generic_stage_target(generic_target): def run(self): self.chroot_lock.write_lock() + # Kill any pids in the chroot + self.kill_chroot_pids() + + # Check for mounts right away and abort if we cannot unmount them. + self.mount_safety_check() + + if self.settings.has_key("CLEAR_AUTORESUME"): + self.clear_autoresume() + if self.settings.has_key("PURGE"): + self.purge() + for x in self.settings["action_sequence"]: print "Running action sequence: "+x sys.stdout.flush() try: apply(getattr(self,x)) except: - self.unbind() + self.mount_safety_check() raise self.chroot_lock.unlock()