From: Eric Edgar Date: Wed, 27 Apr 2005 17:44:58 +0000 (+0000) Subject: Fix some exception handling in catalyst_support.py X-Git-Tag: CATALYST_2_0_6_916~755 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e9c71aeeb3ef4c4b385a00678cf795c3b958fd03;p=catalyst.git Fix some exception handling in catalyst_support.py remove intermediate destination folder of iso and tarball Add additional tests for folders not found on host but defined in spec file. Keep catalyst from erroring in this case. Change exit code on shell scripts so that errors are reported to catalyst and causes catalyst to die on errors Fix bug in livecd-stage1-chroot.sh so that it uses USE flags properly Added additional check for mkisofs. Informs user of where to get the program. Removed autoresume code from ccache and distcc installation until I can figure out a way to have the autoresume flag go someplace outside the chroot. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@628 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 7d0fbe75..7e974506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,30 @@ # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.240 2005/04/26 18:30:50 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.241 2005/04/27 17:44:58 rocket Exp $ + + 27 Apr 2005; Eric Edgar modules/catalyst_support.py, + modules/generic_stage_target.py, modules/livecd_stage1_target.py, + modules/livecd_stage2_target.py, modules/snapshot_target.py, + targets/embedded/embedded-controller.sh, targets/grp/grp-controller.sh, + targets/livecd-stage1/livecd-stage1-chroot.sh, + targets/livecd-stage1/livecd-stage1-controller.sh, + targets/livecd-stage2/livecd-stage2-controller.sh, + targets/netboot/netboot-controller.sh, + targets/stage1/stage1-controller.sh, targets/stage2/stage2-controller.sh, + targets/stage3/stage3-controller.sh, targets/stage4/stage4-controller.sh, + targets/support/bootloader-setup.sh, targets/support/chroot-functions.sh, + targets/support/create-iso.sh, targets/support/kmerge.sh, + targets/support/target_image_setup.sh, + targets/tinderbox/tinderbox-controller.sh: + Fix some exception handling in catalyst_support.py + remove intermediate destination folder of iso and tarball + Add additional tests for folders not found on host but defined + in spec file. Keep catalyst from erroring in this case. + Change exit code on shell scripts so that errors are reported to catalyst + and causes catalyst to die on errors + Fix bug in livecd-stage1-chroot.sh so that it uses USE flags properly + Added additional check for mkisofs. Informs user of where to get the program. + Removed autoresume code from ccache and distcc installation until I can figure + out a way to have the autoresume flag go someplace outside the chroot. 26 Apr 2005; Eric Edgar catalyst: Remove bind mounts before rm operations happen at startup diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index 89a69ca4..47af6acc 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.43 2005/04/26 14:58:04 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.44 2005/04/27 17:44:58 rocket Exp $ import sys,string,os,types,re,signal,traceback,md5,time # a function to turn a string of non-printable characters into a string of @@ -137,17 +137,17 @@ def spawn(mystring,debug=0,fd_pipes=None): return # should never get reached try: retval=os.waitpid(mypid,0)[1] + if (retval & 0xff)==0: + return (retval >> 8) # return exit code + else: + return ((retval & 0xff) << 8) # interrupted by signal + except: os.kill(mypid,signal.SIGTERM) if os.waitpid(mypid,os.WNOHANG)[1] == 0: # feisty bugger, still alive. os.kill(mypid,signal.SIGKILL) - if (retval & 0xff)==0: - return (retval >> 8) # return exit code - else: - return ((retval & 0xff) << 8) # interrupted by signal - def cmd(mycmd,myexc=""): try: diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 445e2667..e9ac5b38 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 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.40 2005/04/26 18:28:26 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.41 2005/04/27 17:44:58 rocket Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -104,10 +104,10 @@ class generic_stage_target(generic_target): self.set_target_subpath() # set paths - self.set_autoresume_path() self.set_snapshot_path() self.set_source_path() self.set_chroot_path() + self.set_autoresume_path() self.set_root_path() self.set_dest_path() self.set_stage_path() @@ -128,8 +128,6 @@ class generic_stage_target(generic_target): self.set_fsops() self.set_iso() self.set_packages() - self.set_target_file() - self.set_target_iso_path() # this next line checks to make sure that the specified variables exist on disk. @@ -208,32 +206,20 @@ class generic_stage_target(generic_target): "-"+self.settings["subarch"]+"-"+self.settings["version_stamp"] def set_target_path(self): - self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] + self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+".tar.bz2" if self.settings.has_key("AUTORESUME") \ and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): print "Resume point detected, skipping target path setup operation..." else: # first clean up any existing target stuff - if os.path.exists(self.settings["target_path"]): - cmd("rm -rf "+self.settings["target_path"], - "Could not remove existing directory: "+self.settings["target_path"]) - touch(self.settings["autoresume_path"]+"setup_target_path") + if os.path.isfile(self.settings["target_path"]): + cmd("rm -f "+self.settings["target_path"], + "Could not remove existing file: "+self.settings["target_path"]) + touch(self.settings["autoresume_path"]+"setup_target_path") - if not os.path.exists(self.settings["target_path"]): - os.makedirs(self.settings["target_path"]) - - def set_target_file(self): - if not os.path.exists(self.settings["target_path"]+"/tarball/"): - os.makedirs(self.settings["target_path"]+"/tarball/") - self.settings["target_file"]=self.settings["target_path"]+"/tarball/"+self.settings["target"]+"-"+self.settings["subarch"]+"-"+self.settings["version_stamp"]+".tar.bz2" + if not os.path.exists(self.settings["storedir"]+"/builds/"): + os.makedirs(self.settings["storedir"]+"/builds/") - def set_target_iso_path(self): - if self.settings.has_key("iso"): - print "setting up iso path" - if not os.path.exists(self.settings["target_path"]+"/iso/"): - os.makedirs(self.settings["target_path"]+"/iso/") - self.settings["target_iso_path"]=self.settings["target_path"]+"/iso/" - def set_fsscript(self): if self.settings.has_key(self.settings["spec_prefix"]+"/fsscript"): self.settings["fsscript"]=self.settings[self.settings["spec_prefix"]+"/fsscript"] @@ -305,7 +291,7 @@ class generic_stage_target(generic_target): self.settings["snapshot_path_md5sum"]=calc_md5(self.settings["snapshot_path"]) def set_chroot_path(self): - self.settings["chroot_path"]=self.settings["storedir"]+"/tmp/"+self.settings["target_subpath"] + self.settings["chroot_path"]=self.settings["storedir"]+"/tmp/"+self.settings["target_subpath"]+"/" def set_autoresume_path(self): self.settings["autoresume_path"]=self.settings["storedir"]+"/tmp/"+self.settings["rel_type"]+"/"+\ @@ -753,7 +739,7 @@ class generic_stage_target(generic_target): print "Creating stage tarball..." - cmd("tar cjf "+self.settings["target_file"]+" -C "+self.settings["stage_path"]+\ + cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["stage_path"]+\ " .","Couldn't create stage tarball") touch(self.settings["autoresume_path"]+"capture") @@ -807,10 +793,8 @@ class generic_stage_target(generic_target): print "Resume point detected, skipping unmerge operation..." else: if self.settings.has_key(self.settings["spec_prefix"]+"/unmerge"): - print "has key unmerge" if type(self.settings[self.settings["spec_prefix"]+"/unmerge"])==types.StringType: self.settings[self.settings["spec_prefix"]+"/unmerge"]=[self.settings[self.settings["spec_prefix"]+"/unmerge"]] - print "key is a string" myunmerge=self.settings[self.settings["spec_prefix"]+"/unmerge"][:] for x in range(0,len(myunmerge)): @@ -835,7 +819,7 @@ class generic_stage_target(generic_target): print "Resume point detected, skipping target_setup operation..." else: print "Setting up filesystems per filesystem type" - cmd("/bin/bash "+self.settings["controller_file"]+" target_image_setup "+ self.settings["target_iso_path"],"target_image_setup script failed.") + cmd("/bin/bash "+self.settings["controller_file"]+" target_image_setup "+ self.settings["target_path"],"target_image_setup script failed.") touch(self.settings["autoresume_path"]+"target_setup") def setup_overlay(self): @@ -843,10 +827,11 @@ class generic_stage_target(generic_target): and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"): print "Resume point detected, skipping setup_overlay operation..." else: - if self.settings.has_key(self.settings["spec_prefix"]+"/overlay"): - cmd("rsync -a "+self.settings[self.settings["spec_prefix"]+"/overlay"]+"/* "+\ - self.settings["target_iso_path"], self.settings["spec_prefix"]+"overlay copy failed.") - touch(self.settings["autoresume_path"]+"setup_overlay") + if self.settings.has_key(self.settings["spec_prefix"]+"/overlay") \ + and os.path.exists(self.settings["spec_prefix"]+"/overlay"): + cmd("rsync -a "+self.settings[self.settings["spec_prefix"]+"/overlay"]+"/* "+\ + self.settings["target_path"], self.settings["spec_prefix"]+"overlay copy failed.") + touch(self.settings["autoresume_path"]+"setup_overlay") def create_iso(self): if self.settings.has_key("AUTORESUME") \ @@ -940,6 +925,7 @@ class generic_stage_target(generic_target): "Runscript kernel build failed") if self.settings.has_key("boot/kernel/"+kname+"/initramfs_overlay"): + if os.path.exists(self.settings["chroot_path"]+"/tmp/initramfs_overlay/"): print "Cleaning up temporary overlay dir" cmd("rm -R "+self.settings["chroot_path"]+"/tmp/initramfs_overlay/") @@ -955,7 +941,7 @@ class generic_stage_target(generic_target): print "Resume point detected, skipping bootloader operation..." else: try: - cmd("/bin/bash "+self.settings["controller_file"]+" bootloader " + self.settings["target_iso_path"],\ + cmd("/bin/bash "+self.settings["controller_file"]+" bootloader " + self.settings["target_path"],\ "Bootloader runscript failed.") touch(self.settings["autoresume_path"]+"bootloader") except CatalystError: @@ -985,8 +971,11 @@ class generic_stage_target(generic_target): # stat the dir, delete the dir, recreate the dir and set # the proper perms and ownership mystat=os.stat(myemp) + #cmd("rm -rf "+myemp, "Could not remove existing file: "+myemp) shutil.rmtree(myemp) os.makedirs(myemp,0755) + os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) + os.chmod(myemp,mystat[ST_MODE]) def clear_packages(self): if self.settings.has_key("PKGCACHE"): @@ -1000,9 +989,13 @@ class generic_stage_target(generic_target): # stat the dir, delete the dir, recreate the dir and set # the proper perms and ownership mystat=os.stat(myemp) + #cmd("rm -rf "+myemp, "Could not remove existing file: "+myemp) shutil.rmtree(myemp) os.makedirs(myemp,0755) - def clear_autoresume(self): + os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) + os.chmod(myemp,mystat[ST_MODE]) + + def clear_autoresume(self): # clean resume points since they are no longer needed if self.settings.has_key("AUTORESUME"): print "Removing AutoResume Points: ..." @@ -1014,8 +1007,11 @@ class generic_stage_target(generic_target): # stat the dir, delete the dir, recreate the dir and set # the proper perms and ownership mystat=os.stat(myemp) + #cmd("rm -rf "+myemp, "Could not remove existing file: "+myemp) shutil.rmtree(myemp) os.makedirs(myemp,0755) + os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) + os.chmod(myemp,mystat[ST_MODE]) def purge(self): countdown(10,"Purging Caches ...") diff --git a/modules/livecd_stage1_target.py b/modules/livecd_stage1_target.py index eb83f6f8..3fae8386 100644 --- a/modules/livecd_stage1_target.py +++ b/modules/livecd_stage1_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.11 2005/04/21 14:45:09 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.12 2005/04/27 17:44:58 rocket Exp $ """ Builder class for LiveCD stage1. @@ -20,8 +20,25 @@ class livecd_stage1_target(generic_stage_target): "config_profile_link","setup_confdir","portage_overlay",\ "bind","chroot_setup","setup_environment","build_packages",\ "unbind", "clean","clear_autoresume"] - - def set_spec_prefix(self): + def set_target_path(self): + self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): + print "Resume point detected, skipping target path setup operation..." + else: + # first clean up any existing target stuff + if os.path.exists(self.settings["target_path"]): + cmd("rm -rf "+self.settings["target_path"],\ + "Could not remove existing directory: "+self.settings["target_path"]) + touch(self.settings["autoresume_path"]+"setup_target_path") + + if not os.path.exists(self.settings["target_path"]): + os.makedirs(self.settings["target_path"]) + + + def set_target_path(self): + pass + def set_spec_prefix(self): self.settings["spec_prefix"]="livecd" def set_packages(self): diff --git a/modules/livecd_stage2_target.py b/modules/livecd_stage2_target.py index f6cb191f..89080369 100644 --- a/modules/livecd_stage2_target.py +++ b/modules/livecd_stage2_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 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.37 2005/04/22 18:33:06 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.38 2005/04/27 17:44:58 rocket Exp $ """ Builder class for a LiveCD stage2 build. @@ -42,7 +42,20 @@ class livecd_stage2_target(generic_stage_target): def set_spec_prefix(self): self.settings["spec_prefix"]="livecd" - + def set_target_path(self): + self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): + print "Resume point detected, skipping target path setup operation..." + else: + # first clean up any existing target stuff + if os.path.isdir(self.settings["target_path"]): + cmd("rm -rf "+self.settings["target_path"], + "Could not remove existing directory: "+self.settings["target_path"]) + touch(self.settings["autoresume_path"]+"setup_target_path") + if not os.path.exists(self.settings["target_path"]): + os.makedirs(self.settings["target_path"]) + def unpack(self): if not os.path.isdir(self.settings["source_path"]): generic_stage_target.unpack(self) diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py index 37a11393..e19bf3e3 100644 --- a/modules/snapshot_target.py +++ b/modules/snapshot_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.8 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.9 2005/04/27 17:44:58 rocket Exp $ """ Builder class for snapshots. @@ -27,7 +27,10 @@ class snapshot_target(generic_target): x=self.settings["storedir"]+"/snapshots" if not os.path.exists(x): os.makedirs(x) - + + def mount_safety_check(self): + pass + def run(self): self.setup() print "Creating Portage tree snapshot "+self.settings["version_stamp"]+\ diff --git a/targets/embedded/embedded-controller.sh b/targets/embedded/embedded-controller.sh index 0008390b..38434784 100755 --- a/targets/embedded/embedded-controller.sh +++ b/targets/embedded/embedded-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/embedded/embedded-controller.sh,v 1.2 2005/04/21 14:23:11 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/embedded/embedded-controller.sh,v 1.3 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -69,4 +69,4 @@ case $1 in ;; esac -exit 0 +exit $? diff --git a/targets/grp/grp-controller.sh b/targets/grp/grp-controller.sh index 1465621b..4700390a 100755 --- a/targets/grp/grp-controller.sh +++ b/targets/grp/grp-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/grp-controller.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/grp-controller.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh case $1 in @@ -21,7 +21,6 @@ case $1 in preclean) exec_in_chroot ${clst_sharedir}/targets/grp/grp-preclean-chroot.sh - exit 0 ;; clean) @@ -33,4 +32,4 @@ case $1 in ;; esac -exit 0 +exit $? diff --git a/targets/livecd-stage1/livecd-stage1-chroot.sh b/targets/livecd-stage1/livecd-stage1-chroot.sh index fffe66c6..392e8a5d 100755 --- a/targets/livecd-stage1/livecd-stage1-chroot.sh +++ b/targets/livecd-stage1/livecd-stage1-chroot.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-chroot.sh,v 1.16 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-chroot.sh,v 1.17 2005/04/27 17:44:58 rocket Exp $ . /tmp/chroot-functions.sh @@ -21,5 +21,6 @@ setup_portage #turn off auto-use: export USE_ORDER="env:pkg:conf:defaults" +export USE="${clst_livecd_use}" run_emerge "${clst_packages}" diff --git a/targets/livecd-stage1/livecd-stage1-controller.sh b/targets/livecd-stage1/livecd-stage1-controller.sh index 4060da14..b176a3cc 100755 --- a/targets/livecd-stage1/livecd-stage1-controller.sh +++ b/targets/livecd-stage1/livecd-stage1-controller.sh @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-controller.sh,v 1.6 2005/04/21 14:23:11 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-controller.sh,v 1.7 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -17,4 +17,4 @@ case $1 in find ${clst_chroot_path}/usr/lib -iname "*.pyc" -exec rm -f {} \; ;; esac -exit 0 +exit $? diff --git a/targets/livecd-stage2/livecd-stage2-controller.sh b/targets/livecd-stage2/livecd-stage2-controller.sh index f4a27857..c50aafb3 100755 --- a/targets/livecd-stage2/livecd-stage2-controller.sh +++ b/targets/livecd-stage2/livecd-stage2-controller.sh @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/livecd-stage2-controller.sh,v 1.8 2005/04/21 14:23:11 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/livecd-stage2-controller.sh,v 1.9 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -98,4 +98,4 @@ case $1 in ${clst_sharedir}/targets/support/create-iso.sh $1 ;; esac -exit 0 +exit $? diff --git a/targets/netboot/netboot-controller.sh b/targets/netboot/netboot-controller.sh index ea6ef36b..19b1987e 100755 --- a/targets/netboot/netboot-controller.sh +++ b/targets/netboot/netboot-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-controller.sh,v 1.1 2005/04/04 17:50:30 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-controller.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -72,4 +72,4 @@ case ${1} in exit 1;; esac -exit 0 +exit $? diff --git a/targets/stage1/stage1-controller.sh b/targets/stage1/stage1-controller.sh index 5a2de7fb..a0192775 100755 --- a/targets/stage1/stage1-controller.sh +++ b/targets/stage1/stage1-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-controller.sh,v 1.2 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-controller.sh,v 1.3 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -42,5 +42,5 @@ case $1 in ;; esac -exit 0 +exit $? diff --git a/targets/stage2/stage2-controller.sh b/targets/stage2/stage2-controller.sh index 248e3ba2..a714dafd 100755 --- a/targets/stage2/stage2-controller.sh +++ b/targets/stage2/stage2-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-controller.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-controller.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -32,4 +32,4 @@ case $1 in esac -exit 0 +exit $? diff --git a/targets/stage3/stage3-controller.sh b/targets/stage3/stage3-controller.sh index 1eb25548..e4689f7b 100755 --- a/targets/stage3/stage3-controller.sh +++ b/targets/stage3/stage3-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-controller.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-controller.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -32,4 +32,4 @@ case $1 in esac -exit 0 +exit $? diff --git a/targets/stage4/stage4-controller.sh b/targets/stage4/stage4-controller.sh index cbee6e6c..324178c5 100755 --- a/targets/stage4/stage4-controller.sh +++ b/targets/stage4/stage4-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage4/stage4-controller.sh,v 1.3 2005/04/21 14:23:11 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage4/stage4-controller.sh,v 1.4 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -73,4 +73,4 @@ case $1 in esac -exit 0 +exit $? diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh index fdc52685..606e4a2b 100755 --- a/targets/support/bootloader-setup.sh +++ b/targets/support/bootloader-setup.sh @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.1 2005/04/21 14:23:12 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -185,4 +185,4 @@ case ${clst_mainarch} in fi ;; esac -exit 0 +exit $? diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index aaa3d916..6c9ff15d 100755 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -52,25 +52,26 @@ setup_myfeatures(){ if [ -n "${clst_CCACHE}" ] then export clst_myfeatures="${clst_myfeatures} ccache" - if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_ccache ] - then - echo "CCACHE Autoresume point found not emerging ccache" - else - emerge --oneshot --nodeps -b -k ccache && touch /tmp/.clst_ccache || exit 1 - touch /tmp/.clst_ccache - fi + #if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_ccache ] + #then + # echo "CCACHE Autoresume point found not emerging ccache" + #else + emerge --oneshot --nodeps -b -k ccache || exit 1 + # touch /tmp/.clst_ccache + #fi fi if [ -n "${clst_DISTCC}" ] then export clst_myfeatures="${clst_myfeatures} distcc" export DISTCC_HOSTS="${clst_distcc_hosts}" - if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_distcc ] - then - echo "DISTCC Autoresume point found not emerging distcc" - else - USE="-gtk -gnome" emerge --oneshot --nodeps -b -k distcc && touch /tmp/.clst_distcc || exit 1 - fi + #if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_distcc ] + #then + # echo "DISTCC Autoresume point found not emerging distcc" + #else + USE="-gtk -gnome" emerge --oneshot --nodeps -b -k distcc || exit 1 + #touch /tmp/.clst_distcc + #fi fi } diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index d5c224f9..4f19c18a 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/create-iso.sh,v 1.1 2005/04/21 14:23:12 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/create-iso.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh #. ${clst_sharedir}/targets/${clst_target}/${clst_mainarch}-archscript.sh @@ -8,16 +8,25 @@ #source ${clst_livecd_archscript} ## START RUNSCRIPT +if [ ! -f /usr/bin/mkisofs ] +then + echo + echo + die " /usr/bin/mkisofs is not found. Have you merged cdrtools?" + echo + echo +fi + case ${clst_mainarch} in alpha) # this is for the livecd-final target, and calls the proper # command to build the iso file case ${clst_fstype} in zisofs) - mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} ${clst_target_iso_path} || die "Cannot make ISO image" + mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" ;; *) - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} ${clst_target_iso_path} || die "Cannot make ISO image" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" ;; esac isomarkboot ${1} /boot/bootlx @@ -27,19 +36,19 @@ case ${clst_mainarch} in ;; hppa) #this is for the livecd-stage2 target, and calls the proper command to build the iso file - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} ${clst_target_iso_path} || die "Cannot make ISO image" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" palo -f boot/palo.conf -C ${1} ;; ppc) # The name of the iso should be retrieved from the specs. For now, asssume GentooPPC_2004.0 - mkisofs -J -r -l -netatalk -hfs -probe -map ${clst_target_iso_path}/boot/map.hfs -part -no-desktop -hfs-iso_volume_id \ - "${clst_iso_volume_id}" -hfs-bless ${clst_target_iso_path}/boot -V "${clst_iso_volume_id}" -o ${1} ${clst_target_iso_path} + mkisofs -J -r -l -netatalk -hfs -probe -map ${clst_target_path}/boot/map.hfs -part -no-desktop -hfs-iso_volume_id \ + "${clst_iso_volume_id}" -hfs-bless ${clst_target_path}/boot -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} ;; sparc) # this is for the livecd-final target, and calls the proper # command to build the iso file - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -G ${clst_target_iso_path}/boot/isofs.b -B ... ${clst_target_iso_path} \ + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -G ${clst_target_path}/boot/isofs.b -B ... ${clst_target_path} \ || die "Cannot make ISO image" ;; @@ -48,11 +57,11 @@ case ${clst_mainarch} in # Only silo 1.2.x seems to work for most hardware # Seems silo 1.3.x+ breaks on newer machines # when booting from CD (current as of silo 1.4.8) - mv ${clst_target_iso_path}/boot/mkisofs.sparc.fu /tmp + mv ${clst_target_path}/boot/mkisofs.sparc.fu /tmp /tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S 'boot/cd.b' -B '/boot/second.b' \ -s '/boot/silo.conf' -abstract 'Gentoo Linux Sparc' -copyright 'Gentoo Foundation' \ -P 'Gentoo Linux Sparc' -p 'Gentoo Linux Sparc' -V "${clst_iso_volume_id}" \ - -A 'G entoo Linux Sparc' ${clst_target_iso_path} || die "Cannot make ISO image" + -A 'G entoo Linux Sparc' ${clst_target_path} || die "Cannot make ISO image" rm /tmp/mkisofs.sparc.fu ;; @@ -61,42 +70,42 @@ case ${clst_mainarch} in #this is for the livecd-stage2 target, and calls the proper command # to build the iso file # - if [ -e ${clst_target_iso_path}/boot/isolinux.bin ] + if [ -e ${clst_target_path}/boot/isolinux.bin ] then case ${clst_fstype} in zisofs) mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b boot/isolinux.bin -c boot/boot.cat -no-emul-boot \ - -boot-load-size 4 -boot-info-table -z ${clst_target_iso_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table -z ${clst_target_path} || die "Cannot make ISO image" ;; *) mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b boot/isolinux.bin -c boot/boot.cat -no-emul-boot \ - -boot-load-size 4 -boot-info-table ${clst_target_iso_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table ${clst_target_path} || die "Cannot make ISO image" ;; esac - elif [ -e ${clst_target_iso_path}/boot/grub/stage2_eltorito ] + elif [ -e ${clst_target_path}/boot/grub/stage2_eltorito ] then case ${clst_fstype} in zisofs) mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot \ - -boot-load-size 4 -boot-info-table -z ${clst_target_iso_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table -z ${clst_target_path} || die "Cannot make ISO image" ;; *) mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot \ - -boot-load-size 4 -boot-info-table ${clst_target_iso_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table ${clst_target_path} || die "Cannot make ISO image" ;; esac else case ${clst_fstype} in zisofs) mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ - -z ${clst_target_iso_path} || die "Cannot make ISO image" + -z ${clst_target_path} || die "Cannot make ISO image" ;; *) mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ - ${clst_target_iso_path} || die "Cannot make ISO image" + ${clst_target_path} || die "Cannot make ISO image" ;; esac fi ;; esac -exit 0 +exit $? diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh index 1fb19d30..862d5488 100755 --- a/targets/support/kmerge.sh +++ b/targets/support/kmerge.sh @@ -31,7 +31,7 @@ setup_gk_args() { GK_ARGS="${GK_ARGS} --gensplash=${clst_splash_theme}" fi - if [ -n "${clst_initramfs_overlay}" ] + if [ -d "${clst_initramfs_overlay}" ] then GK_ARGS="${GK_ARGS} --initramfs-overlay=/tmp/initramfs_overlay/${clst_initramfs_overlay}" fi diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh index 74a79e9a..b10e5198 100755 --- a/targets/support/target_image_setup.sh +++ b/targets/support/target_image_setup.sh @@ -41,4 +41,8 @@ case ${clst_fstype} in loopret=$? ;; esac +if [ ${loopret} = "1" ] +then + die "Filesystem not setup" +fi exit $loopret diff --git a/targets/tinderbox/tinderbox-controller.sh b/targets/tinderbox/tinderbox-controller.sh index e75cac51..b2118317 100755 --- a/targets/tinderbox/tinderbox-controller.sh +++ b/targets/tinderbox/tinderbox-controller.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/tinderbox/tinderbox-controller.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/tinderbox/tinderbox-controller.sh,v 1.2 2005/04/27 17:44:58 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -14,7 +14,6 @@ case $1 in preclean) #exec_in_chroot ${clst_sharedir}/targets/grp/tinderbox-preclean-chroot.sh delete_from_chroot /tmp/chroot-functions.sh - exit 0 ;; clean) @@ -27,4 +26,4 @@ case $1 in esac -exit 0 +exit $?