From: Eric Edgar Date: Thu, 21 Apr 2005 14:23:12 +0000 (+0000) Subject: embedded target cleanups ... iso,bootloader,target_setup generalizations, minor code... X-Git-Tag: CATALYST_2_0_6_916~765 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=47f6991214d63078c78a154bae93a29e7fc4261c;p=catalyst.git embedded target cleanups ... iso,bootloader,target_setup generalizations, minor code fixes git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@618 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index e9a9a7f5..8c5aef7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,26 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.230 2005/04/20 21:31:15 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.231 2005/04/21 14:23:11 rocket Exp $ + + 21 Apr 2005; Eric Edgar modules/catalyst_support.py, + modules/embedded_target.py, modules/generic_stage_target.py, + modules/grp_target.py, modules/livecd_stage1_target.py, + modules/livecd_stage2_target.py, modules/netboot_target.py, + modules/stage4_target.py, modules/tinderbox_target.py, + targets/embedded/embedded-chroot.sh, + targets/embedded/embedded-controller.sh, + targets/livecd-stage1/livecd-stage1-controller.sh, + -targets/livecd-stage2/livecd-stage2-bootloader.sh, + -targets/livecd-stage2/livecd-stage2-cdfs.sh, + targets/livecd-stage2/livecd-stage2-controller.sh, + -targets/livecd-stage2/livecd-stage2-iso.sh, + targets/stage4/stage4-chroot.sh, targets/stage4/stage4-controller.sh, + +targets/support/bootloader-setup.sh, targets/support/chroot-functions.sh, + +targets/support/create-iso.sh, targets/support/filesystem-functions.sh, + targets/support/functions.sh, targets/support/livecdfs-update.sh, + +targets/support/target_image_setup.sh: + embedded target cleanups ... iso,bootloader,target_setup generalizations, + minor code fixes 20 Apr 2005; Chris Gianelloni targets/livecd-stage2/livecd-stage2-controller.sh, diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index f9ca29c6..2c27afa2 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -1,8 +1,8 @@ # 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.38 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.39 2005/04/21 14:23:11 rocket Exp $ -import sys,string,os,types,re,traceback,md5 +import sys,string,os,types,re,signal,traceback,md5 # a function to turn a string of non-printable characters into a string of # hex characters def hexify(str): diff --git a/modules/embedded_target.py b/modules/embedded_target.py index e967078c..43143218 100644 --- a/modules/embedded_target.py +++ b/modules/embedded_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/embedded_target.py,v 1.10 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/embedded_target.py,v 1.11 2005/04/21 14:23:11 rocket Exp $ """ This class works like a 'stage3'. A stage2 tarball is unpacked, but instead @@ -27,40 +27,14 @@ class embedded_target(generic_stage_target): if addlargs.has_key("embedded/fs-type"): self.valid_values.append("embedded/fs-ops") - self.set_build_kernel_vars(addlargs) - generic_stage_target.__init__(self,spec,addlargs) - self.settings["image_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/image" - def build_fs(self): - try: - if self.settings.has_key("embedded/fs-type"): - cmd("/bin/bash "+self.settings["controller_file"]+" package","filesystem packaging failed") - except CatalystError: - self.unbind() - raise CatalystError, "embedded filesystem creation aborting due to error." - - # this code is mostly duplication from the livecd stage2 module - def pre_build_fs(self): - try: - if self.settings.has_key("embedded/fs-prepare"): - cmd("/bin/bash "+self.settings["embedded/fs-prepare"], "pre filesystem packaging cause an error in execution") - except CatalystError: - self.unbind() - raise CatalystError, "embedded pre filesystem creation script aborting due to error" - - def post_build_fs(self): - try: - if self.settings.has_key("embedded/fs-finish"): - cmd("/bin/bash "+self.settings["embedded/fs-finish"], "pre filesystem packaging cause an error in execution") - except CatalystError: - self.unbind() - raise CatalystError, "embedded post filesystem creation script aborting due to error" + self.set_build_kernel_vars(addlargs) def set_action_sequence(self): self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\ - "config_profile_link","setup_confdir","bind","chroot_setup",\ - "setup_environment","build_packages","build_kernel","unmerge","unbind",\ - "remove","empty","clean","pre_build_fs","build_fs","post_build_fs","clear_autoresume"] + "config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\ + "setup_environment","build_kernel","build_packages","bootloader","unmerge","unbind",\ + "remove","empty","clean","livecd_update","target_setup","create_iso","clear_autoresume"] def set_stage_path(self): self.settings["stage_path"]=self.settings["chroot_path"]+"/tmp/mergeroot" @@ -69,12 +43,10 @@ class embedded_target(generic_stage_target): def set_root_path(self): self.settings["root_path"]="/tmp/mergeroot" print "embedded root path is "+self.settings["root_path"] + def set_dest_path(self): self.settings["destpath"]=self.settings["chroot_path"]+self.settings["root_path"] - def set_target_path(self): - self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] - def register(foo): foo.update({"embedded":embedded_target}) return foo diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 5c1c23a9..e8027bfb 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.32 2005/04/15 16:49:45 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.33 2005/04/21 14:23:11 rocket Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -105,14 +105,14 @@ class generic_stage_target(generic_target): self.set_target_subpath() # set paths + self.set_autoresume_path() self.set_snapshot_path() - self.set_target_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() + self.set_target_path() self.set_controller_file() self.set_action_sequence() @@ -121,8 +121,17 @@ class generic_stage_target(generic_target): self.set_iso_volume_id() self.set_build_kernel_vars(addlargs) self.set_fsscript() + self.set_install_mask() self.set_rcadd() self.set_rcdel() + self.set_cdtar() + self.set_fstype() + 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. file_locate(self.settings,["source_path","snapshot_path","distdir"],expand=0) @@ -183,7 +192,12 @@ class generic_stage_target(generic_target): if self.makeconf.has_key("CXXFLAGS"): print "Using CXXFLAGS setting from seed stage" self.settings["CXXFLAGS"]=self.makeconf["CXXFLAGS"] - + + def set_install_mask(self): + if self.settings.has_key("install_mask"): + if type(self.settings["install_mask"]) != types.StringType: + self.settings["install_mask"]=string.join(self.settings["install_mask"]) + def set_spec_prefix(self): self.settings["spec_prefix"]=self.settings["target"] @@ -195,7 +209,31 @@ 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"]+".tar.bz2" + 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_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" + + 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"): @@ -212,6 +250,43 @@ class generic_stage_target(generic_target): self.settings["rcdel"]=self.settings[self.settings["spec_prefix"]+"/rcdel"] del self.settings[self.settings["spec_prefix"]+"/rcdel"] + def set_cdtar(self): + if self.settings.has_key(self.settings["spec_prefix"]+"/cdtar"): + self.settings["cdtar"]=self.settings[self.settings["spec_prefix"]+"/cdtar"] + del self.settings[self.settings["spec_prefix"]+"/cdtar"] + + def set_iso(self): + if self.settings.has_key(self.settings["spec_prefix"]+"/iso"): + self.settings["iso"]=self.settings[self.settings["spec_prefix"]+"/iso"] + del self.settings[self.settings["spec_prefix"]+"/iso"] + + def set_fstype(self): + if self.settings.has_key(self.settings["spec_prefix"]+"/cdfstype"): + print "\n\n\nWarning!!!"+self.settings["spec_prefix"]+"/cdfstype" + "is deprecated and may be removed." + print "\tUse "+self.settings["spec_prefix"]+"/fstype" + "instead.\n\n\n" + self.settings["fstype"]=self.settings[self.settings["spec_prefix"]+"/cdfstype"] + del self.settings[self.settings["spec_prefix"]+"/cdfstype"] + + if self.settings.has_key(self.settings["spec_prefix"]+"/fstype"): + self.settings["fstype"]=self.settings[self.settings["spec_prefix"]+"/fstype"] + del self.settings[self.settings["spec_prefix"]+"/fstype"] + + if not self.settings.has_key("fstype"): + self.settings["fstype"]="normal" + + def set_fsops(self): + if self.settings.has_key("fstype"): + self.valid_values.append("fsops") + if self.settings.has_key(self.settings["spec_prefix"]+"/fs-ops"): + print "\n\n\nWarning!!!"+self.settings["spec_prefix"]+"/fs-ops" + "is deprecated and may be removed." + print "\tUse "+self.settings["spec_prefix"]+"/fsops" + "instead.\n\n\n" + self.settings["fsops"]=self.settings[self.settings["spec_prefix"]+"/fs-ops"] + del self.settings[self.settings["spec_prefix"]+"/fs-ops"] + + if self.settings.has_key(self.settings["spec_prefix"]+"/fsops"): + self.settings["fsops"]=self.settings[self.settings["spec_prefix"]+"/fsops"] + del self.settings[self.settings["spec_prefix"]+"/fsops"] + def set_source_path(self): self.settings["source_path"]=self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2" if os.path.isfile(self.settings["source_path"]): @@ -267,6 +342,10 @@ class generic_stage_target(generic_target): def set_mounts(self): pass + def set_packages(self): + if self.settings.has_key("iso") + self.settings[self.settings["spec_prefix"]+"/packages"].append("livecd-tools") + def set_root_path(self): # ROOT= variable for emerges self.settings["root_path"]="/" @@ -684,7 +763,7 @@ class generic_stage_target(generic_target): print "Creating stage tarball..." - cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["stage_path"]+\ + cmd("tar cjf "+self.settings["target_file"]+" -C "+self.settings["stage_path"]+\ " .","Couldn't create stage tarball") touch(self.settings["autoresume_path"]+"capture") @@ -781,7 +860,8 @@ class generic_stage_target(generic_target): and os.path.exists(self.settings["autoresume_path"]+"target_setup"): print "Resume point detected, skipping target_setup operation..." else: - cmd("/bin/bash "+self.settings["controller_file"]+" cdfs","CDFS script failed.") + 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.") touch(self.settings["autoresume_path"]+"target_setup") def setup_overlay(self): @@ -791,7 +871,7 @@ class generic_stage_target(generic_target): else: if self.settings.has_key(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.") + self.settings["target_iso_path"], self.settings["spec_prefix"]+"overlay copy failed.") touch(self.settings["autoresume_path"]+"setup_overlay") def create_iso(self): @@ -800,10 +880,10 @@ class generic_stage_target(generic_target): print "Resume point detected, skipping create_iso operation..." else: # create the ISO - this is the preferred method (the iso scripts do not always work) - if self.settings.has_key(self.settings["spec_prefix"]+"/iso"): + if self.settings.has_key("iso"): cmd("/bin/bash "+self.settings["controller_file"]+" iso "+\ - self.settings[self.settings["spec_prefix"]+"/iso"],"ISO creation script failed.") - touch(self.settings["autoresume_path"]+"create_iso") + self.settings["iso"],"ISO creation script failed.") + touch(self.settings["autoresume_path"]+"create_iso") def build_packages(self): if self.settings.has_key("AUTORESUME") \ @@ -823,7 +903,6 @@ class generic_stage_target(generic_target): except CatalystError: self.unbind() raise CatalystError,self.settings["spec_prefix"] + "build aborting due to error." - touch(self.settings["autoresume_path"]+"build_packages") def build_kernel(self): if self.settings.has_key("AUTORESUME") \ @@ -902,10 +981,25 @@ class generic_stage_target(generic_target): print "Resume point detected, skipping bootloader operation..." else: try: - cmd("/bin/bash "+self.settings["controller_file"]+" bootloader",\ + cmd("/bin/bash "+self.settings["controller_file"]+" bootloader " + self.settings["target_iso_path"],\ "Bootloader runscript failed.") touch(self.settings["autoresume_path"]+"bootloader") except CatalystError: self.unbind() raise CatalystError,"Runscript aborting due to error." + def livecd_update(self): + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"livecd_update"): + print "Resume point detected, skipping build_packages operation..." + else: + try: + self.bind() + cmd("/bin/bash "+self.settings["controller_file"]+" livecd-update",\ + "livecd-update failed.") + self.unbind() + touch(self.settings["autoresume_path"]+"livecd_update") + + except CatalystError: + self.unbind() + raise CatalystError,"build aborting due to livecd_update error." diff --git a/modules/grp_target.py b/modules/grp_target.py index 4ec36ee4..7b08b696 100644 --- a/modules/grp_target.py +++ b/modules/grp_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/grp_target.py,v 1.9 2005/04/18 14:11:23 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/grp_target.py,v 1.10 2005/04/21 14:23:11 rocket Exp $ """ The builder class for GRP (Gentoo Reference Platform) builds. @@ -32,9 +32,6 @@ class grp_target(generic_stage_target): generic_stage_target.__init__(self,spec,addlargs) - def set_target_path(self): - self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] - def run_local(self): for pkgset in self.settings["grp"]: # example call: "grp.sh run pkgset cd1 xmms vim sys-apps/gleep" @@ -51,7 +48,7 @@ class grp_target(generic_stage_target): self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\ "config_profile_link","setup_confdir","bind","chroot_setup",\ "setup_environment","run_local","unmerge","unbind",\ - "remove","empty"] + "remove","empty","clear_autoresume"] def set_use(self): diff --git a/modules/livecd_stage1_target.py b/modules/livecd_stage1_target.py index 38e865ee..fee5576e 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.9 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.10 2005/04/21 14:23:11 rocket Exp $ """ Builder class for LiveCD stage1. @@ -19,8 +19,7 @@ class livecd_stage1_target(generic_stage_target): self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\ "config_profile_link","setup_confdir","portage_overlay",\ "bind","chroot_setup","setup_environment","build_packages",\ - "preclean","fsscript","unmerge","unbind",\ - "remove","empty","clean","clear_autoresume"] + "unbind", "clean","clear_autoresume"] def set_spec_prefix(self): self.settings["spec_prefix"]="livecd" diff --git a/modules/livecd_stage2_target.py b/modules/livecd_stage2_target.py index 5a054395..5bbeffb5 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.35 2005/04/20 20:29:03 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.36 2005/04/21 14:23:11 rocket Exp $ """ Builder class for a LiveCD stage2 build. @@ -12,7 +12,7 @@ from generic_stage_target import * class livecd_stage2_target(generic_stage_target): def __init__(self,spec,addlargs): - self.required_values=["boot/kernel","livecd/cdfstype"] + self.required_values=["boot/kernel","livecd/fstype"] self.valid_values=[] @@ -25,13 +25,12 @@ class livecd_stage2_target(generic_stage_target): "gamecd/conf","livecd/users","portage_overlay"]) generic_stage_target.__init__(self,spec,addlargs) - - file_locate(self.settings, ["livecd/cdtar","controller_file"]) - + + if not self.settings.has_key("livecd/type"): + self.settings["livecd/type"] = "generic-livecd" - def set_target_path(self): - self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] - + file_locate(self.settings, ["cdtar","controller_file"]) + def set_source_path(self): self.settings["source_path"]=self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2" if os.path.isfile(self.settings["source_path"]): @@ -61,15 +60,6 @@ class livecd_stage2_target(generic_stage_target): touch(self.settings["autoresume_path"]+"unpack") def run_local(self): - # first clean up any existing target stuff - if os.path.exists(self.settings["target_path"]): - print "cleaning previous livecd-stage2 build" - cmd("rm -rf "+self.settings["target_path"], - "Could not remove existing directory: "+self.settings["target_path"]) - - if not os.path.exists(self.settings["target_path"]): - os.makedirs(self.settings["target_path"]) - # what modules do we want to blacklist? if self.settings.has_key("livecd/modblacklist"): try: @@ -88,7 +78,7 @@ class livecd_stage2_target(generic_stage_target): "bind","chroot_setup","setup_environment","run_local",\ "root_overlay","build_kernel","bootloader","preclean",\ "fsscript","rcupdate","unmerge","unbind","remove",\ - "empty","target_setup",\ + "empty","livecd_update","target_setup",\ "setup_overlay","create_iso","clear_autoresume"] def register(foo): diff --git a/modules/netboot_target.py b/modules/netboot_target.py index a3f2743c..b569c769 100644 --- a/modules/netboot_target.py +++ b/modules/netboot_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/netboot_target.py,v 1.2 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/netboot_target.py,v 1.3 2005/04/21 14:23:11 rocket Exp $ """ Builder class for a netboot build. @@ -52,8 +52,6 @@ class netboot_target(generic_stage_target): if not os.environ.has_key(envvar) and not addlargs.has_key(envvar): self.settings[envvar] = "-Os -pipe" - def set_target_path(self): - self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] # def set_root_path(self): # # ROOT= variable for emerges diff --git a/modules/stage4_target.py b/modules/stage4_target.py index d319e746..e14f2bac 100644 --- a/modules/stage4_target.py +++ b/modules/stage4_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/stage4_target.py,v 1.3 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage4_target.py,v 1.4 2005/04/21 14:23:11 rocket Exp $ """ Builder class for LiveCD stage1. @@ -25,9 +25,10 @@ class stage4_target(generic_stage_target): self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\ "config_profile_link","setup_confdir","portage_overlay",\ "bind","chroot_setup","setup_environment","build_packages",\ - "build_kernel","root_overlay","preclean","rcupdate","fsscript",\ - "unmerge","unbind","remove","empty",\ - "clean","capture","clear_autoresume"] + "build_kernel","bootloader","root_overlay","preclean","rcupdate",\ + "fsscript","unmerge","unbind","remove","empty",\ + "clean","capture","livecd_update","target_setup","create_iso",\ + "clear_autoresume"] def register(foo): foo.update({"stage4":stage4_target}) diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py index ba88faf0..426f9986 100644 --- a/modules/tinderbox_target.py +++ b/modules/tinderbox_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/tinderbox_target.py,v 1.8 2005/04/14 14:59:48 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/tinderbox_target.py,v 1.9 2005/04/21 14:23:11 rocket Exp $ """ builder class for the tinderbox target @@ -27,9 +27,6 @@ class tinderbox_target(generic_stage_target): self.unbind() raise CatalystError,"Tinderbox aborting due to error." - def set_target_path(self): - self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"] - def register(foo): foo.update({"tinderbox":tinderbox_target}) return foo diff --git a/targets/embedded/embedded-chroot.sh b/targets/embedded/embedded-chroot.sh index f2bb5a5b..ff8eb528 100755 --- a/targets/embedded/embedded-chroot.sh +++ b/targets/embedded/embedded-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/embedded/embedded-chroot.sh,v 1.14 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/embedded/embedded-chroot.sh,v 1.15 2005/04/21 14:23:11 rocket Exp $ . /tmp/chroot-functions.sh @@ -16,9 +16,19 @@ setup_myemergeopts # setup the environment export FEATURES="${clst_myfeatures}" export CONFIG_PROTECT="-*" -export clst_myemergeopts="${clst_myemergeopts} -O" +#export clst_myemergeopts="${clst_myemergeopts} -O" export USE="${clst_embedded_use}" - +export DESTROOT=${clst_root_path} +export clst_root_path=/ ## START BUILD -run_emerge "${clst_embedded_packages}" +run_emerge "${clst_myemergeopts}" -o "${clst_embedded_packages}" + +#export clst_myemergeopts="${clst_myemergeopts} -B" +#run_emerge "${clst_embedded_packages}" + +export clst_root_path=${DESTROOT} +export clst_myemergeopts="${clst_myemergeopts} -1 -O" +INSTALL_MASK="${clst_install_mask}" run_emerge "${clst_embedded_packages}" + + diff --git a/targets/embedded/embedded-controller.sh b/targets/embedded/embedded-controller.sh index fc4a2dd1..0008390b 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.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/embedded/embedded-controller.sh,v 1.2 2005/04/21 14:23:11 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -18,16 +18,16 @@ case $1 in preclean) ;; - package) - export root_fs_path="${clst_chroot_path}/tmp/mergeroot" - install -d ${clst_image_path} +# package) +# export root_fs_path="${clst_chroot_path}/tmp/mergeroot" +# install -d ${clst_image_path} - ${clst_sharedir}/targets/embedded/embedded-fs-runscript.sh ${clst_embedded_fs_type} || exit 1 - imagesize=`du -sk ${clst_image_path}/root.img | cut -f1` - echo "Created ${clst_embedded_fs_type} image at ${clst_image_path}/root.img" - echo "Image size: ${imagesize}k" +# ${clst_sharedir}/targets/embedded/embedded-fs-runscript.sh ${clst_embedded_fs_type} || exit 1 +# imagesize=`du -sk ${clst_image_path}/root.img | cut -f1` +# echo "Created ${clst_embedded_fs_type} image at ${clst_image_path}/root.img" +# echo "Image size: ${imagesize}k" - ;; +# ;; kernel) shift @@ -35,10 +35,33 @@ case $1 in exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh - extract_kernels ${clst_target_path}/kernels ;; + + target_image_setup) + shift + ${clst_sharedir}/targets/support/target_image_setup.sh $1 + + ;; + livecd-update) + # now, finalize and tweak the livecd fs (inside of the chroot) + exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh + ;; + + bootloader) + shift + # Here is where we poke in our identifier + touch $1/livecd + + ${clst_sharedir}/targets/support/bootloader-setup.sh $1 + ;; + iso) + shift + ${clst_sharedir}/targets/support/create-iso.sh $1 + ;; + + clean) ;; diff --git a/targets/livecd-stage1/livecd-stage1-controller.sh b/targets/livecd-stage1/livecd-stage1-controller.sh index 889726e8..4060da14 100755 --- a/targets/livecd-stage1/livecd-stage1-controller.sh +++ b/targets/livecd-stage1/livecd-stage1-controller.sh @@ -1,24 +1,12 @@ # 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.5 2005/04/20 19:48:29 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-controller.sh,v 1.6 2005/04/21 14:23:11 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh ## START RUNSCRIPT case $1 in - preclean) - echo "Cleared out by wolf31o2... this is a placeholder, BIATCH!!!" - ;; - - rc-update) - exec_in_chroot ${clst_sharedir}/targets/support/rc-update.sh - ;; - - fsscript) - exec_in_chroot ${clst_fsscript} - ;; - build_packages) shift export clst_packages="$*" diff --git a/targets/livecd-stage2/livecd-stage2-cdfs.sh b/targets/livecd-stage2/livecd-stage2-cdfs.sh deleted file mode 100755 index 528b8e50..00000000 --- a/targets/livecd-stage2/livecd-stage2-cdfs.sh +++ /dev/null @@ -1,34 +0,0 @@ -# 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/Attic/livecd-stage2-cdfs.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ -. ${clst_sharedir}/targets/support/functions.sh -. ${clst_sharedir}/targets/support/filesystem-functions.sh -#. ${clst_sharedir}/targets/${clst_target}/${clst_mainarch}-archscript.sh - -#source ${clst_livecd_archscript} -## START RUNSCRIPT - -loopret=1 -case ${clst_livecd_cdfstype} in - normal) - create_normal_loop - loopret=$? - ;; - zisofs) - create_zisofs - loopret=$? - ;; - noloop) - create_noloop - loopret=$? - ;; - gcloop) - create_gcloop - loopret=$? - ;; - squashfs) - create_squashfs - loopret=$? - ;; -esac -exit $loopret diff --git a/targets/livecd-stage2/livecd-stage2-controller.sh b/targets/livecd-stage2/livecd-stage2-controller.sh index fc308989..f4a27857 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.7 2005/04/20 21:31:15 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/livecd-stage2-controller.sh,v 1.8 2005/04/21 14:23:11 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -56,10 +56,12 @@ case $1 in exit 1 fi fi - + ;; + livecd-update) # now, finalize and tweak the livecd fs (inside of the chroot) exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh - + + # move over the xinitrc (if applicable) # this is moved here, so we can override any default xinitrc if [ -n "${clst_livecd_xinitrc}" ] @@ -67,7 +69,6 @@ case $1 in cp -a ${clst_livecd_xinitrc} ${clst_chroot_path}/etc/X11/xinit/xinitrc fi ;; - rc-update) exec_in_chroot ${clst_sharedir}/targets/support/rc-update.sh ;; @@ -80,19 +81,21 @@ case $1 in ;; bootloader) + shift # Here is where we poke in our identifier - touch ${clst_target_path}/livecd + touch $1/livecd - ${clst_sharedir}/targets/livecd-stage2/livecd-stage2-bootloader.sh + ${clst_sharedir}/targets/support/bootloader-setup.sh $1 ;; - cdfs) - ${clst_sharedir}/targets/livecd-stage2/livecd-stage2-cdfs.sh + target_image_setup) + shift + ${clst_sharedir}/targets/support/target_image_setup.sh $1 ;; iso) shift - ${clst_sharedir}/targets/livecd-stage2/livecd-stage2-iso.sh $1 + ${clst_sharedir}/targets/support/create-iso.sh $1 ;; esac exit 0 diff --git a/targets/stage4/stage4-chroot.sh b/targets/stage4/stage4-chroot.sh index 07e81afc..2e920f0e 100755 --- a/targets/stage4/stage4-chroot.sh +++ b/targets/stage4/stage4-chroot.sh @@ -19,4 +19,18 @@ setup_portage #turn off auto-use: export USE_ORDER="env:pkg:conf:defaults" +echo "Bringing system up to date using profile specific use flags" +GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)" +export USE="-* ${clst_HOSTUSE} ${GRP_STAGE23_USE}" +run_emerge -u system + + +echo "Emerging packages using stage4 use flags" +if [ -n "${clst_stage4_use}" ] +then + export USE="-* ${clst_HOSTUSE} ${GRP_STAGE23_USE}" +else + USE="${clst_stage4_use}" +fi + run_emerge "${clst_packages}" diff --git a/targets/stage4/stage4-controller.sh b/targets/stage4/stage4-controller.sh index a0dd0da3..cbee6e6c 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.2 2005/04/11 20:05:40 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage4/stage4-controller.sh,v 1.3 2005/04/21 14:23:11 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -38,6 +38,30 @@ case $1 in exec_in_chroot ${clst_fsscript} ;; + livecd-update) + # now, finalize and tweak the livecd fs (inside of the chroot) + exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh + ;; + + bootloader) + shift + # Here is where we poke in our identifier + touch $1/livecd + + ${clst_sharedir}/targets/support/bootloader-setup.sh $1 + ;; + + target_image_setup) + shift + #${clst_sharedir}/targets/livecd-stage2/livecd-stage2-cdfs.sh + ${clst_sharedir}/targets/support/target_image_setup.sh $1 + ;; + + iso) + + shift + ${clst_sharedir}/targets/support/create-iso.sh $1 + ;; clean) exit 0 diff --git a/targets/livecd-stage2/livecd-stage2-bootloader.sh b/targets/support/bootloader-setup.sh similarity index 83% rename from targets/livecd-stage2/livecd-stage2-bootloader.sh rename to targets/support/bootloader-setup.sh index 4a326ff5..fdc52685 100755 --- a/targets/livecd-stage2/livecd-stage2-bootloader.sh +++ b/targets/support/bootloader-setup.sh @@ -1,14 +1,13 @@ # 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/Attic/livecd-stage2-bootloader.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.1 2005/04/21 14:23:12 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh -#. ${clst_sharedir}/targets/${clst_target}/${clst_mainarch}-archscript.sh -#source ${clst_livecd_archscript} -## START RUNSCRIPT -extract_cdtar -extract_kernels ${clst_target_path}/boot +# $1 is the destination root + +extract_cdtar $1 +extract_kernels $1/boot check_dev_manager check_filesystem_type @@ -16,7 +15,7 @@ default_append_line="initrd=${x}.igz root=/dev/ram0 init=/linuxrc acpi=off ${cmd case ${clst_mainarch} in alpha) - acfg=${clst_target_path}/etc/aboot.conf + acfg=$1/etc/aboot.conf bctr=0 for x in ${clst_boot_kernel} do @@ -30,9 +29,9 @@ case ${clst_mainarch} in arm) ;; hppa) - icfg=${clst_target_path}/boot/palo.conf - kmsg=${clst_target_path}/boot/kernels.msg - hmsg=${clst_target_path}/boot/help.msg + icfg=$1/boot/palo.conf + kmsg=$1/boot/kernels.msg + hmsg=$1/boot/help.msg echo "--commandline=0/${first} initrd=${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg} echo "--bootloader=boot/iplboot" >> ${icfg} echo "--ramdisk=boot/${x}.igz" >> ${icfg} @@ -70,7 +69,7 @@ case ${clst_mainarch} in # but the following suffices for now: ;; sparc*) - scfg=${clst_target_path}/boot/silo.conf + scfg=$1/boot/silo.conf echo "default=\"help\"" > ${scfg} echo "message=\"/boot/boot.msg\"" >> ${scfg} @@ -91,12 +90,12 @@ case ${clst_mainarch} in echo -e "label=\"help\"" >> ${scfg} ;; x86) - if [ -e ${clst_target_path}/boot/isolinux.bin ] + if [ -e $1/boot/isolinux.bin ] then # the rest of this function sets up the config file for isolinux - icfg=${clst_target_path}/boot/isolinux.cfg - kmsg=${clst_target_path}/boot/kernels.msg - hmsg=${clst_target_path}/boot/help.msg + icfg=$1/boot/isolinux.cfg + kmsg=$1/boot/kernels.msg + hmsg=$1/boot/help.msg echo "default ${first}" > ${icfg} echo "timeout 150" >> ${icfg} echo "prompt 1" >> ${icfg} @@ -131,7 +130,7 @@ case ${clst_mainarch} in echo " ${x}-nofb" >> ${kmsg} done - if [ -f ${clst_target_path}/boot/memtest86 ] + if [ -f $1/boot/memtest86 ] then echo >> $icfg echo " memtest86" >> $kmsg @@ -140,10 +139,10 @@ case ${clst_mainarch} in fi fi - if [ -e ${clst_target_path}/boot/grub/stage2_eltorito ] + if [ -e $1/boot/grub/stage2_eltorito ] then - icfg=${clst_target_path}/boot/grub/grub.conf - hmsg=${clst_target_path}/boot/grub/help.msg + icfg=$1/boot/grub/grub.conf + hmsg=$1/boot/grub/help.msg echo "default 1" > ${icfg} echo "timeout 150" >> ${icfg} echo >> ${icfg} @@ -163,7 +162,7 @@ case ${clst_mainarch} in echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg} fi - if [ -e ${clst_target_path}/boot/${x}.igz ] + if [ -e $1/boot/${x}.igz ] then echo "initrd /boot/${x}.igz" >> ${icfg} fi @@ -171,13 +170,13 @@ case ${clst_mainarch} in echo >> ${icfg} echo "title ${x} [ No FrameBuffer ]" >> ${icfg} echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg} - if [ -e ${clst_target_path}/boot/${x}.igz ] + if [ -e $1/boot/${x}.igz ] then echo "initrd /boot/${x}.igz" >> ${icfg} fi done - if [ -f ${clst_target_path}/boot/memtest86 ] + if [ -f $1/boot/memtest86 ] then echo >> ${icfg} echo "title memtest86" >> ${icfg} diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index c41e8b8c..aaa3d916 100755 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -27,18 +27,23 @@ check_portage_version(){ } check_genkernel_version(){ - genkernel_version=$(genkernel --version) - genkernel_version_major=${genkernel_version%%.*} - genkernel_version_minor_sub=${genkernel_version#${genkernel_version_major}.} - genkernel_version_minor=${genkernel_version_minor_sub%%.*} - genkernel_version_sub=${genkernel_version##*.} - if [ -n "${genkernel_version}" -a "${genkernel_version_major}" -eq '3' -a "${genkernel_version_minor}" -ge '2' ] + if [ -x `which genkernel` ] then - echo "Genkernel version ${genkernel_version} found ... continuing" + genkernel_version=$(genkernel --version) + genkernel_version_major=${genkernel_version%%.*} + genkernel_version_minor_sub=${genkernel_version#${genkernel_version_major}.} + genkernel_version_minor=${genkernel_version_minor_sub%%.*} + genkernel_version_sub=${genkernel_version##*.} + if [ -n "${genkernel_version}" -a "${genkernel_version_major}" -eq '3' -a "${genkernel_version_minor}" -ge '2' ] + then + echo "Genkernel version ${genkernel_version} found ... continuing" + else + echo "ERROR: Your genkernel version is too low in your seed stage. genkernel version 3.2.0" + echo "or greater is required." + exit 1 + fi else - echo "ERROR: Your genkernel version is too low in your seed stage. genkernel version 3.2.0" - echo "or greater is required." - exit 1 + exit 1 fi } @@ -126,7 +131,6 @@ make_destpath() { install -d ${ROOT} fi fi - echo "ROOT=${ROOT} emerge ...." } run_emerge() { @@ -137,6 +141,7 @@ run_emerge() { if [ -n "${clst_VERBOSE}" ] then + echo "ROOT=${ROOT} emerge ${clst_myemergeopts} -vpt $@" || exit 1 emerge ${clst_myemergeopts} -vpt $@ || exit 3 echo "Press any key within 15 seconds to pause the build..." read -s -t 15 -n 1 @@ -146,6 +151,7 @@ run_emerge() { read -s -n 1 fi fi + echo "emerge ${clst_myemergeopts} $@" || exit 1 emerge ${clst_myemergeopts} $@ || exit 1 } diff --git a/targets/livecd-stage2/livecd-stage2-iso.sh b/targets/support/create-iso.sh similarity index 59% rename from targets/livecd-stage2/livecd-stage2-iso.sh rename to targets/support/create-iso.sh index 0db179cf..d5c224f9 100755 --- a/targets/livecd-stage2/livecd-stage2-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/livecd-stage2/Attic/livecd-stage2-iso.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/create-iso.sh,v 1.1 2005/04/21 14:23:12 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh #. ${clst_sharedir}/targets/${clst_target}/${clst_mainarch}-archscript.sh @@ -12,12 +12,12 @@ case ${clst_mainarch} in alpha) # this is for the livecd-final target, and calls the proper # command to build the iso file - case ${clst_livecd_cdfstype} in + case ${clst_fstype} in zisofs) - mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + 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 -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" ;; esac isomarkboot ${1} /boot/bootlx @@ -27,19 +27,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_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" 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_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} + 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} ;; 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_path}/boot/isofs.b -B ... ${clst_target_path} \ + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -G ${clst_target_iso_path}/boot/isofs.b -B ... ${clst_target_iso_path} \ || die "Cannot make ISO image" ;; @@ -48,11 +48,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_path}/boot/mkisofs.sparc.fu /tmp + mv ${clst_target_iso_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_path} || die "Cannot make ISO image" + -A 'G entoo Linux Sparc' ${clst_target_iso_path} || die "Cannot make ISO image" rm /tmp/mkisofs.sparc.fu ;; @@ -61,30 +61,39 @@ 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_path}/boot/isolinux.bin ] + if [ -e ${clst_target_iso_path}/boot/isolinux.bin ] then - case ${clst_livecd_cdfstype} in + 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_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table -z ${clst_target_iso_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_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table ${clst_target_iso_path} || die "Cannot make ISO image" ;; esac - fi - - if [ -e ${clst_target_path}/boot/grub/stage2_eltorito ] + elif [ -e ${clst_target_iso_path}/boot/grub/stage2_eltorito ] then - case ${clst_livecd_cdfstype} in + 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_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table -z ${clst_target_iso_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_path} || die "Cannot make ISO image" + -boot-load-size 4 -boot-info-table ${clst_target_iso_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" + ;; + *) + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ + ${clst_target_iso_path} || die "Cannot make ISO image" ;; esac fi diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh index 2236bc11..95ed938d 100755 --- a/targets/support/filesystem-functions.sh +++ b/targets/support/filesystem-functions.sh @@ -1,10 +1,10 @@ # Dont forget to update functions.sh check_looptype - +# $1 is the target directory for the filesystem create_normal_loop() { - export source_path="${clst_chroot_path}" - export destination_path="${clst_target_path}" - export loopname="livecd.loop" + export source_path="${clst_destpath}" + export destination_path="$1" + export loopname="image.loop" #We get genkernel-built kernels and initrds in place, create the loopback fs on #$clst_target_path, mount it, copy our bootable filesystem over, umount it, and @@ -34,30 +34,52 @@ create_normal_loop() { create_zisofs() { - rm -rf "${clst_target_path}/zisofs" > /dev/null 2>&1 + rm -rf "$1/zisofs" > /dev/null 2>&1 echo "Creating zisofs..." - mkzftree -z 9 -p2 "${clst_chroot_path}" "${clst_target_path}/zisofs" || die "Could not run mkzftree, did you emerge zisofs" + mkzftree -z 9 -p2 "${clst_destpath}" "$1/zisofs" || die "Could not run mkzftree, did you emerge zisofs" } create_noloop() { echo "Copying files for image (no loop)..." - cp -a "${clst_chroot_path}"/* "${clst_target_path}" || die "Could not copy files to image (no loop)" + cp -a "${clst_destpath}"/* "$1" || die "Could not copy files to image (no loop)" } create_gcloop() { echo "Creating gcloop..." + export loopname="image.gloop" create_normal_loop - compress_gcloop_ucl -b 131072 -c 10 "${clst_target_path}/livecd.loop" "${clst_target_path}/livecd.gcloop" || die "compress_gcloop_ucl failed, did you emerge gcloop?" - rm -f "${clst_target_path}/livecd.loop" + compress_gcloop_ucl -b 131072 -c 10 "$1/livecd.loop" "$1/livecd.gcloop" || die "compress_gcloop_ucl failed, did you emerge gcloop?" + rm -f "$1/livecd.loop" # only a gcloop image should exist in target path } create_squashfs() { echo "Creating squashfs..." - mksquashfs "${clst_chroot_path}" "${clst_target_path}/livecd.squashfs" -noappend || die "mksquashfs failed, did you emerge squashfs-tools?" + export loopname="image.squashfs" + mksquashfs "${clst_destpath}" "$1/${loopname}" ${clst_fs_ops} -noappend || die "mksquashfs failed, did you emerge squashfs-tools?" } +create_jffs() { + echo "Creating jffs..." + export loopname="image.jffs" + #fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd + mkfs.jffs -d ${clst_destpath} -o $1/${loopname} ${clst_fs_ops} || die "Could not create a jffs filesystem" +} + +create_jffs2(){ + echo "Creating jffs2..." + export loopname="image.jffs" + #fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd + mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname} ${clst_fs_ops} || die "Could not create a jffs2 filesystem" +} + +create_cramfs(){ + echo "Creating cramfs..." + export loopname="image.cramfs" + #fs_check /sbin/mkcramfs cramfs sys-fs/cramfs + mkcramfs ${clst_fs_ops} ${clst_destpath} $1/${loopname} || die "Could not create a cramfs filesystem" +} diff --git a/targets/support/functions.sh b/targets/support/functions.sh index eaeae080..0b18da18 100755 --- a/targets/support/functions.sh +++ b/targets/support/functions.sh @@ -59,9 +59,9 @@ extract_cdtar() { # which will normally contains a pre-built binary # boot-loader/filesystem skeleton for the ISO. - cdtar=${clst_livecd_cdtar} - [ -z "${cdtar}" ] && die "Required key livecd/cdtar not defined, exiting" - tar xjpf ${cdtar} -C ${clst_target_path} || die "Couldn't extract cdtar ${cdtar}" + cdtar=${clst_cdtar} + [ -z "${cdtar}" ] && die "Required key cdtar not defined, exiting" + tar xjpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}" } extract_kernels() { @@ -149,18 +149,18 @@ extract_kernel() { check_dev_manager(){ # figure out what device manager we are using and handle it accordingly - if [ "${clst_livecd_devmanager}" == "udev" ] + if [ "${clst_livecd_devmanager}" == "devfs" ] then - cmdline_opts="${cmdline_opts} udev nodevfs" - else cmdline_opts="${cmdline_opts} noudev devfs" + else + cmdline_opts="${cmdline_opts} udev nodevfs" fi } check_filesystem_type(){ - case ${clst_livecd_cdfstype} in + case ${clst_fstype} in normal) - cmdline_opts="${cmdline_opts} looptype=normal loop=/livecd.loop" + cmdline_opts="${cmdline_opts} looptype=normal loop=/image.loop" ;; zisofs) cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs" @@ -168,10 +168,19 @@ check_filesystem_type(){ noloop) ;; gcloop) - cmdline_opts="${cmdline_opts} looptype=gcloop loop=/livecd.gcloop" + cmdline_opts="${cmdline_opts} looptype=gcloop loop=/image.gcloop" ;; squashfs) - cmdline_opts="${cmdline_opts} looptype=squashfs loop=/livecd.squashfs" - ;; + cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs" + ;; + jffs) + cmdline_opts="${cmdline_opts} looptype=jffs loop=/image.jffs" + ;; + jffs2) + cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2" + ;; + cramfs) + cmdline_opts="${cmdline_opts} looptype=cramfs loop=/image.cramfs" + ;; esac } diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh index 2436ec4a..800aef65 100755 --- a/targets/support/livecdfs-update.sh +++ b/targets/support/livecdfs-update.sh @@ -1,10 +1,10 @@ #!/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/support/livecdfs-update.sh,v 1.10 2005/04/20 21:31:15 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/livecdfs-update.sh,v 1.11 2005/04/21 14:23:12 rocket Exp $ -/usr/sbin/env-update -source /etc/profile +. /tmp/chroot-functions.sh +update_env_settings # allow root logins to the livecd by default if [ -e /etc/sshd/sshd_config ] @@ -52,6 +52,11 @@ case ${clst_livecd_type} in echo "gentoo" > /etc/dnsdomainname echo "127.0.0.1 livecd.gentoo livecd localhost" > /etc/hosts ;; + *) + echo "catalyst-livecd" > /etc/hostname + echo "gentoo" > /etc/dnsdomainname + echo "127.0.0.1 catalyst-livecd.gentoo livecd localhost" > /etc/hosts + ;; esac # Add any users @@ -64,7 +69,10 @@ then fi # setup sudoers -sed -i '/NOPASSWD: ALL/ s/^# //' /etc/sudoers +if [ -f /etc/sudoers ] +then + sed -i '/NOPASSWD: ALL/ s/^# //' /etc/sudoers +fi # we want the first user to be used when auto-starting X if [ -n "${clst_livecd_users}" -a -e /etc/startx ] @@ -241,6 +249,7 @@ case ${clst_livecd_type} in rm -rf /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*} mv -f /etc/gconf /usr/livecd mv -f /var/db /usr/livecd + ;; generic-livecd ) # This is my hack to reduce tmpfs usage mkdir -p /usr/livecd diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh new file mode 100755 index 00000000..74a79e9a --- /dev/null +++ b/targets/support/target_image_setup.sh @@ -0,0 +1,44 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +. ${clst_sharedir}/targets/support/functions.sh +. ${clst_sharedir}/targets/support/filesystem-functions.sh + +# Make the directory if it doesnt exist +mkdir -p $1 + +loopret=1 +case ${clst_fstype} in + normal) + create_normal_loop $1 + loopret=$? + ;; + zisofs) + create_zisofs $1 + loopret=$? + ;; + noloop) + create_noloop $1 + loopret=$? + ;; + gcloop) + create_gcloop $1 + loopret=$? + ;; + squashfs) + create_squashfs $1 + loopret=$? + ;; + jffs) + create_jffs $1 + loopret=$? + ;; + jffs2) + create_jffs2 $1 + loopret=$? + ;; + cramfs) + create_cramfs $1 + loopret=$? + ;; +esac +exit $loopret