Initial import of Catalyst 2.0.0
authorEric Edgar <rocket@gentoo.org>
Mon, 4 Apr 2005 17:48:33 +0000 (17:48 +0000)
committerEric Edgar <rocket@gentoo.org>
Mon, 4 Apr 2005 17:48:33 +0000 (17:48 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@573 d1e1f19c-881f-0410-ab34-b69fee027534

71 files changed:
ChangeLog
arch/arm.py
catalyst
livecd/cdtar/grub-memtest86+-cdtar.tar.bz2 [new file with mode: 0644]
livecd/cdtar/isolinux-2.11-cdtar.tar.bz2 [new file with mode: 0644]
livecd/cdtar/isolinux-2.11-memtest86+-cdtar.tar.bz2 [new file with mode: 0644]
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.py [deleted file]
modules/netboot_target.py [new file with mode: 0644]
modules/snapshot_target.py
modules/stage1_target.py
modules/stage4_target.py [new file with mode: 0644]
modules/tinderbox_target.py
targets/embedded/embedded-chroot.sh
targets/embedded/embedded-controller.sh [new file with mode: 0755]
targets/embedded/embedded-preclean-chroot.sh
targets/embedded/embedded.sh [deleted file]
targets/embedded/kmerge.sh [deleted file]
targets/grp/grp-chroot.sh
targets/grp/grp-controller.sh [new file with mode: 0755]
targets/grp/grp-preclean-chroot.sh
targets/grp/grp.sh [deleted file]
targets/livecd-stage1/livecd-stage1-chroot.sh
targets/livecd-stage1/livecd-stage1-controller.sh [new file with mode: 0755]
targets/livecd-stage1/livecd-stage1-preclean-chroot.sh
targets/livecd-stage1/livecd-stage1.sh [deleted file]
targets/livecd-stage2/livecd-stage2-bootloader.sh [new file with mode: 0755]
targets/livecd-stage2/livecd-stage2-cdfs.sh [new file with mode: 0755]
targets/livecd-stage2/livecd-stage2-controller.sh [new file with mode: 0755]
targets/livecd-stage2/livecd-stage2-iso.sh [new file with mode: 0755]
targets/livecd-stage2/unmerge.sh
targets/netboot/netboot-busybox.sh [deleted file]
targets/netboot/netboot-combine.sh
targets/netboot/netboot-image.sh
targets/netboot/netboot-kernel.sh [deleted file]
targets/netboot/netboot-packages.sh [deleted file]
targets/netboot/netboot-setup.sh [deleted file]
targets/netboot/netboot.sh [deleted file]
targets/stage1/build.py
targets/stage1/stage1-chroot.sh
targets/stage1/stage1-controller.sh [new file with mode: 0755]
targets/stage1/stage1-preclean-chroot.sh [moved from targets/stage1/stage1-preclean2-chroot.sh with 66% similarity]
targets/stage1/stage1.sh [deleted file]
targets/stage2/stage2-chroot.sh
targets/stage2/stage2-controller.sh [new file with mode: 0755]
targets/stage2/stage2-preclean-chroot.sh
targets/stage2/stage2.sh [deleted file]
targets/stage3/stage3-chroot.sh
targets/stage3/stage3-controller.sh [new file with mode: 0755]
targets/stage3/stage3-preclean-chroot.sh
targets/stage3/stage3.sh [deleted file]
targets/stage4/stage4-chroot.sh [new file with mode: 0755]
targets/stage4/stage4-controller.sh [new file with mode: 0755]
targets/stage4/stage4-preclean-chroot.sh [new file with mode: 0755]
targets/support/chroot-functions.sh [new file with mode: 0755]
targets/support/filesystem-functions.sh [new file with mode: 0755]
targets/support/functions.sh [new file with mode: 0755]
targets/support/gamecdfs-update.sh [new file with mode: 0755]
targets/support/kmerge.sh [new file with mode: 0755]
targets/support/livecdfs-update.sh [new file with mode: 0755]
targets/support/post-kmerge.sh [moved from targets/stage1/stage1-preclean1-chroot.sh with 55% similarity]
targets/support/pre-kmerge.sh [new file with mode: 0755]
targets/tinderbox/tinderbox-chroot.sh
targets/tinderbox/tinderbox-controller.sh [new file with mode: 0755]
targets/tinderbox/tinderbox-preclean-chroot.sh
targets/tinderbox/tinderbox.sh [deleted file]

index 95b3786f60ba7dd8df77b9712adff2c79c24c3c1..373328023a0466c0d8cec3c52b4b66118e2e18c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,65 @@
 # ChangeLog for gentoo/src/catalyst 
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.198 2005/03/30 17:29:13 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.199 2005/04/04 17:48:32 rocket Exp $
+
+  04 Apr 2005; Eric Edgar <rocket@gentoo.org> catalyst, arch/arm.py,
+  +livecd/cdtar/grub-memtest86+-cdtar.tar.bz2,
+  +livecd/cdtar/isolinux-2.11-cdtar.tar.bz2,
+  +livecd/cdtar/isolinux-2.11-memtest86+-cdtar.tar.bz2,
+  -livecd/isogen/alpha-isogen.sh, -livecd/isogen/hppa-isogen.sh,
+  -livecd/isogen/ppc-isogen.sh, -livecd/isogen/sparc-isogen.sh,
+  -livecd/isogen/sparc64-isogen.sh, -livecd/isogen/x86-isogen.sh,
+  -livecd/runscript/alpha-archscript.sh,
+  -livecd/runscript/default-runscript.sh,
+  -livecd/runscript/hppa-archscript.sh, -livecd/runscript/ppc-archscript.sh,
+  -livecd/runscript/sparc-archscript.sh, -livecd/runscript/x86-archscript.sh,
+  -livecd/runscript-support/gamecdfs-update.sh,
+  -livecd/runscript-support/kmerge.sh,
+  -livecd/runscript-support/livecdfs-update.sh,
+  -livecd/runscript-support/post-kmerge.sh,
+  -livecd/runscript-support/pre-kmerge.sh, 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.py,
+  +modules/netboot_target.py, modules/snapshot_target.py,
+  modules/stage1_target.py, +modules/stage4_target.py,
+  modules/tinderbox_target.py, targets/embedded/embedded-chroot.sh,
+  +targets/embedded/embedded-controller.sh,
+  targets/embedded/embedded-preclean-chroot.sh, -targets/embedded/embedded.sh,
+  -targets/embedded/kmerge.sh, targets/grp/grp-chroot.sh,
+  +targets/grp/grp-controller.sh, targets/grp/grp-preclean-chroot.sh,
+  -targets/grp/grp.sh, targets/livecd-stage1/livecd-stage1-chroot.sh,
+  +targets/livecd-stage1/livecd-stage1-controller.sh,
+  targets/livecd-stage1/livecd-stage1-preclean-chroot.sh,
+  -targets/livecd-stage1/livecd-stage1.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/livecd-stage2/unmerge.sh, -targets/netboot/netboot-busybox.sh,
+  targets/netboot/netboot-combine.sh, targets/netboot/netboot-image.sh,
+  -targets/netboot/netboot-kernel.sh, -targets/netboot/netboot-packages.sh,
+  -targets/netboot/netboot-setup.sh, -targets/netboot/netboot.sh,
+  targets/stage1/build.py, targets/stage1/stage1-chroot.sh,
+  +targets/stage1/stage1-controller.sh,
+  +targets/stage1/stage1-preclean-chroot.sh,
+  -targets/stage1/stage1-preclean1-chroot.sh,
+  -targets/stage1/stage1-preclean2-chroot.sh, -targets/stage1/stage1.sh,
+  targets/stage2/stage2-chroot.sh, +targets/stage2/stage2-controller.sh,
+  targets/stage2/stage2-preclean-chroot.sh, -targets/stage2/stage2.sh,
+  targets/stage3/stage3-chroot.sh, +targets/stage3/stage3-controller.sh,
+  targets/stage3/stage3-preclean-chroot.sh, -targets/stage3/stage3.sh,
+  +targets/stage4/stage4-chroot.sh, +targets/stage4/stage4-controller.sh,
+  +targets/stage4/stage4-preclean-chroot.sh,
+  +targets/support/chroot-functions.sh,
+  +targets/support/filesystem-functions.sh, +targets/support/functions.sh,
+  +targets/support/gamecdfs-update.sh, +targets/support/kmerge.sh,
+  +targets/support/livecdfs-update.sh, +targets/support/post-kmerge.sh,
+  +targets/support/pre-kmerge.sh, targets/tinderbox/tinderbox-chroot.sh,
+  +targets/tinderbox/tinderbox-controller.sh,
+  targets/tinderbox/tinderbox-preclean-chroot.sh,
+  -targets/tinderbox/tinderbox.sh:
+  Initial Import of Catalyst 2.0.0
 
   30 Mar 2005; Chris Gianelloni <wolf31o2@gentoo.org>
   livecd/runscript-support/livecdfs-update.sh:
index 76b5fda2c1896fe08729a93c6b0fb42a5fa282bf..a09a2065931132a33f0feb731016e4bcc5bb065c 100644 (file)
@@ -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/arch/arm.py,v 1.4 2005/03/24 15:37:55 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/arch/arm.py,v 1.5 2005/04/04 17:48:32 rocket Exp $
 
 import builder,os
 from catalyst_support import *
@@ -13,7 +13,7 @@ class generic_arm(builder.generic):
                self.settings["CHROOT"]="chroot"
                self.settings["CFLAGS"]="-O2 -pipe"
                self.settings["CXXFLAGS"]="-O1 -pipe"
-
+   
 class generic_armeb(builder.generic):
        "Abstract base class for all arm (big endian) builders"
        def __init__(self,myspec):
@@ -56,4 +56,5 @@ def register(foo):
                "armv4l" : arch_armv4l,
                "armeb"  : arch_armeb,
                "armv5b" : arch_armv5b
+
        })
index 2afed1f56b46006e1b178e11dd11bb8812a6aa3a..ea5609dba87026af4c2694fb9461f71f883a832f 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -1,14 +1,14 @@
 #!/usr/bin/python
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.68 2005/03/24 15:37:54 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.69 2005/04/04 17:48:32 rocket Exp $
 
 # Maintained in full by John Davis <zhen@gentoo.org>
 
 import os,sys,imp,string,getopt
 
 __maintainer__="Chris Gianelloni <wolf31o2@gentoo.org>"
-__version__="1.1.8"
+__version__="2.0.0"
 
 conf_values={}
 
@@ -109,6 +109,10 @@ def parse_config(myconfig):
                print "Autoresuming support enabled."
                conf_values["AUTORESUME"]="1"
 
+       if "purge" in string.split(conf_values["options"]):
+               print "Purge support enabled."
+               conf_values["PURGE"]="1"
+       
        if myconf.has_key("envscript"):
                print "Envscript support enabled."
                conf_values["ENVSCRIPT"]=myconf["envscript"]
@@ -168,6 +172,8 @@ def build_target(addlargs, targetmap):
                        raise CatalystError,"Target \""+addlargs["target"]+"\" not available."
                
                mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
+               if conf_values.has_key("PURGE"):
+                   mytarget.purge()
                mytarget.run()
 
        except CatalystError:
@@ -189,7 +195,7 @@ if __name__ == "__main__":
 
        # parse out the command line arguments
        try:
-               opts,args = getopt.getopt(sys.argv[1:], "hvdc:C:f:FVs:", ["help", "version", "debug",\
+               opts,args = getopt.getopt(sys.argv[1:], "xhvdc:C:f:FVs:", ["purge","help", "version", "debug",\
                        "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
        
        except getopt.GetoptError:
@@ -269,7 +275,9 @@ if __name__ == "__main__":
                        else:
                                mycmdline.append("target=snapshot")
                                mycmdline.append("version_stamp="+a)
-       
+               if o in ("--purge"):
+                               conf_values["PURGE"]="1"
+
        # import configuration file and import our main module using those settings
        parse_config(myconfig)
        sys.path.append(conf_values["sharedir"]+"/modules")
diff --git a/livecd/cdtar/grub-memtest86+-cdtar.tar.bz2 b/livecd/cdtar/grub-memtest86+-cdtar.tar.bz2
new file mode 100644 (file)
index 0000000..2f44963
Binary files /dev/null and b/livecd/cdtar/grub-memtest86+-cdtar.tar.bz2 differ
diff --git a/livecd/cdtar/isolinux-2.11-cdtar.tar.bz2 b/livecd/cdtar/isolinux-2.11-cdtar.tar.bz2
new file mode 100644 (file)
index 0000000..24b3e3c
Binary files /dev/null and b/livecd/cdtar/isolinux-2.11-cdtar.tar.bz2 differ
diff --git a/livecd/cdtar/isolinux-2.11-memtest86+-cdtar.tar.bz2 b/livecd/cdtar/isolinux-2.11-memtest86+-cdtar.tar.bz2
new file mode 100644 (file)
index 0000000..ada41e2
Binary files /dev/null and b/livecd/cdtar/isolinux-2.11-memtest86+-cdtar.tar.bz2 differ
index a5ca529c8c9d38c40ab89533cebb76bc7bb44c70..6c1f77de5add1845b75d2451bdc2653cba05f00d 100644 (file)
@@ -1,16 +1,54 @@
 # 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.34 2005/01/02 04:15:51 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.35 2005/04/04 17:48:32 rocket Exp $
 
-import sys,string,os,types,re,traceback
+import sys,string,os,types,re,traceback,md5
+
+
+# a function to turn a string of non-printable characters into a string of
+# hex characters
+def hexify(str):
+    hexStr = string.hexdigits
+    r = ''
+    for ch in str:
+       i = ord(ch)
+       r = r + hexStr[(i >> 4) & 0xF] + hexStr[i & 0xF]
+    return r
+# hexify()
+
+# A function to calculate the md5 sum of a file
+def calc_md5(file):
+    m = md5.new()
+    f = open(file, 'r')
+    for line in f.readlines():
+       m.update(line)
+    f.close()
+    md5sum = hexify(m.digest())
+    print "MD5 (%s) = %s" % (file, md5sum)
+    return md5sum
+# calc_md5
+    
+def read_from_clst(file):
+       line = ''
+       myline = ''
+       try:
+               myf=open(file,"r")
+       except:
+               raise CatalystError, "Could not open file "+file
+       for line in myf.readlines():
+           line = string.replace(line, "\n", "") # drop newline
+           myline = myline + line
+       myf.close()
+       return myline
+# read_from_clst
 
 # these should never be touched
 required_build_targets=["generic_target","generic_stage_target"]
 
 # new build types should be added here
-valid_build_targets=["stage1_target","stage2_target","stage3_target","grp_target",
+valid_build_targets=["stage1_target","stage2_target","stage3_target","stage4_target","grp_target",
                        "livecd_stage1_target","livecd_stage2_target","embedded_target",
-                       "tinderbox_target","snapshot_target","netboot"]
+                       "tinderbox_target","snapshot_target","netboot_target"]
 
 required_config_file_values=["storedir","sharedir","distdir","portdir"]
 valid_config_file_values=required_config_file_values[:]
@@ -23,6 +61,7 @@ valid_config_file_values.append("AUTORESUME")
 valid_config_file_values.append("options")
 valid_config_file_values.append("DEBUG")
 valid_config_file_values.append("VERBOSE")
+valid_config_file_values.append("PURGE")
 
 verbosity=1
 
index a4d0d45c10ae93ca2ac801ea3dd9f63dcb3cd78c..03d20e48de8bf12d9b7d38f2384f178c14741d58 100644 (file)
@@ -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.8 2005/01/13 00:04:49 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/embedded_target.py,v 1.9 2005/04/04 17:48:32 rocket Exp $
 
 """
 This class works like a 'stage3'.  A stage2 tarball is unpacked, but instead
@@ -22,58 +22,19 @@ class embedded_target(generic_stage_target):
     def __init__(self,spec,addlargs):
         self.required_values=[]
         self.valid_values=[]
-        self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/fs-prepare","embedded/fs-finish","embedded/mergeroot","embedded/packages","embedded/use","embedded/fs-type","boot/kernel"])
+        self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/fs-prepare","embedded/fs-finish","embedded/mergeroot","embedded/packages","embedded/use","embedded/fs-type","embedded/runscript","boot/kernel"])
 
         if addlargs.has_key("embedded/fs-type"):
             self.valid_values.append("embedded/fs-ops")
 
-        # this kernel code is also from livecd stage2
+       self.set_build_kernel_vars(addlargs)
 
-        if addlargs.has_key("boot/kernel"):
-            if type(addlargs["boot/kernel"]) == types.StringType:
-               loopy=[addlargs["boot/kernel"]]
-            else:
-               loopy=addlargs["boot/kernel"]
-               
-                for x in loopy:
-                    self.required_values.append("boot/kernel/"+x+"/sources")
-                    self.required_values.append("boot/kernel/"+x+"/config")
-                    self.valid_values.append("boot/kernel/"+x+"/extraversion")
-                    self.valid_values.append("boot/kernel/"+x+"/packages")
-                    self.valid_values.append("boot/kernel/"+x+"/use")
-                    self.valid_values.append("boot/kernel/"+x+"/gk_kernargs")
-                   self.valid_values.append("boot/kernel/"+x+"/gk_action")
-
-        generic_stage_target.__init__(self,spec,addlargs)
+       generic_stage_target.__init__(self,spec,addlargs)
        self.settings["image_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/image"       
-               
-    # taken from livecd-stage3 code
-    def unmerge(self):
-           print "Unmerging packages"
-            if self.settings.has_key("embedded/unmerge"):
-                   if type(self.settings["embedded/unmerge"])==types.StringType:
-                           self.settings["embedded/unmerge"]=[self.settings["embedded/unmerge"]]
-                   myunmerge=self.settings["embedded/unmerge"][:]
-                    
-                    for x in range(0,len(myunmerge)):
-                        myunmerge[x]="'"+myunmerge[x]+"'"
-                       myunmerge=string.join(myunmerge)
-                    # before cleaning unmerge stuff
-                   cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/unmerge.sh "+myunmerge,"unmerge script failed.")
-                        
-    def clean(self):
-           if self.settings.has_key("embedded/rm"):
-                   if type(self.settings["embedded/rm"])==types.StringType:
-                           self.settings["embedded/rm"]=[self.settings["embedded/rm"]]
-                           print "Removing directories from image"
-                   for x in self.settings["embedded/rm"]:
-                           print "Removing "+x
-                           os.system("rm -rf "+self.settings["chroot_path"]+"/tmp/mergeroot"+x)
-
     def build_fs(self):
         try:
             if self.settings.has_key("embedded/fs-type"):
-                cmd("/bin/bash "+self.settings["sharedir"]+"/targets/embedded/embedded.sh package","filesystem packaging failed")
+                cmd("/bin/bash "+self.settings["controller_file"]+" package","filesystem packaging failed")
         except CatalystError:
                 self.unbind()
                 raise CatalystError, "embedded filesystem creation aborting due to error."
@@ -95,101 +56,28 @@ class embedded_target(generic_stage_target):
                self.unbind()
                raise CatalystError, "embedded post filesystem creation script aborting due to error"
 
-    def build_kernel(self):
-        mynames=self.settings["boot/kernel"]
-        if type(mynames)==types.StringType:
-            mynames=[mynames]
-        args=[]
-        args.append(`len(mynames)`)
-               
-        for kname in mynames:
-            args.append(kname)
-            args.append(self.settings["boot/kernel/"+kname+"/sources"])
-            try:
-                if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
-                    self.unbind()
-                    raise CatalystError, "Can't find kernel config: " \
-                          +self.settings["boot/kernel/"+kname+"/config"]
-
-            except TypeError:
-                raise CatalystError, "Required value boot/kernel/config not specified"
-                       
-            if self.settings.has_key("boot/kernel/"+kname+"/extraversion"):
-                            args.append(self.settings["boot/kernel/"+kname+"/extraversion"])
-            else:
-                args.append("NULL_VALUE")
-           if self.settings.has_key("boot/kernel/"+kname+"/gk_action"):
-                       args.append(self.settings["boot/kernel/"+kname+"/gk_action"])
-                       
-            for extra in ["use","packages","gk_kernargs"]:
-                if self.settings.has_key("boot/kernel/"+kname+"/"+extra):
-                    myex=self.settings["boot/kernel/"+kname+"/"+extra]
-                    if type(myex)==types.ListType:
-                        myex=string.join(myex)
-                    try:
-                        myf=open(self.settings["chroot_path"]+"/var/tmp/"+kname+"."+extra,"w")
-                    except:
-                        self.unbind()
-                        raise CatalystError,"Couldn't create file /var/tmp/"+kname+"."+extra+" in chroot."
-                    if extra=="use":
-                        myf.write("export USE=\""+myex+"\"\n")
-                    if extra=="gk_kernargs":
-                        myf.write("export clst_embedded_gk_kernargs=\""+myex+"\"\n")
-                   else:
-                        myf.write(myex+"\n")
-                    myf.close()
-            try:
-                cmd("cp "+self.settings["boot/kernel/"+kname+"/config"]+" "+ \
-                    self.settings["chroot_path"]+"/var/tmp/"+kname+".config", \
-                    "Couldn't copy kernel config: "+self.settings["boot/kernel/"+kname+"/config"])
-               
-            except CatalystError:
-                self.unbind()
-                
-                # If we need to pass special options to the bootloader
-                # for this kernel put them into the environment.
-            if self.settings.has_key("boot/kernel/"+kname+"/kernelopts"):
-                myopts=self.settings["boot/kernel/"+kname+"/kernelopts"]
-                               
-                if type(myopts) != types.StringType:
-                    myopts = string.join(myopts)
-                os.putenv(kname+"_kernelopts", myopts)
-
-            else:
-                os.putenv(kname+"_kernelopts", "")
-
-                # execute the script that builds the kernel
-            cmd("/bin/bash "+self.settings["sharedir"]+"/targets/embedded/embedded.sh kernel "+list_bashify(args),
-                "Runscript kernel build failed")
-
-    def run_local(self):
-           mypackages=list_bashify(self.settings["embedded/packages"])
-           print "Merging embedded image"
-           try:
-                   cmd("/bin/bash "+self.settings["sharedir"]+"/targets/embedded/embedded.sh run")
-           except CatalystError:
-                   self.unbind()
-                   raise CatalystError, "Embedded build aborted due to error."
-
-            if self.settings.has_key("boot/kernel"):
-               self.build_kernel()
-
-           self.unmerge()
-           self.clean()
-
-           self.pre_build_fs()
-            self.build_fs()
-           self.post_build_fs()
-
     def set_action_sequence(self):
-       self.settings["action_sequence"]=["dir_setup","unpack_and_bind","chroot_setup",\
-                                       "setup_environment","run_local","unbind","capture"]
-       
+       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",\
+                                       "clear_autoresume","remove","empty","clean","pre_build_fs","build_fs","post_build_fs"]
+
     def set_use(self):
         self.settings["use"]=self.settings["embedded/use"]
     def set_stage_path(self):
         self.settings["stage_path"]=self.settings["chroot_path"]+"/tmp/mergeroot"
        print "embedded stage path is "+self.settings["stage_path"]
+
+    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
index e7c7561dee18b8cb8b4496649ae8ba745c62e8e9..fb72812ba0bca7256d877027cd83137c9ff01ade 100644 (file)
@@ -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.24 2005/03/24 15:37:55 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.25 2005/04/04 17:48:32 rocket Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -26,7 +26,7 @@ class generic_stage_target(generic_target):
                # map the mainarch we are running under to the mainarches we support for
                # building stages and LiveCDs. (for example, on amd64, we can build stages for
                # x86 or amd64.
-               targetmap={
+               targetmap={     
                                "x86" : ["x86"],
                                "amd64" : ["x86","amd64"],
                                "sparc64" : ["sparc","sparc64"],
@@ -41,7 +41,7 @@ class generic_stage_target(generic_target):
                                "arm" : ["arm"]
                }
                
-               machinemap={
+               machinemap={    
                                "i386" : "x86",
                                "i486" : "x86",
                                "i586" : "x86",
@@ -63,7 +63,7 @@ class generic_stage_target(generic_target):
                                "armeb" : "arm",
                                "armv5b" : "arm"
                }
-               
+
                mymachine=os.uname()[4]
                if not machinemap.has_key(mymachine):
                        raise CatalystError, "Unknown machine type "+mymachine
@@ -87,6 +87,7 @@ class generic_stage_target(generic_target):
                # call arch constructor, pass our settings
                self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
                
+               print "Using target:",self.settings["target"]
                # self.settings["mainarch"] should now be set by our arch constructor, so we print
                # a nice informational message:
                if self.settings["mainarch"]==self.settings["hostarch"]:
@@ -104,13 +105,22 @@ class generic_stage_target(generic_target):
                # define all of our core variables
                self.set_target_profile()
                self.set_target_subpath()
+       
+               # set paths
                self.set_snapshot_path()
                self.set_target_path()
                self.set_source_path()
                self.set_chroot_path()
+               self.set_root_path()
+               self.set_dest_path()
+               self.set_stage_path()
+               
+               self.set_controller_file()
                self.set_action_sequence()
                self.set_use()
-               self.set_stage_path()
+               self.set_cleanables()
+               self.set_spec_prefix()
+               self.set_iso_volume_id()
 
                # 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)
@@ -145,6 +155,9 @@ class generic_stage_target(generic_target):
                        # for the chroot:
                        os.environ["CCACHE_DIR"]="/var/tmp/ccache"      
                
+       def set_spec_prefix(self):
+               self.settings["spec_prefix"]=self.settings["target"]
+
        def set_target_profile(self):
                self.settings["target_profile"]=self.settings["profile"]
        
@@ -157,26 +170,54 @@ class generic_stage_target(generic_target):
        
        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"]):
+                       if os.path.exists(self.settings["source_path"]):
+                                self.settings["source_path_md5sum"]=calc_md5(self.settings["source_path"])
        
+       def set_dest_path(self):
+               self.settings["destpath"]=self.settings["chroot_path"]
+
+       def set_cleanables(self):
+               self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/tmp/*","/root/*",\
+                                               "/usr/portage"]
+
        def set_snapshot_path(self):
                self.settings["snapshot_path"]=self.settings["storedir"]+"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2"
+               if os.path.exists(self.settings["snapshot_path"]):
+                   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"]
-
+       
+       def set_controller_file(self):
+               self.settings["controller_file"]=self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/"+self.settings["target"]+"-controller.sh"
+       def set_iso_volume_id(self):
+                if self.settings.has_key(self.settings["spec_prefix"]+"/volid"):
+                   self.settings["iso_volume_id"] = string.join(self.settings[self.settings["spec_prefix"]+"/volid"])
+                   if len(self.settings["iso_volume_id"])>32:
+                       raise CatalystError,"ISO VOLUME ID: volid must not exceed 32 characters."
+               else:
+                   self.settings["iso_volume_id"] = "catalyst " + self.settings["snapshot"] 
+                                                                                                                       
        def set_action_sequence(self):
                #Default action sequence for run method
-               self.settings["action_sequence"]=["dir_setup","unpack_and_bind","chroot_setup",\
-                               "setup_environment","run_local","preclean","unbind","clean","capture"]
+               self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
+                               "config_profile_link","setup_confdir","bind","chroot_setup",\
+                               "setup_environment","run_local","preclean","unbind","clear_autoresume","clean","capture"]
        
        def set_use(self):
                pass
 
        def set_stage_path(self):
                        self.settings["stage_path"]=self.settings["chroot_path"]
+       
        def set_mounts(self):
                pass
-       
+
+       def set_root_path(self):
+               # ROOT= variable for emerges
+               self.settings["root_path"]="/"
+
        def mount_safety_check(self):
                mypath=self.settings["chroot_path"]
                
@@ -208,50 +249,116 @@ class generic_stage_target(generic_target):
                                        raise CatalystError, "Unable to auto-unbind "+x
                
        def dir_setup(self):
-               print "Setting up directories..."
-               self.mount_safety_check()
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_dir_setup"):
+                       print "Resume point detected, skipping dir_setup operation..."
+               else:
+                   print "Setting up directories..."
+                   self.mount_safety_check()
                
-               if os.path.exists(self.settings["chroot_path"]):
-                       cmd("rm -rf "+self.settings["chroot_path"],\
-                               "Could not remove existing directory: "+self.settings["chroot_path"])
+                   if os.path.exists(self.settings["chroot_path"]):
+                           cmd("rm -rf "+self.settings["chroot_path"],\
+                                   "Could not remove existing directory: "+self.settings["chroot_path"])
                        
-               if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
-                       os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
+                   if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
+                           os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
                        
-               if not os.path.exists(self.settings["chroot_path"]):
-                       os.makedirs(self.settings["chroot_path"],0755)
+                   if not os.path.exists(self.settings["chroot_path"]):
+                           os.makedirs(self.settings["chroot_path"],0755)
                
-               if self.settings.has_key("PKGCACHE"):   
-                       if not os.path.exists(self.settings["pkgcache_path"]):
-                               os.makedirs(self.settings["pkgcache_path"],0755)
+                   if self.settings.has_key("PKGCACHE"):       
+                           if not os.path.exists(self.settings["pkgcache_path"]):
+                                   os.makedirs(self.settings["pkgcache_path"],0755)
        
+                   touch(self.settings["chroot_path"]+"/tmp/.clst_dir_setup")
                
-       def unpack_and_bind(self):
-               print "Unpacking stage tarball..."
-               cmd("tar xjpf "+self.settings["source_path"]+" -C "+self.settings["chroot_path"],\
-                       "Error unpacking tarball")
-                               
-               if os.path.exists(self.settings["chroot_path"]+"/usr/portage"):
-                       print "Cleaning up existing portage tree snapshot..."
-                       cmd("rm -rf "+self.settings["chroot_path"]+"/usr/portage",\
-                               "Error removing existing snapshot directory.")
+       def unpack(self):
+                       if os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack"):
+                               clst_unpack_md5sum=read_from_clst(self.settings["chroot_path"]+"/tmp/.clst_unpack")
+                       
+                       if self.settings.has_key("AUTORESUME") \
+                               and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack") \
+                               and self.settings["source_path_md5sum"] != clst_unpack_md5sum:
+                                   print "InValid Resume point detected, cleaning up  ..."
+                                   os.remove(self.settings["chroot_path"]+"/tmp/.clst_dir_setup")      
+                                   os.remove(self.settings["chroot_path"]+"/tmp/.clst_unpack") 
+                                   self.dir_setup()    
+                       if self.settings.has_key("AUTORESUME") \
+                               and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack") \
+                               and self.settings["source_path_md5sum"] == clst_unpack_md5sum:
+                                   print "Valid Resume point detected, skipping unpack  ..."
+                       else:
+                               print "Unpacking ..."
+                               if not os.path.exists(self.settings["chroot_path"]):
+                                   os.makedirs(self.settings["chroot_path"])
+
+                               cmd("tar xjpf "+self.settings["source_path"]+" -C "+self.settings["chroot_path"],\
+                                       "Error unpacking ")
+
+                               if self.settings.has_key("source_path_md5sum"):
+                                   myf=open(self.settings["chroot_path"]+"/tmp/.clst_unpack","w")
+                                   myf.write(self.settings["source_path_md5sum"])
+                                   myf.close()
+       
+       def unpack_snapshot(self):                      
+                       if os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack_portage"):
+                           clst_unpack_portage_md5sum=read_from_clst(self.settings["chroot_path"]+"/tmp/.clst_unpack_portage")
                        
-               print "Unpacking portage tree snapshot..."
-               cmd("tar xjpf "+self.settings["snapshot_path"]+" -C "+\
-                       self.settings["chroot_path"]+"/usr","Error unpacking snapshot")
+                       if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/usr/portage/") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack_portage") \
+                       and self.settings["snapshot_path_md5sum"] == clst_unpack_portage_md5sum:
+                               print "Valid Resume point detected, skipping unpack of portage tree..."
+                       else:
+                               if os.path.exists(self.settings["chroot_path"]+"/usr/portage"):
+                                       print "Cleaning up existing portage tree ..."
+                               cmd("rm -rf "+self.settings["chroot_path"]+"/usr/portage",\
+                                       "Error removing existing snapshot directory.")
                        
-               print "Configuring profile link..."
-               cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile",\
-                       "Error zapping profile link")
-               cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+\
-                       " "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
-               
-               if self.settings.has_key("portage_confdir"):
+                               print "Unpacking portage tree ..."
+                               cmd("tar xjpf "+self.settings["snapshot_path"]+" -C "+\
+                                   self.settings["chroot_path"]+"/usr","Error unpacking snapshot")
+                               
+                               print "Setting snapshot autoresume point"
+                               myf=open(self.settings["chroot_path"]+"/tmp/.clst_unpack_portage","w")
+                               myf.write(self.settings["snapshot_path_md5sum"])
+                               myf.close()
+
+       def config_profile_link(self):
+                       print "Configuring profile link..."
+                       cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile",\
+                                       "Error zapping profile link")
+                       cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+\
+                               " "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
+                                      
+       def setup_confdir(self):        
+               if self.settings.has_key("portage_confdir"):
                        print "Configuring /etc/portage..."
                        cmd("rm -rf "+self.settings["chroot_path"]+"/etc/portage","Error zapping /etc/portage")
                        cmd("cp -R "+self.settings["portage_confdir"]+"/ "+self.settings["chroot_path"]+\
                                "/etc/portage","Error copying /etc/portage")
+       
+       def portage_overlay(self):      
+           # copy over the portage overlays
+           # Always copy over the overlay incase it has changed
+           if self.settings.has_key("portage_overlay"):
+               if type(self.settings["portage_overlay"])==types.StringType:
+                       self.settings[self.settings["portage_overlay"]]=[self.settings["portage_overlay"]]
+               
+               for x in self.settings["portage_overlay"]: 
+                       if os.path.exists(x):
+                               print "Copying overlay dir " +x
+                               cmd("mkdir -p "+self.settings["chroot_path"]+x)
+                               cmd("cp -R "+x+"/* "+self.settings["chroot_path"]+x)
+       def root_overlay(self):
+           # copy over the root_overlay
+           # Always copy over the overlay incase it has changed
+               if self.settings.has_key(self.settings["spec_prefix"]+"/root_overlay"):
+                   print "Copying root overlay ..."
+                   cmd("rsync -a "+self.settings[self.settings["spec_prefix"]+"/root_overlay"]+"/* "+\
+                       self.settings["chroot_path"], self.settings["spec_prefix"]+"/root_overlay copy failed.")
 
+       def bind(self):
                for x in self.mounts: 
                        if not os.path.exists(self.settings["chroot_path"]+x):
                                os.makedirs(self.settings["chroot_path"]+x,0755)
@@ -264,7 +371,7 @@ class generic_stage_target(generic_target):
                        if retval!=0:
                                self.unbind()
                                raise CatalystError,"Couldn't bind mount "+src
-               
+       
        def unbind(self):
                ouch=0
                mypath=self.settings["chroot_path"]
@@ -295,74 +402,110 @@ class generic_stage_target(generic_target):
                        raise CatalystError,"Couldn't umount one or more bind-mounts; aborting for safety."
 
        def chroot_setup(self):
-               print "Setting up chroot..."
-               cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc",\
-                       "Could not copy resolv.conf into place.")
-               
-               # copy over the envscript, if applicable
-               if self.settings.has_key("ENVSCRIPT"):
-                       if not os.path.exists(self.settings["ENVSCRIPT"]):
-                               raise CatalystError, "Can't find envscript "+self.settings["ENVSCRIPT"]
-                       cmd("cp "+self.settings["ENVSCRIPT"]+" "+self.settings["chroot_path"]+"/tmp/envscript",\
-                               "Could not copy envscript into place.")
-
-               # copy over /etc/hosts from the host in case there are any specialties in there
-               if os.path.exists("/etc/hosts"):
-                       cmd("mv "+self.settings["chroot_path"]+"/etc/hosts "+self.settings["chroot_path"]+\
-                               "/etc/hosts.bck", "Could not backup /etc/hosts")
-                       cmd("cp /etc/hosts "+self.settings["chroot_path"]+"/etc/hosts", "Could not copy /etc/hosts")
-               
-               # modify and write out make.conf (for the chroot)
-               cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.conf")
-               myf=open(self.settings["chroot_path"]+"/etc/make.conf","w")
-               myf.write("# These settings were set by the catalyst build script that automatically built this stage\n")
-               myf.write("# Please consult /etc/make.conf.example for a more detailed example\n")
-               myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n')
-               myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
-               # figure out what our USE vars are for building
-               myusevars=[]
-               if self.settings.has_key("HOSTUSE"):
-                       myusevars.extend(self.settings["HOSTUSE"])
-               
-               if self.settings.has_key("use"):
-                       myusevars.extend(self.settings["use"])
-                       myf.write('USE="'+string.join(myusevars)+'"\n')
-               
-               if self.settings.has_key("CXXFLAGS"):
-                       myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
-               
-               else:
-                       myf.write('CXXFLAGS="${CFLAGS}"\n')
-               myf.close()
+                   print "Setting up chroot..."
+                   cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc",\
+                           "Could not copy resolv.conf into place.")
+               
+                   # copy over the envscript, if applicable
+                   if self.settings.has_key("ENVSCRIPT"):
+                           if not os.path.exists(self.settings["ENVSCRIPT"]):
+                                  raise CatalystError, "Can't find envscript "+self.settings["ENVSCRIPT"]
+                           cmd("cp "+self.settings["ENVSCRIPT"]+" "+self.settings["chroot_path"]+"/tmp/envscript",\
+                                   "Could not copy envscript into place.")
+
+                   # copy over /etc/hosts from the host in case there are any specialties in there
+                   if os.path.exists("/etc/hosts"):
+                           cmd("mv "+self.settings["chroot_path"]+"/etc/hosts "+self.settings["chroot_path"]+\
+                                   "/etc/hosts.bck", "Could not backup /etc/hosts")
+                           cmd("cp /etc/hosts "+self.settings["chroot_path"]+"/etc/hosts", "Could not copy /etc/hosts")
+               
+                   # modify and write out make.conf (for the chroot)
+                   cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.conf")
+                   myf=open(self.settings["chroot_path"]+"/etc/make.conf","w")
+                   myf.write("# These settings were set by the catalyst build script that automatically built this stage\n")
+                   myf.write("# Please consult /etc/make.conf.example for a more detailed example\n")
+                   myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n')
+                   myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
+                   # figure out what our USE vars are for building
+                   myusevars=[]
+                   if self.settings.has_key("HOSTUSE"):
+                           myusevars.extend(self.settings["HOSTUSE"])
+               
+                   if self.settings.has_key("use"):
+                           myusevars.extend(self.settings["use"])
+                           myf.write('USE="'+string.join(myusevars)+'"\n')
+               
+                   if self.settings.has_key("CXXFLAGS"):
+                           myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
+                           
+                   if self.settings.has_key("portage_overlay"):
+                               if type(self.settings["portage_overlay"])==types.StringType:
+                                       self.settings[self.settings["portage_overlay"]]=[self.settings["portage_overlay"]]
+                                       
+                               myf.write('PORTDIR_OVERLAY="'+string.join(self.settings["portage_overlay"])+'"\n')
+                   else:
+                           myf.write('CXXFLAGS="${CFLAGS}"\n')
+                   myf.close()
        
        def clean(self):
-               destpath=self.settings["chroot_path"]
-               
-               cleanables=["/etc/resolv.conf","/var/tmp/*","/tmp/*","/root/*","/usr/portage"]
-                       
-               if self.settings["target"]=="stage1":
-                       destpath+="/tmp/stage1root"
-                       # this next stuff can eventually be integrated into the python
-                       # and glibc ebuilds themselves (USE="build"):
-                       cleanables.extend(["/usr/share/gettext","/usr/lib/python2.2/test",\
-                               "/usr/lib/python2.2/encodings","/usr/lib/python2.2/email",\
-                               "/usr/lib/python2.2/lib-tk","/usr/share/zoneinfo"])
-                               
-               for x in cleanables: 
-                       print "Cleaning chroot: "+x+"..."
-                       cmd("rm -rf "+destpath+x,"Couldn't clean "+x)
+               for x in self.settings["cleanables"]: 
+                       print "Cleaning chroot: "+x+"... "
+                       cmd("rm -rf "+self.settings["destpath"]+x,"Couldn't clean "+x)
 
                # put /etc/hosts back into place
-               cmd("mv -f "+self.settings["chroot_path"]+"/etc/hosts.bck "+self.settings["chroot_path"]+\
-                               "/etc/hosts", "Could not replace /etc/hosts")
-               
-               cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
-                       "/"+self.settings["target"]+".sh clean","clean script failed.")
+               if os.path.exists("/etc/hosts.bck"):
+                       cmd("mv -f "+self.settings["chroot_path"]+"/etc/hosts.bck "+self.settings["chroot_path"]+\
+                                       "/etc/hosts", "Could not replace /etc/hosts")
+       
+               if os.path.exists(self.settings["controller_file"]):
+                   cmd("/bin/bash "+self.settings["controller_file"]+" clean","clean script failed.")
+       
+       def empty(self):                
+           if self.settings.has_key(self.settings["spec_prefix"]+"/empty"):
+               if type(self.settings[self.settings["spec_prefix"]+"/empty"])==types.StringType:
+                   self.settings[self.settings["spec_prefix"]+"/empty"]=[self.settings[self.settings["spec_prefix"]+"/empty"]]
+               for x in self.settings[self.settings["spec_prefix"]+"/empty"]:
+                   myemp=self.settings["destpath"]+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,0755)
+                   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+                   os.chmod(myemp,mystat[ST_MODE])
+       
+       def remove(self):
+           if self.settings.has_key(self.settings["spec_prefix"]+"/rm"):
+               if type(self.settings[self.settings["spec_prefix"]+"/rm"])==types.StringType:
+                   self.settings[self.settings["spec_prefix"]+"/rm"]=[self.settings[self.settings["spec_prefix"]+"/rm"]]
+               for x in self.settings[self.settings["spec_prefix"]+"/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:
+               if os.path.exists(self.settings["controller_file"]):
+                       cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
+                   "Clean runscript failed.")
+           except:
+               self.unbind()
+               raise
+
+       def clear_autoresume(self):
+               # clean resume points since they are no longer needed
+               if self.settings.has_key("AUTORESUME"):
+                       print "Removing AutoResume Points: ..."
+                       cmd("rm -f "+self.settings["chroot_path"]+"/tmp/.clst*",\
+                               "Couldn't remove resume points")
        
        def preclean(self):
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
-                               "/"+self.settings["target"]+".sh preclean","preclean script failed.")
+                       if os.path.exists(self.settings["controller_file"]):
+                               cmd("/bin/bash "+self.settings["controller_file"]+" preclean","preclean script failed.")
                
                except:
                        self.unbind()
@@ -378,11 +521,6 @@ class generic_stage_target(generic_target):
                if not os.path.exists(mypath):
                        os.makedirs(mypath)
 
-               # clean resume points since they are no longer needed
-               if self.settings.has_key("AUTORESUME"):
-                       cmd("rm -f "+self.settings["chroot_path"]+"/tmp/.clst*",\
-                               "Couldn't remove resume points")
-                       
                print "Creating stage tarball..."
                
                cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["stage_path"]+\
@@ -390,8 +528,8 @@ class generic_stage_target(generic_target):
 
        def run_local(self):
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+\
-                               "/"+self.settings["target"]+".sh run","build script failed")
+                       if os.path.exists(self.settings["controller_file"]):
+                               cmd("/bin/bash "+self.settings["controller_file"]+" run","run script failed.")
 
                except CatalystError:
                        self.unbind()
@@ -410,15 +548,166 @@ class generic_stage_target(generic_target):
                        elif type(self.settings[x])==types.ListType:
                                os.environ[varname]=string.join(self.settings[x])
        
+       def purge(self):
+               if self.settings.has_key("PKGCACHE"):
+                   print "purging the pkgcache ..."
+
+                   myemp=self.settings["pkgcache_path"]
+                   if not os.path.isdir(myemp):
+                       print myemp,"not a directory or does not exist, skipping 'pkgcache purge' operation."
+                   else:
+                       print "Emptying directory",myemp
+                       # 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,0755)
+                   
        def run(self):
                
                for x in self.settings["action_sequence"]:
                        print "Running action sequence: "+x
-                       if x == 'chroot_setup':
-                               try:
-                                       self.chroot_setup()
-                               except:
-                                       self.unbind()
-                                       raise
-                       else:   
+                       try:
                                apply(getattr(self,x))
+                       except:
+                               self.unbind()
+                               raise
+                       #if x == 'chroot_setup':
+                       #       try:
+                       #               self.chroot_setup()
+                       #       except:
+                       #               self.unbind()
+                       #               raise
+                       #else:  
+                       #       apply(getattr(self,x))
+
+        def unmerge(self):
+           if self.settings.has_key("AUTORESUME") \
+               and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unmerge"):
+                   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)):
+                   #surround args with quotes for passing to bash,
+                   #allows things like "<" to remain intact
+                       myunmerge[x]="'"+myunmerge[x]+"'"
+                   myunmerge=string.join(myunmerge)
+                   
+                   #before cleaning, unmerge stuff:
+                   try:
+                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/" \
+                               +self.settings["target"]+"/unmerge.sh "+myunmerge,"Unmerge script failed.")
+                       print "unmerge shell script"
+                   except CatalystError:
+                       self.unbind()
+                       raise
+               touch(self.settings["chroot_path"]+"/tmp/.clst_unmerge")
+
+       def target_setup(self):
+               cmd("/bin/bash "+self.settings["controller_file"]+" cdfs","CDFS script failed.")
+       
+       def setup_overlay(self):        
+               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.")
+       
+               # clean up the resume points
+               if self.settings.has_key("AUTORESUME"):
+                       cmd("rm -f "+self.settings["chroot_path"]+"/tmp/.clst*",\
+                       "Couldn't remove resume points")
+       
+       def create_iso(self):
+               # 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"):
+                       cmd("/bin/bash "+self.settings["controller_file"]+" iso "+\
+                               self.settings[self.settings["spec_prefix"]+"/iso"],"ISO creation script failed.")
+        def build_packages(self):
+               
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_build_packages"):
+                               print "Resume point detected, skipping build_packages operation..."
+               else:
+                       mypack=list_bashify(self.settings[self.settings["spec_prefix"]+"/packages"])
+                       try:
+                               cmd("/bin/bash "+self.settings["controller_file"]+\
+                                       " build_packages "+mypack)
+                               touch(self.settings["chroot_path"]+"/tmp/.clst_build_packages")
+                       except CatalystError:
+                               self.unbind()
+                               raise CatalystError,self.settings["spec_prefix"] + "build aborting due to error."
+       
+       def build_kernel(self):
+               if self.settings.has_key("boot/kernel"):
+                       try:
+                               mynames=self.settings["boot/kernel"]
+                               if type(mynames)==types.StringType:
+                                       mynames=[mynames]
+               
+                               for kname in mynames:
+                                       try:
+                                               if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
+                                                       self.unbind()
+                                                       raise CatalystError, "Can't find kernel config: " \
+                                                               +self.settings["boot/kernel/"+kname+"/config"]
+                       
+                                       except TypeError:
+                                               raise CatalystError, "Required value boot/kernel/config not specified"
+                       
+                                       try:
+                                               cmd("cp "+self.settings["boot/kernel/"+kname+"/config"]+" "+ \
+                                                       self.settings["chroot_path"]+"/var/tmp/"+kname+".config", \
+                                                       "Couldn't copy kernel config: "+self.settings["boot/kernel/"+kname+"/config"])
+               
+                                       except CatalystError:
+                                               self.unbind()
+
+                                       # If we need to pass special options to the bootloader
+                                       # for this kernel put them into the environment.
+                                       if self.settings.has_key("boot/kernel/"+kname+"/kernelopts"):
+                                               myopts=self.settings["boot/kernel/"+kname+"/kernelopts"]
+                               
+                                               if type(myopts) != types.StringType:
+                                                       myopts = string.join(myopts)
+                                               os.putenv(kname+"_kernelopts", myopts)
+
+                                       else:
+                                               os.putenv(kname+"_kernelopts", "")
+
+                                       if not self.settings.has_key("boot/kernel/"+kname+"/extraversion"):
+                                               self.settings["boot/kernel/"+kname+"/extraversion"]="NULL_VALUE"
+
+                                       os.putenv("clst_kextraversion", self.settings["boot/kernel/"+kname+"/extraversion"])
+
+                                       # execute the script that builds the kernel
+                                       cmd("/bin/bash "+self.settings["controller_file"]+" kernel "+kname,\
+                                       "Runscript kernel build failed")
+
+                       except CatalystError:
+                               self.unbind()
+                               raise CatalystError,"build aborting due to kernel build error."
+
+       def set_build_kernel_vars(self,addlargs):
+               
+           if not addlargs.has_key("boot/kernel"):
+                   raise CatalystError, "Required value boot/kernel not specified."
+                                   
+                   if type(addlargs["boot/kernel"]) == types.StringType:
+                       loopy=[addlargs["boot/kernel"]]
+                   else:
+                       loopy=addlargs["boot/kernel"]
+                           
+                   for x in loopy:
+                       self.required_values.append("boot/kernel/"+x+"/sources")
+                       self.required_values.append("boot/kernel/"+x+"/config")
+                       self.valid_values.append("boot/kernel/"+x+"/extraversion")
+                       self.valid_values.append("boot/kernel/"+x+"/packages")
+                       self.valid_values.append("boot/kernel/"+x+"/use")
+                       self.valid_values.append("boot/kernel/"+x+"/gk_kernargs")
+                       self.valid_values.append("boot/kernel/"+x+"/gk_action")
+                   
index 91be65e3ef66c116b89f4e57735a6da6e8fb4161..0125503846dfefd08b87a804c17daef2e8836c0b 100644 (file)
@@ -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.6 2005/01/04 21:13:43 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/grp_target.py,v 1.7 2005/04/04 17:48:32 rocket Exp $
 
 """
 The builder class for GRP (Gentoo Reference Platform) builds.
@@ -37,8 +37,7 @@ class grp_target(generic_stage_target):
                        # example call: "grp.sh run pkgset cd1 xmms vim sys-apps/gleep"
                        mypackages=list_bashify(self.settings["grp/"+pkgset+"/packages"])
                        try:
-                               cmd("/bin/bash "+self.settings["sharedir"]+\
-                                       "/targets/grp/grp.sh run "+self.settings["grp/"+pkgset+"/type"]\
+                               cmd("/bin/bash "+self.settings["controller_file"]+" run "+self.settings["grp/"+pkgset+"/type"]\
                                        +" "+pkgset+" "+mypackages)
                        
                        except CatalystError:
@@ -46,8 +45,11 @@ class grp_target(generic_stage_target):
                                raise CatalystError,"GRP build aborting due to error."
 
        def set_action_sequence(self):
-           self.settings["action_sequence"]=["dir_setup","unpack_and_bind","chroot_setup",\
-                                           "setup_environment","run_local","unbind"]
+           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"]
+
        
        def set_use(self):
            self.settings["use"]=self.settings["grp/use"]
index 00ba8f59c2562dda7ebecec2d441d277f66b0df1..af7966dec7c32aa1873817519efe7c38b6ec2ddf 100644 (file)
@@ -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.6 2005/01/04 21:13:43 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.7 2005/04/04 17:48:32 rocket Exp $
 
 """
 Builder class for LiveCD stage1.
@@ -15,22 +15,19 @@ class livecd_stage1_target(generic_stage_target):
                self.valid_values=self.required_values[:]
                generic_stage_target.__init__(self,spec,addlargs)
 
-       def run_local(self):
-               mypack=list_bashify(self.settings["livecd/packages"])
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/livecd-stage1/livecd-stage1.sh run "+mypack)
-               
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"LiveCD stage1 build aborting due to error."
        def set_action_sequence(self):
-               self.settings["action_sequence"]=["dir_setup","unpack_and_bind","chroot_setup",\
-                                           "setup_environment","run_local","preclean","unbind","clean"]
+               self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
+                                       "config_profile_link","setup_confdir","portage_overlay",\
+                                       "bind","chroot_setup","setup_environment","build_packages",\
+                                       "preclean","clear_autoresume","unmerge","unbind",\
+                                       "remove","empty","clean"]
+
 
        def set_use(self):
                    self.settings["use"]=self.settings["livecd/use"]
 
+        def set_spec_prefix(self):
+                       self.settings["spec_prefix"]="livecd"
 def register(foo):
        foo.update({"livecd-stage1":livecd_stage1_target})
        return foo
index ec6da48c54a4dc433799a96b448a09dd00e23178..5cf46afe589c719771b02c2b116abd6927ee0646 100644 (file)
@@ -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.30 2005/03/09 00:22:05 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.31 2005/04/04 17:48:33 rocket Exp $
 
 """
 Builder class for a LiveCD stage2 build.
@@ -12,309 +12,61 @@ from generic_stage_target import *
 
 class livecd_stage2_target(generic_stage_target):
        def __init__(self,spec,addlargs):
-               self.required_values=["boot/kernel","livecd/cdfstype",\
-               "livecd/archscript","livecd/runscript"]
+               self.required_values=["boot/kernel","livecd/cdfstype"]
                
                self.valid_values=[]
-               if not addlargs.has_key("boot/kernel"):
-                       raise CatalystError, "Required value boot/kernel not specified."
-                       
-               if type(addlargs["boot/kernel"]) == types.StringType:
-                       loopy=[addlargs["boot/kernel"]]
-                       
-               else:
-                       loopy=addlargs["boot/kernel"]
-                       
-               for x in loopy:
-                       self.required_values.append("boot/kernel/"+x+"/sources")
-                       self.required_values.append("boot/kernel/"+x+"/config")
-                       self.valid_values.append("boot/kernel/"+x+"/extraversion")
-                       self.valid_values.append("boot/kernel/"+x+"/packages")
-                       self.valid_values.append("boot/kernel/"+x+"/use")
-                       self.valid_values.append("boot/kernel/"+x+"/gk_kernargs")
-                       self.valid_values.append("boot/kernel/"+x+"/postconf")
-               
+               self.set_build_kernel_vars(addlargs)
                self.valid_values.extend(self.required_values)
                self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\
                        "livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\
                        "livecd/motd","livecd/overlay","livecd/modblacklist","livecd/splash_theme",\
                        "livecd/rcadd","livecd/rcdel","livecd/fsscript","livecd/xinitrc",\
                        "livecd/root_overlay","livecd/devmanager","livecd/splash_type",\
-                       "gamecd/conf"])
+                       "gamecd/conf","portage_overlay"])
                
                generic_stage_target.__init__(self,spec,addlargs)
-               self.set_cdroot_path()
-               file_locate(self.settings, ["livecd/cdtar","livecd/archscript","livecd/runscript"])
+               file_locate(self.settings, ["livecd/cdtar","controller_file"])
                if self.settings.has_key("portage_confdir"):
                        file_locate(self.settings,["portage_confdir"],expand=0)
 
-               if self.settings.has_key("livecd/volid"):
-                       self.volumeid = string.join(self.settings["livecd/volid"])
-                       if len(self.volumeid)>32:
-                               raise CatalystError,"ISO volume id must not exceed 32 characters."
-                       os.putenv("iso_volume_id",self.volumeid);
-       
-       def unpack_and_bind(self):
-               if not os.path.exists(self.settings["chroot_path"]):
-                       os.makedirs(self.settings["chroot_path"])
-                               
-               print "Copying livecd-stage1 result to new livecd-stage2 work directory..."
-               cmd("rsync -a --delete "+self.settings["source_path"]+"/* "+self.settings["chroot_path"],\
-                       "Error copying initial livecd-stage2")
-       
-               if os.path.exists(self.settings["chroot_path"]+"/usr/portage"):
-                       print "Cleaning up existing portage tree snapshot..."
-                       cmd("rm -rf "+self.settings["chroot_path"]+"/usr/portage",\
-                               "Error removing existing snapshot directory.")
-
-               print "Unpacking portage tree snapshot..."
-               cmd("tar xjpf "+self.settings["snapshot_path"]+" -C "+\
-                       self.settings["chroot_path"]+"/usr","Error unpacking snapshot")
-
-               print "Configuring profile link..."
-               cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile","Error zapping profile link")
-               cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+" "
-                       +self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
-       
-               if self.settings.has_key("portage_confdir"):
-                       print "Configuring /etc/portage..."
-                       cmd("rm -rf "+self.settings["chroot_path"]+"/etc/portage","Error zapping /etc/portage")
-                       cmd("cp -R "+self.settings["portage_confdir"]+"/ "+self.settings["chroot_path"]+\
-                               "/etc/portage","Error copying /etc/portage")
-
-               for x in self.mounts: 
-                       if not os.path.exists(self.settings["chroot_path"]+x):
-                               os.makedirs(self.settings["chroot_path"]+x,0755)
-                       if not os.path.exists(self.mountmap[x]):
-                               os.makedirs(self.mountmap[x],0755)
-                       src=self.mountmap[x]
-                       retval=os.system("mount --bind "+src+" "+self.settings["chroot_path"]+x)
-                       if retval!=0:
-                               self.unbind()
-                               raise CatalystError,"Couldn't bind mount "+src
-        
        def set_target_path(self):
-           pass 
-           #self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]
+           self.settings["target_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]
                
        def set_source_path(self):
            self.settings["source_path"]=self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]
        
-       def set_cdroot_path(self):
-           self.settings["cdroot_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]
-
-        def dir_setup(self):
-                print "Setting up directories..."
-                self.mount_safety_check()
-
-                if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
-                        os.makedirs(self.settings["chroot_path"]+"/tmp")
-
-                if not os.path.exists(self.settings["chroot_path"]):
-                        os.makedirs(self.settings["chroot_path"])
+       def set_spec_prefix(self):
+           self.settings["spec_prefix"]="livecd"
 
-                if self.settings.has_key("PKGCACHE"):
-                        if not os.path.exists(self.settings["pkgcache_path"]):
-                                os.makedirs(self.settings["pkgcache_path"])
-
-       def unmerge(self):
-               if self.settings.has_key("AUTORESUME") \
-                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unmerge"):
-                       print "Resume point detected, skipping unmerge operation..."
                
+       def unpack(self):
+               if self.settings.has_key("AUTORESUME") \
+                       and os.path.exists(self.settings["chroot_path"]+"/tmp/.clst_unpack"):
+                       print "Resume point detected, skipping unpack operation..."
                else:
-                       if self.settings.has_key("livecd/unmerge"):
-                               if type(self.settings["livecd/unmerge"])==types.StringType:
-                                       self.settings["livecd/unmerge"]=[self.settings["livecd/unmerge"]]
-                               myunmerge=self.settings["livecd/unmerge"][:]
-                               
-                               for x in range(0,len(myunmerge)):
-                                       #surround args with quotes for passing to bash, 
-                                       #allows things like "<" to remain intact
-                                       myunmerge[x]="'"+myunmerge[x]+"'"
-                               myunmerge=string.join(myunmerge)
-                               #before cleaning, unmerge stuff:
-                               
-                               try:
-                                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"
-                                               +self.settings["target"]+"/unmerge.sh "+myunmerge,"Unmerge script failed.")
-                               
-                               except CatalystError:
-                                       self.unbind()
-                                       raise
-                               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,0755)
-                               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.")
-               except:
-                       self.unbind()
-                       raise
-
-       def preclean(self):
-               try:
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" preclean",\
-                               "Preclean runscript failed.")
-       
-               except:
-                       self.unbind()
-                       raise
-
-       def cdroot_setup(self):
-               cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","CDFS runscript failed.")
-               
-               if self.settings.has_key("livecd/overlay"):
-                       cmd("rsync -a "+self.settings["livecd/overlay"]+"/* "+\
-                       self.settings["cdroot_path"],"LiveCD overlay copy failed.")
-       
-               # clean up the resume points
-               if self.settings.has_key("AUTORESUME"):
-                       cmd("rm -f "+self.settings["chroot_path"]+"/tmp/.clst*",\
-                       "Couldn't remove resume points")
-       
-               # create the ISO - this is the preferred method (the iso scripts do not always work)
-               if self.settings.has_key("livecd/iso"):
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" iso "+\
-                               self.settings["livecd/iso"],"ISO creation runscript failed.")
-               
-               print "livecd-stage2: complete!"
-
-       def build_kernel(self):
-               mynames=self.settings["boot/kernel"]
-               if type(mynames)==types.StringType:
-                       mynames=[mynames]
-               args=[]
-               args.append(`len(mynames)`)
-               
-               for kname in mynames:
-                       args.append(kname)
-                       args.append(self.settings["boot/kernel/"+kname+"/sources"])
-                       try:
-                               if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
-                                       self.unbind()
-                                       raise CatalystError, "Can't find kernel config: " \
-                                               +self.settings["boot/kernel/"+kname+"/config"]
-                       
-                       except TypeError:
-                               raise CatalystError, "Required value boot/kernel/config not specified"
-                       
-                       """
-                       We must support multiple configs for the same kernel,
-                       so we must manually edit the EXTRAVERSION on the kernel to allow them to coexist.
-                       The extraversion field gets appended to the current EXTRAVERSION
-                       in the kernel Makefile.  Examples of this usage are UP vs SMP kernels,
-                       and on PPC64 we need a seperate pSeries, iSeries, and PPC970 (G5) kernels,
-                       all compiled off the same source, without having to release a seperate 
-                       livecd for each (since other than the kernel, they are all binary compatible)
-                       """
-                       if self.settings.has_key("boot/kernel/"+kname+"/extraversion"):
-                               # extraversion is now an optional parameter, so that don't need to
-                               # worry about it unless they have to
-                               args.append(self.settings["boot/kernel/"+kname+"/extraversion"])
-                       
-                       else:
-                               # this value will be detected on the bash side and indicate
-                               # that EXTRAVERSION processing
-                               # should be skipped
-                               args.append("NULL_VALUE")
-                       
-                       # write out /var/tmp/kname.(use|packages) files, used for kernel USE
-                       # and extra packages settings
-                       for extra in ["use","packages","postconf","gk_kernargs"]:
-                               if self.settings.has_key("boot/kernel/"+kname+"/"+extra):
-                                       myex=self.settings["boot/kernel/"+kname+"/"+extra]
-                                       if type(myex)==types.ListType:
-                                               myex=string.join(myex)
-                                       try:
-                                               myf=open(self.settings["chroot_path"]+"/var/tmp/"+kname+"."+extra,"w")
-                                       except:
-                                               self.unbind()
-                                               raise CatalystError,"Couldn't create file /var/tmp/"+kname+"."+extra+" in chroot."
-                                       # write out to the file 
-                                       if extra=="use":
-                                               myf.write("export USE=\""+myex+"\"\n")
-                                       if extra=="gk_kernargs":
-                                               myf.write("export clst_livecd_gk_kernargs=\""+myex+"\"\n")
-                                       else:
-                                               myf.write(myex+"\n")
-                                       myf.close()
-                       try:
-                               cmd("cp "+self.settings["boot/kernel/"+kname+"/config"]+" "+ \
-                                       self.settings["chroot_path"]+"/var/tmp/"+kname+".config", \
-                                       "Couldn't copy kernel config: "+self.settings["boot/kernel/"+kname+"/config"])
-               
-                       except CatalystError:
-                               self.unbind()
-
-                       # If we need to pass special options to the bootloader
-                       # for this kernel put them into the environment.
-                       if self.settings.has_key("boot/kernel/"+kname+"/kernelopts"):
-                               myopts=self.settings["boot/kernel/"+kname+"/kernelopts"]
+                                                                        
+                       if not os.path.exists(self.settings["chroot_path"]):
+                               os.makedirs(self.settings["chroot_path"])
                                
-                               if type(myopts) != types.StringType:
-                                       myopts = string.join(myopts)
-                               os.putenv(kname+"_kernelopts", myopts)
+                       print "Copying livecd-stage1 result to new livecd-stage2 work directory..."
+                       cmd("rsync -a --delete "+self.settings["source_path"]+"/* "+self.settings["chroot_path"],\
+                               "Error copying initial livecd-stage2")
+                       touch(self.settings["chroot_path"]+"/tmp/.clst_unpack")
 
-                       else:
-                               os.putenv(kname+"_kernelopts", "")
-
-               # execute the script that builds the kernel
-               cmd("/bin/bash "+self.settings["livecd/runscript"]+" kernel "+list_bashify(args),\
-                       "Runscript kernel build failed")
+                       # Create the dir_setup autoresume point as the rsync --delete probably deleted it
+                       touch(self.settings["chroot_path"]+"/tmp/.clst_dir_setup")
 
+        
        def run_local(self):
-               # first clean up any existing cdroot stuff
-               if os.path.exists(self.settings["cdroot_path"]):
+               # 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["cdroot_path"],
-                               "Could not remove existing directory: "+self.settings["cdroot_path"])
+                       cmd("rm -rf "+self.settings["target_path"],
+                               "Could not remove existing directory: "+self.settings["target_path"])
                        
-               if not os.path.exists(self.settings["cdroot_path"]):
-                       os.makedirs(self.settings["cdroot_path"])
+               if not os.path.exists(self.settings["target_path"]):
+                       os.makedirs(self.settings["target_path"])
                                
-               # the runscripts do the real building, so execute them now
-               # this is the part that we want to resume on since it is the most time consuming
-               try:
-                       self.build_kernel()
-                       
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader",\
-                               "Bootloader runscript failed.")
-               
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"Runscript aborting due to error."
-
                # what modules do we want to blacklist?
                if self.settings.has_key("livecd/modblacklist"):
                        try:
@@ -327,14 +79,22 @@ class livecd_stage2_target(generic_stage_target):
                                myf.write("\n"+x)
                        myf.close()
 
-               # copy over the livecd/root_overlay
-               if self.settings.has_key("livecd/root_overlay"):
-                       cmd("rsync -a "+self.settings["livecd/root_overlay"]+"/* "+\
-                               self.settings["chroot_path"], "livecd/root_overlay copy failed.")
+       def bootloader(self):
+               try:
+                       cmd("/bin/bash "+self.settings["controller_file"]+" bootloader",\
+                               "Bootloader runscript failed.")
+               
+               except CatalystError:
+                       self.unbind()
+                       raise CatalystError,"Runscript aborting due to error."
+
        def set_action_sequence(self):
-               self.settings["action_sequence"]=["dir_setup","unpack_and_bind","chroot_setup",\
-                                               "setup_environment","run_local","preclean","unmerge",\
-                                               "unbind","clean","cdroot_setup"]
+           self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
+                           "config_profile_link","setup_confdir","portage_overlay",\
+                           "bind","chroot_setup","setup_environment","run_local",\
+                           "root_overlay","build_kernel","bootloader","clear_autoresume",\
+                           "unmerge","unbind","remove","empty","target_setup",\
+                           "setup_overlay","create_iso"]
 
 def register(foo):
        foo.update({"livecd-stage2":livecd_stage2_target})
diff --git a/modules/netboot.py b/modules/netboot.py
deleted file mode 100644 (file)
index 2471a9e..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/Attic/netboot.py,v 1.9 2005/01/04 21:13:43 wolf31o2 Exp $
-
-"""
-Builder class for a netboot build.
-"""
-
-import os,string,types
-from catalyst_support import *
-from generic_stage_target import *
-
-class netboot_target(generic_stage_target):
-       def __init__(self,spec,addlargs):
-               self.valid_values = [
-                       "netboot/kernel/sources",
-                       "netboot/kernel/config",
-                       "netboot/kernel/prebuilt",
-
-                       "netboot/busybox_config",
-
-                       "netboot/extra_files",
-                       "netboot/packages"
-               ]
-               self.required_values=[]
-                       
-               try:
-                       if addlargs.has_key("netboot/packages"):
-                               if type(addlargs["netboot/packages"]) == types.StringType:
-                                       loopy=[addlargs["netboot/packages"]]
-                               else:
-                                       loopy=addlargs["netboot/packages"]
-                       
-                       for x in loopy:
-                               self.required_values.append("netboot/packages/"+x+"/files")
-               except:
-                       raise CatalystError,"configuration error in netboot/packages."
-               
-               generic_stage_target.__init__(self,spec,addlargs)
-               
-               if addlargs.has_key("netboot/busybox_config"):
-                       file_locate(self.settings, ["netboot/busybox_config"])
-
-               if addlargs.has_key("netboot/kernel/sources"):
-                       file_locate(self.settings, ["netboot/kernel/config"])
-               elif addlargs.has_key("netboot/kernel/prebuilt"):
-                       file_locate(self.settings, ["netboot/kernel/prebuilt"])
-               else:
-                       raise CatalystError,"you must define netboot/kernel/config or netboot/kernel/prebuilt"
-
-               # unless the user wants specific CFLAGS/CXXFLAGS, let's use -Os
-               for envvar in "CFLAGS", "CXXFLAGS":
-                       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 run_local(self):
-               # setup our chroot
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/netboot/netboot.sh setup")
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"couldn't setup netboot env."
-
-               # build packages
-               if self.settings.has_key("netboot/packages"):
-                       mypack=list_bashify(self.settings["netboot/packages"])
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/netboot/netboot.sh packages "+mypack)
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
-
-               # build busybox
-               if self.settings.has_key("netboot/busybox_config"):
-                       mycmd = self.settings["netboot/busybox_config"]
-               else:
-                       mycmd = ""
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/netboot/netboot.sh busybox "+ mycmd)
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
-
-               # build kernel
-               if self.settings.has_key("netboot/kernel/prebuilt"):
-                       mycmd = "kernel-prebuilt " + \
-                               self.settings["netboot/kernel/prebuilt"]
-               else:
-                       mycmd = "kernel-sources " + \
-                               self.settings["netboot/kernel/sources"] + " " + \
-                               self.settings["netboot/kernel/config"]
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                           "/targets/netboot/netboot.sh kernel " + mycmd)
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
-
-               # create image
-               myfiles=[]
-               if self.settings.has_key("netboot/packages"):
-                       if type(self.settings["netboot/packages"]) == types.StringType:
-                               loopy=[self.settings["netboot/packages"]]
-                       else:
-                               loopy=self.settings["netboot/packages"]
-               
-               for x in loopy:
-                       print x, self.settings["netboot/packages/"+x+"/files"]
-                       if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType:
-                               myfiles.extend(self.settings["netboot/packages/"+x+"/files"])
-                       else:
-                               myfiles.append(self.settings["netboot/packages/"+x+"/files"])
-
-               if self.settings.has_key("netboot/extra_files"):
-                       if type(self.settings["netboot/extra_files"]) == types.ListType:
-                               myfiles.extend(self.settings["netboot/extra_files"])
-                       else:
-                               myfiles.append(self.settings["netboot/extra_files"])
-
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/netboot/netboot.sh image " + list_bashify(myfiles))
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
-
-               # finish it all up
-               try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/netboot/netboot.sh finish")
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
-
-               # end
-               print "netboot: build finished !"
-
-
-       def set_action_sequence(self):
-           self.settings["action_sequence"]=["dir_setup","unpack_and_bind","chroot_setup",\
-                                               "setup_environment","run_local","unbind"]
-
-def register(foo):
-       foo.update({"netboot":netboot_target})
-       return foo
diff --git a/modules/netboot_target.py b/modules/netboot_target.py
new file mode 100644 (file)
index 0000000..a48f2f5
--- /dev/null
@@ -0,0 +1,140 @@
+# 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.1 2005/04/04 17:48:33 rocket Exp $
+
+"""
+Builder class for a netboot build.
+"""
+
+import os,string,types
+from catalyst_support import *
+from generic_stage_target import *
+
+class netboot_target(generic_stage_target):
+       def __init__(self,spec,addlargs):
+               self.valid_values = [
+                       "netboot/kernel/sources",
+                       "netboot/kernel/config",
+                       "netboot/kernel/prebuilt",
+
+                       "netboot/busybox_config",
+
+                       "netboot/extra_files",
+                       "netboot/packages"
+               ]
+               self.required_values=[]
+                       
+               try:
+                       if addlargs.has_key("netboot/packages"):
+                               if type(addlargs["netboot/packages"]) == types.StringType:
+                                       loopy=[addlargs["netboot/packages"]]
+                               else:
+                                       loopy=addlargs["netboot/packages"]
+                       
+               #       for x in loopy:
+               #               self.required_values.append("netboot/packages/"+x+"/files")
+               except:
+                       raise CatalystError,"configuration error in netboot/packages."
+               
+               
+               
+               self.set_build_kernel_vars(addlargs)
+
+               generic_stage_target.__init__(self,spec,addlargs)
+               if addlargs.has_key("netboot/busybox_config"):
+                       file_locate(self.settings, ["netboot/busybox_config"])
+
+               # Custom Kernel Tarball --- use that instead ...
+
+               # unless the user wants specific CFLAGS/CXXFLAGS, let's use -Os
+               
+               for envvar in "CFLAGS", "CXXFLAGS":
+                       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
+#              self.settings["root_path"]="/tmp/image"
+
+       def set_dest_path(self):
+               #destpath=self.settings["chroot_path"]+self.settings["root_path"]
+               destpath=self.settings["chroot_path"]+"/tmp/image"
+
+#      def build_packages(self):
+#              # build packages
+#              if self.settings.has_key("netboot/packages"):
+#                      mypack=list_bashify(self.settings["netboot/packages"])
+#              try:
+#                      cmd("/bin/bash "+self.settings["controller_file"]+" packages "+mypack)
+#              except CatalystError:
+#                      self.unbind()
+#                      raise CatalystError,"netboot build aborting due to error."
+       
+       def build_busybox(self):
+               # build busybox
+               if self.settings.has_key("netboot/busybox_config"):
+                       mycmd = self.settings["netboot/busybox_config"]
+               else:
+                       mycmd = ""
+               try:
+                       cmd("/bin/bash "+self.settings["controller_file"]+" busybox "+ mycmd)
+               except CatalystError:
+                       self.unbind()
+                       raise CatalystError,"netboot build aborting due to error."
+       
+
+       def copy_files_to_image(self):
+               # create image
+               myfiles=[]
+               if self.settings.has_key("netboot/packages"):
+                       if type(self.settings["netboot/packages"]) == types.StringType:
+                               loopy=[self.settings["netboot/packages"]]
+                       else:
+                               loopy=self.settings["netboot/packages"]
+               
+               for x in loopy:
+                       if self.settings.has_key("netboot/packages/"+x+"/files"):
+                           if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType:
+                                   myfiles.extend(self.settings["netboot/packages/"+x+"/files"])
+                           else:
+                                   myfiles.append(self.settings["netboot/packages/"+x+"/files"])
+
+               if self.settings.has_key("netboot/extra_files"):
+                       if type(self.settings["netboot/extra_files"]) == types.ListType:
+                               myfiles.extend(self.settings["netboot/extra_files"])
+                       else:
+                               myfiles.append(self.settings["netboot/extra_files"])
+
+               try:
+                       cmd("/bin/bash "+self.settings["controller_file"]+\
+                               " image " + list_bashify(myfiles))
+               except CatalystError:
+                       self.unbind()
+                       raise CatalystError,"netboot build aborting due to error."
+
+
+       def create_netboot_files(self):
+               # finish it all up
+               try:
+                       cmd("/bin/bash "+self.settings["controller_file"]+" finish")
+               except CatalystError:
+                       self.unbind()
+                       raise CatalystError,"netboot build aborting due to error."
+
+               # end
+               print "netboot: build finished !"
+
+
+       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_busybox",\
+                                               "build_kernel","copy_files_to_image","clear_autoresume",\
+                                               "clean","create_netboot_files","unbind"]
+
+def register(foo):
+       foo.update({"netboot":netboot_target})
+       return foo
index 3e926876ac809d23ad216788e2bedaac5e0278d8..37a11393b539fc8ee43a67610bf0a532b851046d 100644 (file)
@@ -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.7 2005/02/28 23:21:09 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.8 2005/04/04 17:48:33 rocket Exp $
 
 """
 Builder class for snapshots.
index 2c0e39c524d0769957a187872c2b83f25c7185ee..93f8278cfb830819b607e9ae961dde32a1d5b7a5 100644 (file)
@@ -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/stage1_target.py,v 1.6 2005/01/04 21:13:43 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage1_target.py,v 1.7 2005/04/04 17:48:33 rocket Exp $
 
 """
 Builder class for a stage1 installation tarball build.
@@ -16,8 +16,17 @@ class stage1_target(generic_stage_target):
                generic_stage_target.__init__(self,spec,addlargs)
        
        def set_stage_path(self):
-               self.settings["stage_path"]=self.settings["chroot_path"]+"/tmp/stage1root"
+               self.settings["stage_path"]=self.settings["chroot_path"]+self.settings["root_path"]
                print "stage1 stage path is "+self.settings["stage_path"]
+       def set_root_path(self):
+              # ROOT= variable for emerges
+               self.settings["root_path"]="/tmp/stage1root"
+               print "stage1 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_cleanables(self):
+               generic_stage_target.set_cleanables(self)
+               self.settings["cleanables"].extend(["/usr/share/gettext","/usr/lib/python2.2/test", "/usr/lib/python2.2/encodings","/usr/lib/python2.2/email", "/usr/lib/python2.2/lib-tk","/usr/share/zoneinfo"])
 
 def register(foo):
        foo.update({"stage1":stage1_target})
diff --git a/modules/stage4_target.py b/modules/stage4_target.py
new file mode 100644 (file)
index 0000000..ec7d562
--- /dev/null
@@ -0,0 +1,32 @@
+# 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.1 2005/04/04 17:48:33 rocket Exp $
+
+"""
+Builder class for LiveCD stage1.
+"""
+
+from catalyst_support import *
+from generic_stage_target import *
+
+class stage4_target(generic_stage_target):
+       def __init__(self,spec,addlargs):
+               self.required_values=["stage4/packages","stage4/use"]
+               self.valid_values=self.required_values[:]
+               self.valid_values.append("stage4/root_overlay")
+               generic_stage_target.__init__(self,spec,addlargs)
+       
+       def set_use(self):
+                   self.settings["use"]=self.settings["stage4/use"]
+
+       def set_action_sequence(self):
+               self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
+                                       "config_profile_link","setup_confdir","portage_overlay",\
+                                       "bind","chroot_setup","setup_environment",\
+                                       "root_overlay","build_packages","preclean","clear_autoresume",\
+                                       "unmerge","unbind","remove","empty","clean","capture"]
+
+
+def register(foo):
+       foo.update({"stage4":stage4_target})
+       return foo
index a0a372dcca139d8af2e97174cae27d6e753921aa..2fb87f8912db85f89f96190be7f010b706b6850b 100644 (file)
@@ -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.6 2005/01/04 21:13:43 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/tinderbox_target.py,v 1.7 2005/04/04 17:48:33 rocket Exp $
 
 """
 builder class for the tinderbox target
@@ -19,9 +19,9 @@ class tinderbox_target(generic_stage_target):
                # tinderbox
                # example call: "grp.sh run xmms vim sys-apps/gleep"
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+\
-                               "/targets/tinderbox/tinderbox.sh run "+\
-                               list_bashify(self.settings["tinderbox/packages"]))
+                       if os.path.exists(self.settings["controller_file"]):
+                           cmd("/bin/bash "+self.settings["controller_file"]+" run "+\
+                               list_bashify(self.settings["tinderbox/packages"]),"run script failed.")
                
                except CatalystError:
                        self.unbind()
index 3e970fe984b1e49c92f4921e80e66586aa9c1804..f2bb5a5b67e7d42f5a950e8305b7baf0714d76a0 100755 (executable)
@@ -1,45 +1,17 @@
 #!/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.13 2005/01/28 18:37:23 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/embedded/embedded-chroot.sh,v 1.14 2005/04/04 17:48:33 rocket Exp $
 
-portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
-       | cut -d/ -f2 | cut -d- -f2,3`
-if [ `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt 51 ]
-then
-       echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
-       echo "2.0.51 or greater is required."
-       exit 1
-fi
+. /tmp/chroot-functions.sh
 
-/usr/sbin/env-update
-source /etc/profile
+check_portage_version
 
-[ -f /tmp/envscript ] && source /tmp/envscript
+update_env_settings
 
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
+setup_myfeatures
+setup_myemergeopts
 
-if [ -n "${clst_DISTCC}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gtk -gnome" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
-
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_myemergeopts="--usepkg --buildpkg --newuse"
-fi
-
-if [ -n "${clst_FETCH}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} -f"
-fi
 
 # setup the environment
 export FEATURES="${clst_myfeatures}"
@@ -47,22 +19,6 @@ export CONFIG_PROTECT="-*"
 export clst_myemergeopts="${clst_myemergeopts} -O"
 export USE="${clst_embedded_use}"
 
-if [ ! -d "/tmp/mergeroot" ]
-then
-       install -d /tmp/mergeroot
-fi
-
 ## START BUILD
-if [ "${clst_VERBOSE}" ]
-then
-       ROOT=/tmp/mergeroot emerge ${clst_myemergeopts} -vp ${clst_embedded_packages} || exit 1
-       echo "Press any key within 15 seconds to pause the build..."
-       read -s -t 15 -n 1
-       if [ $? -eq 0 ]
-       then
-               echo "Press any key to continue..."
-               read -s -n 1
-       fi
-fi
 
-ROOT=/tmp/mergeroot emerge ${clst_myemergeopts} ${clst_embedded_packages} || exit 1
+run_emerge "${clst_embedded_packages}"
diff --git a/targets/embedded/embedded-controller.sh b/targets/embedded/embedded-controller.sh
new file mode 100755 (executable)
index 0000000..fc4a2dd
--- /dev/null
@@ -0,0 +1,49 @@
+#!/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 $
+
+. ${clst_sharedir}/targets/support/functions.sh
+. ${clst_sharedir}/targets/support/filesystem-functions.sh
+case $1 in
+       enter)
+       ;;
+
+       build_packages)
+               shift
+               export clst_packages="$*"
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+       ;;
+
+       preclean)
+       ;;
+
+       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"
+       
+       ;;
+
+       kernel)
+               shift
+               export clst_kname="$1"
+               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
+       
+       ;;
+       
+       clean)
+       ;;
+
+       *)
+       ;;
+
+esac
+exit 0
index 50929b19654aeb9542912b9093210941e52f1441..de04db309e05e2d3c927c7f8897d756eb339d8c2 100755 (executable)
@@ -1,7 +1,8 @@
 #!/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-preclean-chroot.sh,v 1.4 2004/10/15 02:46:58 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/embedded/embedded-preclean-chroot.sh,v 1.5 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+
+. /tmp/chroot-functions.sh
+update_env_settings
diff --git a/targets/embedded/embedded.sh b/targets/embedded/embedded.sh
deleted file mode 100644 (file)
index 7c098c1..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/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/Attic/embedded.sh,v 1.7 2005/01/10 01:16:07 zhen Exp $
-
-case $1 in
-       enter)
-               ${clst_CHROOT} ${clst_chroot_path}
-       ;;
-
-       run)
-               cp ${clst_sharedir}/targets/embedded/embedded-chroot.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/embedded-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/embedded-chroot.sh
-       ;;
-
-       preclean)
-               # currently this doesn't do much
-               cp ${clst_sharedir}/targets/embedded/embedded-preclean-chroot.sh ${clst_chroot_path}
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/embedded-preclean-chroot.sh || exit 1
-               rm -rf ${clst_chroot_path}/tmp/embedded-preclean-chroot.sh
-       ;;
-       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_fs | cut -f1`
-       echo "Created ${clst_embedded_fs_type} image at ${clst_image_path}/root_fs"
-       echo "Image size: ${imagesize}k"
-       ;;
-
-       # almost the same code as livecd-stage2
-       kernel)
-               shift
-               numkernels="$1"
-               cp -a ${clst_sharedir}/livecd/runscript-support/pre-kmerge.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/pre-kmerge.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/pre-kmerge.sh
-               cp -a ${clst_sharedir}/targets/embedded/kmerge.sh ${clst_chroot_path}/tmp
-               count=0
-               while [ ${count} -lt ${numkernels} ]
-               do
-                       sleep 30
-               
-                       shift
-                       export clst_kname="$1"
-                       shift
-                       export clst_ksource="$1"
-                       shift
-                       export clst_kextversion="$1"
-                       shift
-                       export clst_gk_action="$1"
-                       echo "exporting clst_gk_action as:${1}" 
-                       shift
-                       ${clst_CHROOT} ${clst_chroot_path} /tmp/kmerge.sh || exit 1
-                       count=$(( ${count} + 1 ))
-               done
-               rm -f ${clst_chroot_path}/tmp/pre-kmerge.sh
-               cp -a ${clst_sharedir}/livecd/runscript-support/post-kmerge.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/post-kmerge.sh || exit 1
-               ;;
-       *)
-               exit 1
-       ;;
-
-esac
-exit 0
diff --git a/targets/embedded/kmerge.sh b/targets/embedded/kmerge.sh
deleted file mode 100644 (file)
index 7f4ffa2..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/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/targets/embedded/Attic/kmerge.sh,v 1.1 2005/01/10 01:16:07 zhen Exp $
-
-die() {
-       echo "$1"
-       exit 1
-}
-
-# Script to build each kernel, kernel-related packages
-/usr/sbin/env-update
-source /etc/profile
-
-[ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
-export CONFIG_PROTECT="-*"
-rm -f /usr/src/linux
-
-#set the timezone for the kernel build
-rm /etc/localtime
-ln -s /usr/share/zoneinfo/UTC /etc/localtime
-
-[ -e "/var/tmp/${clst_kname}.use" ] && export USE="$( cat /var/tmp/${clst_kname}.use )" || unset USE
-[ -e "/var/tmp/${clst_kname}.gk_kernargs" ] && source /var/tmp/${clst_kname}.gk_kernargs
-# Don't use pkgcache here, as the kernel source may get emerge with different USE variables
-# (and thus different patches enabled/disabled.) Also, there's no real benefit in using the
-# pkgcache for kernel source ebuilds.
-       
-emerge "${clst_ksource}" || exit 1
-[ ! -e /usr/src/linux ] && die "Can't find required directory /usr/src/linux"
-       
-#if catalyst has set NULL_VALUE, extraversion wasn't specified so we skip this part
-if [ "${clst_kextversion}" != "NULL_VALUE" ]
-then
-       sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextversion}:" /usr/src/linux/Makefile
-fi
-       
-if [ -n "${clst_CCACHE}" ]
-then
-       #enable ccache for genkernel
-       export PATH="/usr/lib/ccache/bin:${PATH}"
-fi
-
-# grep out the kernel version so that we can do our modules magic
-VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
-PAT=`grep ^PATCHLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
-SUB=`grep ^SUBLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
-EXV=`grep ^EXTRAVERSION\ \= /usr/src/linux/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g"`
-clst_fudgeuname=${VER}.${PAT}.${SUB}${EXV}
-
-# now we merge any kernel-dependent packages
-if [ -e "/var/tmp/${clst_kname}.packages" ]
-then
-       for x in $( cat /var/tmp/${clst_kname}.packages )
-       do
-               # we don't want to use the pkgcache for these since the results
-               # are kernel-dependent.
-               clst_kernel_merge="${clst_kernel_merge} ${x}"
-       done
-fi
-
-echo "genkernel action is set to: ${clst_gk_action}"
-
-if [ -n "${clst_livecd_bootsplash}" ]
-then
-       genkernel --debuglevel=4 --bootsplash=${clst_livecd_bootsplash} \
-               --callback="emerge ${clst_kernel_merge}" ${clst_livecd_gk_mainargs} \
-               ${clst_embedded_gk_kernargs} --kerneldir=/usr/src/linux \
-               --kernel-config=/var/tmp/${clst_kname}.config \
-               --minkernpackage=/tmp/binaries/${clst_kname}.tar.bz2 \
-               ${clst_gk_action} || exit 1
-else
-       genkernel --debuglevel=4 --callback="emerge ${clst_kernel_merge}" \
-               ${clst_embedded_gk_mainargs} ${clst_embedded_gk_kernargs} \
-               --kerneldir=/usr/src/linux --kernel-config=/var/tmp/${clst_kname}.config \
-               --minkernpackage=/tmp/binaries/${clst_kname}.tar.bz2 \
-               ${clst_gk_action} || exit 1
-fi
-
-/sbin/modules-update --assume-kernel=${clst_fudgeuname}
-               
-#now the unmerge... (wipe db entry)
-emerge -C "${clst_ksource}"
-unset USE
index 4a79a0781adcfd115fe609e01f3a76fac1bac1a9..c9f5d0f8084bf011b5eebaf1b886b5de58e0e38e 100755 (executable)
@@ -1,43 +1,25 @@
 #!/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-chroot.sh,v 1.14 2005/01/28 18:37:23 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/grp-chroot.sh,v 1.15 2005/04/04 17:48:33 rocket Exp $
+
+. /tmp/chroot-functions.sh
 
 # check portage version in seed stage
-portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
-       | cut -d/ -f2 | cut -d- -f2,3`
-if [ `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt 51 ]
-then
-       echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
-       echo "2.0.51 or greater is required."
-       exit 1
-fi
+check_portage_version
 
-/usr/sbin/env-update
-source /etc/profile
+update_env_settings
 
 [ -f /tmp/envscript ] && source /tmp/envscript
 
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-
-if [ -n "${clst_DISTCC}" ]
-then   
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
+setup_myfeatures
 
 # setup the environment
 export FEATURES="${clst_myfeatures}"
 export CONFIG_PROTECT="-*"
 
 ## START BUILD
-USE="build" emerge portage
+setup_portage
 
 #turn off auto-use:
 export USE_ORDER="env:pkg:conf:defaults"
diff --git a/targets/grp/grp-controller.sh b/targets/grp/grp-controller.sh
new file mode 100755 (executable)
index 0000000..1465621
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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 $
+. ${clst_sharedir}/targets/support/functions.sh
+
+case $1 in
+       enter)
+               ${clst_CHROOT} ${clst_chroot_path}
+       ;;
+       run)
+               shift
+               export clst_grp_type=$1
+               shift
+               export clst_grp_target=$1
+               shift
+
+               export clst_grp_packages="$*"
+               exec_in_chroot ${clst_sharedir}/targets/grp/grp-chroot.sh
+       ;;
+
+       preclean)
+               exec_in_chroot ${clst_sharedir}/targets/grp/grp-preclean-chroot.sh
+               exit 0
+       ;;
+
+       clean)
+               exit 0
+       ;;
+       
+       *)
+               exit 1
+       ;;
+
+esac
+exit 0
index 550dd6e46828d57c876a8a3ce388138440e6d29d..f55630df1b09a5ea0d563a2547d2a32e141b4cbf 100755 (executable)
@@ -1,7 +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/grp/grp-preclean-chroot.sh,v 1.6 2005/01/29 14:54:31 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/grp-preclean-chroot.sh,v 1.7 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+
+. /tmp/chroot-functions.sh
+update_env_settings
+
+gconftool-2 --shutdown
diff --git a/targets/grp/grp.sh b/targets/grp/grp.sh
deleted file mode 100755 (executable)
index c25ebd0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/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/Attic/grp.sh,v 1.22 2005/03/05 05:12:58 wolf31o2 Exp $
-
-case $1 in
-       enter)
-               ${clst_CHROOT} ${clst_chroot_path}
-       ;;
-       run)
-               shift
-               export clst_grp_type=$1
-               shift
-               export clst_grp_target=$1
-               shift
-                               
-               cp ${clst_sharedir}/targets/grp/grp-chroot.sh ${clst_chroot_path}/tmp
-               clst_grp_packages="$*" ${clst_CHROOT} ${clst_chroot_path} /tmp/grp-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/grp-chroot.sh
-       ;;
-
-       preclean)
-               if [ `pidof gconfd-2` ]
-               then
-                       gconftool-2 --shutdown
-               fi
-               #cp ${clst_sharedir}/targets/grp/grp-preclean-chroot.sh ${clst_chroot_path}/tmp
-               #${clst_CHROOT} ${clst_chroot_path} /tmp/grp-preclean-chroot.sh || exit 1
-               #rm -f ${clst_chroot_path}/tmp/grp-preclean-chroot.sh
-               exit 0
-       ;;
-
-       clean)
-               exit 0
-       ;;
-       
-       *)
-               exit 1
-       ;;
-
-esac
-exit 0
index 768fce0c995c1cf763c94e88540c8bdcaaab8b4c..fffe66c623ebc9c0246276b17070d58b929d4e51 100755 (executable)
@@ -1,67 +1,25 @@
 #!/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.15 2005/03/07 21:14:42 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-chroot.sh,v 1.16 2005/04/04 17:48:33 rocket Exp $
 
-portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
-       | cut -d/ -f2 | cut -d- -f2,3`
-if [ `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt 51 ]
-then
-       echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
-       echo "2.0.51 or greater is required."
-       exit 1
-fi
+. /tmp/chroot-functions.sh
 
-/usr/sbin/env-update
-source /etc/profile
+check_portage_version
+update_env_settings
 
-[ -f /tmp/envscript ] && source /tmp/envscript
-
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-
-if [ -n "${clst_DISTCC}" ]
-then   
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
-
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_emergeopts="--usepkg --buildpkg --newuse"
-else
-       export clst_emergeopts=""
-fi
-
-if [ -n "${clst_FETCH}" ]
-then
-       export clst_emergeopts="${clst_emergeopts} -f"
-fi
+setup_myfeatures
+setup_myemergeopts
 
 ## setup the environment
+
 export FEATURES="${clst_myfeatures}"
 export CONFIG_PROTECT="-*"
 
 ## START BUILD
-USE="build" emerge portage
+setup_portage
+
 #turn off auto-use:
 export USE_ORDER="env:pkg:conf:defaults"       
 
-if [ "${clst_VERBOSE}" ]
-then
-       emerge ${clst_emergeopts} -vp ${clst_packages}
-       echo "Press any key within 15 seconds to pause the build..."
-       read -s -t 15 -n 1
-       if [ $? -eq 0 ]
-       then
-               echo "Press any key to continue..."
-               read -s -n 1
-       fi
-fi
-
-emerge ${clst_emergeopts} ${clst_packages}
+run_emerge "${clst_packages}"
diff --git a/targets/livecd-stage1/livecd-stage1-controller.sh b/targets/livecd-stage1/livecd-stage1-controller.sh
new file mode 100755 (executable)
index 0000000..c729a51
--- /dev/null
@@ -0,0 +1,75 @@
+# 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.1 2005/04/04 17:48:33 rocket Exp $
+
+. ${clst_sharedir}/targets/support/functions.sh
+
+## START RUNSCRIPT
+
+case $1 in
+       preclean)
+               # move over the motd (if applicable)
+               if [ -n "${clst_livecd_motd}" ]
+               then
+                       cp -a ${clst_livecd_motd} ${clst_chroot_path}/etc/motd
+               else
+                       cp -a ${clst_sharedir}/livecd/files/generic.motd.txt \
+                               ${clst_sharedir}/livecd/files/universal.motd.txt \
+                               ${clst_sharedir}/livecd/files/minimal.motd.txt \
+                               ${clst_sharedir}/livecd/files/environmental.motd.txt \
+                               ${clst_sharedir}/livecd/files/gamecd.motd.txt \
+                               ${clst_chroot_path}/etc
+               fi
+       
+               # move over the xinitrc (if applicable)
+               if [ -n "${clst_livecd_xinitrc}" ]
+               then
+                       cp -a ${clst_livecd_xinitrc} ${clst_chroot_path}/etc/X11/xinit/xinitrc
+               fi
+
+               # move over the environment
+               cp ${clst_sharedir}/livecd/files/livecd-bash_profile \
+                       ${clst_chroot_path}/root/.bash_profile
+               touch ${clst_chroot_path}/root/.bashrc
+               cp ${clst_sharedir}/livecd/files/livecd-local.start \
+                       ${clst_chroot_path}/etc/conf.d/local.start
+               cp ${clst_sharedir}/livecd/files/mkvardb \
+                       ${clst_chroot_path}/tmp
+               mkdir -p /usr/share/faces
+               cp ${clst_sharedir}/livecd/files/gentoo.png \
+                       ${clst_chroot_path}/usr/share/faces
+
+               # touch /etc/startx if our livecd/type requires it
+               if [ "${clst_livecd_type}" = "gentoo-release-environmental" ] \
+               || [ "${clst_livecd_type}" = "gentoo-gamecd" ]
+               then
+                       touch ${clst_chroot_path}/etc/startx
+               fi
+               
+               # now, finalize and tweak the livecd fs (inside of the chroot)
+               exec_in_chroot  ${clst_sharedir}/targets/support/livecdfs-update.sh
+
+               # execute gamecdfs-update.sh if we're a gamecd
+               if [ "${clst_livecd_type}" = "gentoo-gamecd" ]
+               then
+                       exec_in_chroot ${clst_sharedir}/targets/support/gamecdfs-update.sh
+               fi
+               
+               # if the user has their own fs update script, execute it
+               if [ -n "${clst_livecd_fsscript}" ]
+               then
+                       exec_in_chroot ${clst_livecd_fsscript}
+               fi
+               ;;
+               
+       build_packages)
+               shift
+               export clst_packages="$*"
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+               ;;
+
+       clean)
+               find ${clst_chroot_path}/usr/lib -iname "*.pyc" -exec rm -f {} \;
+       ;;
+esac
+exit 0 
index 224fa500bb8bc1b949ab9aaf4e236bc158234e8e..356ddb548de3e8e5bef8e55a7b3b8d911c350eab 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
-# Copyright 1999-2004 Gentoo Foundation
+# Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-preclean-chroot.sh,v 1.6 2005/01/29 14:54:31 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-preclean-chroot.sh,v 1.7 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
+update_env_settings
diff --git a/targets/livecd-stage1/livecd-stage1.sh b/targets/livecd-stage1/livecd-stage1.sh
deleted file mode 100755 (executable)
index fb98751..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/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/Attic/livecd-stage1.sh,v 1.22 2005/03/24 14:17:29 wolf31o2 Exp $
-
-case $1 in
-       enter)
-               ${clst_CHROOT} ${clst_chroot_path}
-       ;;
-       run)
-               shift
-
-               cp ${clst_sharedir}/targets/livecd-stage1/livecd-stage1-chroot.sh ${clst_chroot_path}/tmp
-               clst_packages="$*" ${clst_CHROOT} ${clst_chroot_path} /tmp/livecd-stage1-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/livecd-stage1-chroot.sh
-       ;;
-
-       preclean)
-               GCONFD_RUNNING="`pidof gconfd-2`"
-               if [ -n "${GCONFD_RUNNING}" ]
-               then
-                       kill -9 ${GCONFD_RUNNING}
-                       #gconftool-2 --shutdown
-               fi
-               #cp ${clst_sharedir}/targets/livecd-stage1/livecd-stage1-preclean-chroot.sh ${clst_chroot_path}/tmp
-               #${clst_CHROOT} ${clst_chroot_path} /tmp/livecd-stage1-preclean-chroot.sh || exit 1
-               #rm -f ${clst_chroot_path}/tmp/livecd-stage1-preclean-chroot.sh
-               exit 0
-       ;;
-
-       clean)
-               exit 0
-       ;;
-
-       *)
-               exit 1
-       ;;
-
-esac
-exit 0
diff --git a/targets/livecd-stage2/livecd-stage2-bootloader.sh b/targets/livecd-stage2/livecd-stage2-bootloader.sh
new file mode 100755 (executable)
index 0000000..4a326ff
--- /dev/null
@@ -0,0 +1,189 @@
+# 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 $
+. ${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
+check_dev_manager
+check_filesystem_type
+
+default_append_line="initrd=${x}.igz root=/dev/ram0 init=/linuxrc acpi=off ${cmdline_opts} ${custom_kopts} cdroot"
+
+case ${clst_mainarch} in
+       alpha)
+               acfg=${clst_target_path}/etc/aboot.conf
+               bctr=0
+               for x in ${clst_boot_kernel}
+               do
+                       echo -n "${bctr}:/boot/${x} " >> ${acfg}
+                       echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
+                       echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
+                       ((bctr=${bctr}+1))
+               done
+               ;;
+
+       arm)
+               ;;
+       hppa)
+               icfg=${clst_target_path}/boot/palo.conf
+               kmsg=${clst_target_path}/boot/kernels.msg
+               hmsg=${clst_target_path}/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}
+
+#              for x in $clst_boot_kernel
+#              do
+#
+#                      eval custom_kopts=\$${x}_kernelopts
+#                      echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
+#                      echo >> $icfg
+#                      echo "label $x" >> $icfg
+#                      echo "  kernel $x" >> $icfg
+#                      echo "  append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot vga=0x317 splash=silent" >> $icfg
+#                      echo >> $icfg
+#                      echo "   $x" >> $kmsg
+#                      echo "label $x-nofb" >> $icfg
+#                      echo "  kernel $x" >> $icfg
+#                      echo "  append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot" >> $icfg
+#                      echo >> $icfg
+#                      echo "   ${x}-nofb" >> $kmsg
+#              done
+               ;;
+       ppc)
+               # PPC requirements: 
+               # -----------------
+               # The specs indicate the kernels to be build. We need to put
+               # those kernels and the corresponding initrd.img.gz(s) in the
+               # /boot directory. This directory contains a message boot.msg 
+               # containing some info to be displayed on boot, a configuration
+               # (yaboot.conf) specifying the boot options (kernel/initrd 
+               # combinations). The boot directory also contains a file called
+               # yaboot, which normally gets copied from the live environment.
+               # For now we supply a prebuilt file, prebuilt configuration 
+               # and prebuilt boot message. This can be enhanced later on
+               # but the following suffices for now:
+               ;;
+       sparc*)
+               scfg=${clst_target_path}/boot/silo.conf
+               echo "default=\"help\"" > ${scfg}
+               echo "message=\"/boot/boot.msg\"" >> ${scfg}
+
+               for x in ${clst_boot_kernel}
+               do
+                       echo >> ${icfg}
+                       echo "image=\"/boot/${x}\"" >> ${scfg}
+                       echo -e "\tlabel=\"${x}\"" >> ${scfg}
+                       echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
+
+               done
+
+               echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
+               echo -e "label=\"config\"" >> ${scfg}
+               echo "image=\"cat /boot/video.msg\"" >> ${scfg}
+               echo -e "label=\"video\"" >> ${scfg}
+               echo "image=\"cat /boot/help.msg\"" >> ${scfg}
+               echo -e "label=\"help\"" >> ${scfg}
+               ;;
+       x86)
+               if [ -e ${clst_target_path}/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
+                       echo "default ${first}" > ${icfg}
+                       echo "timeout 150" >> ${icfg}
+                       echo "prompt 1" >> ${icfg}
+                       echo "display boot.msg" >> ${icfg}
+                       echo "F1 kernels.msg" >> ${icfg}
+                       echo "F2 help.msg" >> ${icfg}
+
+                       echo "Available kernels:" > ${kmsg}
+                       cp ${clst_sharedir}/livecd/files/x86-help.msg ${hmsg}
+
+                       for x in ${clst_boot_kernel}
+                       do
+
+                               eval custom_kopts=\$${x}_kernelopts
+                               echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
+                               echo >> ${icfg}
+                               echo "label ${x}" >> ${icfg}
+                               echo "  kernel ${x}" >> ${icfg}
+                               if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+                               then
+                                       echo "  append ${default_append_line} vga=791 dokeymap splash=silent,theme:${clst_livecd_splash_theme}" >> ${icfg}
+                               else
+                                       echo "  append ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg}
+                               fi
+                       
+                               echo >> ${icfg}
+                               echo "   ${x}" >> ${kmsg}
+                               echo "label ${x}-nofb" >> ${icfg}
+                               echo "  kernel ${x}" >> ${icfg}
+                               echo "  append ${default_append_line} " >> ${icfg}
+                               echo >> ${icfg}
+                               echo "   ${x}-nofb" >> ${kmsg}
+                       done
+
+                       if [ -f ${clst_target_path}/boot/memtest86 ]
+                       then
+                               echo >> $icfg
+                               echo "   memtest86" >> $kmsg
+                               echo "   title memtest86" >> $icfg
+                               echo "   kernel memtest86" >> $icfg
+                       fi
+               fi
+
+               if [ -e ${clst_target_path}/boot/grub/stage2_eltorito ]
+               then
+                       icfg=${clst_target_path}/boot/grub/grub.conf
+                       hmsg=${clst_target_path}/boot/grub/help.msg
+                       echo "default 1" > ${icfg}
+                       echo "timeout 150" >> ${icfg}
+                       echo >> ${icfg}
+                       echo "title help" >> ${icfg}
+                       echo "cat /boot/grub/help.msg" >> ${icfg}
+                       for x in ${clst_boot_kernel}
+                       do
+                               eval custom_kopts=\$${x}_kernelopts
+                               echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
+                               echo >> ${icfg}
+                               echo "title ${x}" >> ${icfg}
+                               
+                               if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+                               then
+                                       echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent,theme:${clst_livecd_splash_theme}" >> ${icfg}
+                               else
+                                       echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg}
+                               fi
+
+                               if [ -e ${clst_target_path}/boot/${x}.igz ]
+                               then
+                                       echo "initrd /boot/${x}.igz" >> ${icfg}
+                               fi
+                               
+                               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 ]
+                               then
+                                       echo "initrd /boot/${x}.igz" >> ${icfg}
+                               fi
+                       done
+
+                       if [ -f ${clst_target_path}/boot/memtest86 ]
+                       then
+                               echo >> ${icfg}
+                               echo "title memtest86" >> ${icfg}
+                               echo "kernel /boot/memtest86" >> ${icfg}
+                       fi
+               fi
+               ;;
+esac
+exit 0 
diff --git a/targets/livecd-stage2/livecd-stage2-cdfs.sh b/targets/livecd-stage2/livecd-stage2-cdfs.sh
new file mode 100755 (executable)
index 0000000..528b8e5
--- /dev/null
@@ -0,0 +1,34 @@
+# 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
new file mode 100755 (executable)
index 0000000..0a8b3f6
--- /dev/null
@@ -0,0 +1,101 @@
+# 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.1 2005/04/04 17:48:33 rocket Exp $
+. ${clst_sharedir}/targets/support/functions.sh
+. ${clst_sharedir}/targets/support/filesystem-functions.sh
+
+#source ${clst_livecd_archscript}
+## START RUNSCRIPT
+
+case $1 in
+       kernel)
+               shift
+               export clst_kname="$1"
+               
+
+               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_modules ${clst_chroot_path} ${clst_kname}
+               #16:12 <@solar> kernel_name=foo
+               #16:13 <@solar> eval clst_boot_kernel_${kernel_name}_config=bar
+               #16:13 <@solar> eval echo \$clst_boot_kernel_${kernel_name}_config
+               ;;
+
+       preclean)
+               # move over the motd (if applicable)
+               if [ -n "${clst_livecd_motd}" ]
+               then
+                       cp -a ${clst_livecd_motd} ${clst_chroot_path}/etc/motd
+               else
+                       cp -a ${clst_sharedir}/livecd/files/generic.motd.txt \
+                               ${clst_sharedir}/livecd/files/universal.motd.txt \
+                               ${clst_sharedir}/livecd/files/minimal.motd.txt \
+                               ${clst_sharedir}/livecd/files/environmental.motd.txt \
+                               ${clst_sharedir}/livecd/files/gamecd.motd.txt \
+                               ${clst_chroot_path}/etc
+               fi
+       
+               # move over the xinitrc (if applicable)
+               if [ -n "${clst_livecd_xinitrc}" ]
+               then
+                       cp -a ${clst_livecd_xinitrc} ${clst_chroot_path}/etc/X11/xinit/xinitrc
+               fi
+
+               # move over the environment
+               cp ${clst_sharedir}/livecd/files/livecd-bash_profile \
+                       ${clst_chroot_path}/root/.bash_profile
+               touch ${clst_chroot_path}/root/.bashrc
+               cp ${clst_sharedir}/livecd/files/livecd-local.start \
+                       ${clst_chroot_path}/etc/conf.d/local.start
+               cp ${clst_sharedir}/livecd/files/mkvardb \
+                       ${clst_chroot_path}/tmp
+               mkdir -p /usr/share/faces
+               cp ${clst_sharedir}/livecd/files/gentoo.png \
+                       ${clst_chroot_path}/usr/share/faces
+
+               # touch /etc/startx if our livecd/type requires it
+               if [ "${clst_livecd_type}" = "gentoo-release-environmental" ] \
+               || [ "${clst_livecd_type}" = "gentoo-gamecd" ]
+               then
+                       touch ${clst_chroot_path}/etc/startx
+               fi
+               
+               # now, finalize and tweak the livecd fs (inside of the chroot)
+               exec_in_chroot  ${clst_sharedir}/targets/support/livecdfs-update.sh
+
+               # execute gamecdfs-update.sh if we're a gamecd
+               if [ "${clst_livecd_type}" = "gentoo-gamecd" ]
+               then
+                       exec_in_chroot ${clst_sharedir}/targets/support/gamecdfs-update.sh
+               fi
+               
+               # if the user has their own fs update script, execute it
+               if [ -n "${clst_livecd_fsscript}" ]
+               then
+                       exec_in_chroot ${clst_livecd_fsscript}
+               fi
+               ;;
+
+       clean)
+               find ${clst_chroot_path}/usr/lib -iname "*.pyc" -exec rm -f {} \;
+               ;;
+
+       bootloader)
+               # Here is where we poke in our identifier
+               touch ${clst_target_path}/livecd
+               
+               ${clst_sharedir}/targets/livecd-stage2/livecd-stage2-bootloader.sh
+               ;;
+
+       cdfs)
+               ${clst_sharedir}/targets/livecd-stage2/livecd-stage2-cdfs.sh
+               ;;
+
+       iso)
+               shift
+               ${clst_sharedir}/targets/livecd-stage2/livecd-stage2-iso.sh $1
+               ;;
+esac
+exit 0 
diff --git a/targets/livecd-stage2/livecd-stage2-iso.sh b/targets/livecd-stage2/livecd-stage2-iso.sh
new file mode 100755 (executable)
index 0000000..0db179c
--- /dev/null
@@ -0,0 +1,93 @@
+# 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 $
+. ${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
+
+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
+                       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 -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image"
+                       ;;
+               esac
+               isomarkboot ${1} /boot/bootlx
+       ;;
+
+       arm)
+               ;;
+       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"
+               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}
+       ;;
+       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} \
+                       || die "Cannot make ISO image"
+
+       ;;
+       sparc64)
+               # Old silo + patched mkisofs fubar magic
+               # 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 
+               /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"
+               rm /tmp/mkisofs.sparc.fu
+                                                                                                                       
+       ;;
+       
+       x86)
+               #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 ]
+               then
+                       case ${clst_livecd_cdfstype} 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"
+                               ;;
+                               *)
+                                       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"
+                               ;;
+                       esac
+               fi
+
+               if [ -e ${clst_target_path}/boot/grub/stage2_eltorito ]
+               then
+                       case ${clst_livecd_cdfstype} 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"
+                               ;;
+                               *)
+                                       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"
+                               ;;
+                       esac
+               fi
+       ;;
+esac
+exit 0 
index ab51c1cdb58513868e24309e10f87817f8b0c6f4..c9d26075e67bd816a53b93ac75a8ded2c869d523 100644 (file)
@@ -1,10 +1,11 @@
 # 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/unmerge.sh,v 1.7 2005/03/02 02:14:34 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/Attic/unmerge.sh,v 1.8 2005/04/04 17:48:33 rocket Exp $
 
 ${clst_CHROOT} ${clst_chroot_path} /bin/bash << EOF
        EMERGE_WARNING_DELAY=0 emerge -C $*
 EOF
+
 if [ -d /usr/livecd/profiles ]
 then
        mkdir -p /usr/portage/profiles
diff --git a/targets/netboot/netboot-busybox.sh b/targets/netboot/netboot-busybox.sh
deleted file mode 100644 (file)
index a379f8c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/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/Attic/netboot-busybox.sh,v 1.5 2005/01/26 21:59:40 wolf31o2 Exp $
-
-/usr/sbin/env-update
-source /etc/profile
-
-[ -f /tmp/envscript ] && source /tmp/envscript
-
-# setup our environment
-export FEATURES="${clst_myfeatures}"
-export CONFIG_PROTECT="-*"
-export USE_ORDER="env:pkg:conf:defaults"       
-
-# Use the catalyst config
-export USE="netboot make-busybox-symlinks"
-
-if [ ! -z "${1}" ]
-then
-       export USE="${USE} savedconfig"
-       # Do not use package for busybox since the config can change
-       ROOT=${IMAGE_PATH} emerge --nodeps busybox || exit 1
-else
-       ROOT=${IMAGE_PATH} emerge --nodeps ${clst_myemergeopts} busybox || exit 1
-
-fi
-
index bf7f6599568e20155678513397a1a3ff0afe6bc7..a417af585267ee2a82ece6f7eababf37673aec5d 100644 (file)
@@ -1,12 +1,19 @@
 #!/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-combine.sh,v 1.2 2005/01/11 15:22:41 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-combine.sh,v 1.3 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. ${clst_sharedir}/targets/support/chroot-functions.sh
+. ${clst_sharedir}/targets/support/functions.sh
+. ${clst_sharedir}/targets/support/filesystem-functions.sh
 
-[ -f /tmp/envscript ] && source /tmp/envscript
+update_env_settings
+check_portage_version
+setup_myfeatures
+setup_myemergeopts
+
+# setup our environment
+export FEATURES="${clst_myfeatures}"
 
 # First install the boot package that we need
 booter=""
@@ -18,57 +25,81 @@ case ${clst_mainarch} in
        x86)    booter=netboot;;
        *)              exit 1;;
 esac
-if [ ! -z "${booter}" ] ; then
-       emerge -k -b ${booter} || exit 1
-fi
+#if [ ! -z "${booter}" ] ; then
+#      run_emerge ${booter} || exit 1
+#fi
+
+extract_kernels ${clst_chroot_path}/tmp
 
 # Then generate the netboot image ! :D
-case ${clst_mainarch} in
-       alpha)
-               make \
-                       -C /usr/src/linux \
-                       INITRD=/initrd.gz \
-                       HPATH="/usr/src/linux/include" \
-                       vmlinux bootpfile \
-                       || exit 1
-               cp /usr/src/linux/arch/alpha/boot/bootpfile /netboot.alpha || exit 1
-               ;;
-       arm)
-               cp /kernel /netboot.arm || exit 1
-               cat /initrd.gz >> /netboot.arm || exit 1
-               #make \
-               #       -C /usr/src/linux \
-               #       INITRD=/initrd.gz \
-               #       bootpImage \
-               #       || exit 1
-               ;;
-       hppa)
-               # We have to remove the previous image because the file is considered
-               # as a tape by palo and then not truncated but rewritten.
-               rm -f /netboot.hppa
+for kname in ${clst_boot_kernel}
+do
+
+    mkdir -p ${clst_chroot_path}/tmp/staging/initrd-${kname}
+    cp -r ${clst_chroot_path}/tmp/image ${clst_chroot_path}/tmp/staging/initrd-${kname}
+    extract_modules ${clst_chroot_path}/tmp/staging/initrd-${kname} ${kname}
+    create_normal_loop ${clst_chroot_path}/tmp/staging/initrd-${kname} ${clst_target_path} initrd-${kname}.igz
+    rm -r ${clst_chroot_path}/tmp/staging/initrd-${kname}
+
+
+
+    case ${clst_mainarch} in
+           alpha)
+                  # Until aboot is patched this is broken currently.
+                   # please use catalyst 1.1.5 or older
                
-               palo \
-                       -k /kernel \
-                       -r /initrd.gz \
-                       -s /netboot.hppa \
-                       -f foo \
-                       -b /usr/share/palo/iplboot \
-                       -c "0/vmlinux root=/dev/ram0 initrd=/initrd" \
-                       || exit 1
-               ;;
-       sparc*)
-               elftoaout -o /netboot.${clst_mainarch} /usr/src/linux/vmlinux
-               piggy=${clst_mainarch/sparc/piggyback}
-               ${piggy} /netboot.${clst_mainarch} /usr/src/linux/System.map initrd.gz
-               ;;
-       x86)
-               mknbi-linux \
-                       -k /kernel \
-                       -r /initrd.gz \
-                       -o /netboot.x86 \
-                       -x \
-                       -a "root=/dev/ram0 initrd=/initrd" \
-                       || exit 1
-               ;;
-       *)      exit 1;;
-esac
+                   #TEST TEST TEST TEST
+                   #http://lists.debian.org/debian-alpha/2004/07/msg00094.html
+                   #make \
+                   #       -C /usr/src/linux \
+                   #       INITRD=/initrd.gz \
+                   #       HPATH="/usr/src/linux/include" \
+                   #       vmlinux bootpfile \
+                   #       || exit 1
+                   #cp /usr/src/linux/arch/alpha/boot/bootpfile /netboot.alpha || exit 1
+                   ;;
+           arm)
+                   #TEST TEST TEST TEST
+                   cp /${clst_chroot_path}/tmp/${kname} /netboot-${kname}.arm || exit 1
+                   cat /${clst_target_path}/initrd-${kname}.igz >> /${clst_target_path}/netboot-${kname}.arm || exit 1
+                   #make \
+                   #   -C /usr/src/linux \
+                   #   INITRD=/initrd.gz \
+                   #   bootpImage \
+                   #   || exit 1
+                   ;;
+           hppa)
+                   # We have to remove the previous image because the file is considered
+                   # as a tape by palo and then not truncated but rewritten.
+                   #TEST TEST TEST TEST
+                   rm -f /netboot-${kname}.hppa
+               
+                   palo \
+                           -k /${clst_chroot_path}/tmp/${kname} \
+                           -r /${clst_target_path}/initrd-${kname}.igz \
+                           -s /${clst_target_path}/netboot-${kname}.hppa \
+                           -f foo \
+                           -b /usr/share/palo/iplboot \
+                           -c "0/vmlinux root=/dev/ram0 ${cmdline_opts}" \
+                           || exit 1
+                   ;;
+           sparc*)
+                   #TEST TEST TEST TEST
+                   #elftoaout -o /netboot-${kname}.${clst_mainarch} /usr/src/linux/vmlinux
+                   #elftoaout -o /netboot-${kname}.${clst_mainarch} /${kname}
+                   #piggy=${clst_mainarch/sparc/piggyback}
+                   #${piggy} /netboot-${kname}.${clst_mainarch} /usr/src/linux/System.map /initrd-${kname}.igz
+                   ;;
+           x86)
+                   
+                   mknbi-linux \
+                           -k /${clst_chroot_path}/tmp/${kname} \
+                           -r /${clst_target_path}/initrd-${kname}.igz \
+                           -o /${clst_target_path}/netboot-${kname}.x86 \
+                           -x \
+                           -a "root=/dev/ram0 ${cmdline_opts}" \
+                           || exit 1
+                   ;;
+           *)  exit 1;;
+    esac
+done
index 02e2a23ee698b69a1b6130462315851cd1d5fa71..4cf3d280d5cfed36b27536d9a232058548ed0f81 100644 (file)
 #!/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-image.sh,v 1.4 2005/01/11 15:22:41 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-image.sh,v 1.5 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
 
-if [ -f /tmp/envscript ]
-then
-       source /tmp/envscript
-       rm -f /tmp/envscript
-fi
+update_env_settings
 
-#IMAGE_PATH=$1
-#shift
-#TARBALL=$1
-#shift
 
-if [ -z "${IMAGE_PATH}" ]
-then
-       echo "IMAGE_PATH not specified !"
-       exit 1
-fi
-
-# Install the netboot base system
-ROOT=${IMAGE_PATH} emerge -k -b --nodeps netboot-base || exit 1
-
-# Copy libs of a executable in the chroot
-function copy_libs() {
-
-       # Check if it's a dynamix exec
-       ldd ${1} > /dev/null 2>&1 || return
-    
-       for lib in `ldd ${1} | awk '{ print $3 }'`
-       do
-               if [ -e ${lib} ]
-               then
-                       if [ ! -e ${IMAGE_PATH}/${lib} ]
-                       then
-                               copy_file ${lib}
-                               [ -e "${IMAGE_PATH}/${lib}" ] && strip -R .comment -R .note ${IMAGE_PATH}/${lib} || echo "WARNING : Cannot strip lib ${IMAGE_PATH}/${lib} !"
-                       fi
-               else
-                       echo "WARNING : Some library was not found for ${lib} !"
-               fi
-       done
-
-}
-
-
-function copy_symlink() {
-
-       STACK=${2}
-       [ "${STACK}" = "" ] && STACK=16 || STACK=$((${STACK} - 1 ))
-
-       if [ ${STACK} -le 0 ] 
-       then
-               echo "WARNING : ${TARGET} : too many levels of symbolic links !"
-               return
-       fi
-
-       [ ! -e ${IMAGE_PATH}/`dirname ${1}` ] && mkdir -p ${IMAGE_PATH}/`dirname ${1}`
-       [ ! -e ${IMAGE_PATH}/${1} ] && cp -vfdp ${1} ${IMAGE_PATH}/${1}
-       
-       TARGET=`readlink -f ${1}`
-       if [ -h ${TARGET} ]
-       then
-               copy_symlink ${TARGET} ${STACK}
-       else
-               copy_file ${TARGET}
-       fi
-               
-
-}
-
-function copy_file() {
-
-       f="${1}"
-
-       if [ ! -e "${f}" ]
-       then
-               echo "WARNING : File not found : ${f}"
-               continue
-       fi
-
-       [ ! -e ${IMAGE_PATH}/`dirname ${f}` ] && mkdir -p ${IMAGE_PATH}/`dirname ${f}`
-       [ ! -e ${IMAGE_PATH}/${f} ] && cp -vfdp ${f} ${IMAGE_PATH}/${f}
-       if [ -x ${f} -a ! -h ${f} ]
-       then
-               copy_libs ${f}
-               strip -R .comment -R .note ${IMAGE_PATH}/${f} > /dev/null 2>&1
-       elif [ -h ${f} ]
-       then
-               copy_symlink ${f}
-       fi
-}
-
-
-# Copy the files needed in the chroot
-
-copy_libs ${IMAGE_PATH}/bin/busybox
-
-FILES="${@}"
-for f in ${FILES}
-do  
+echo "copying files to ${clst_root_path}"
+clst_files="/bin/busybox ${clst_files} "
+for f in ${clst_files}
+do 
        copy_file ${f}
 done
-
-# Copy the kernel modules over
-if [ -d ${GK_BINARIES}/lib ] ; then
-       cp -r ${GK_BINARIES}/lib ${IMAGE_PATH}/ || exit 1
-fi
-
-# Prune portage stuff
-cd ${IMAGE_PATH}
-rm -r var/db var/cache
-
-# Create the ramdisk
-emerge -k -b genext2fs
-IMAGE_SIZE=$(du -s -k ${IMAGE_PATH} | cut -f1)
-IMAGE_SIZE=$((IMAGE_SIZE + 500))
-IMAGE_INODES=$(find ${IMAGE_PATH} | wc -l)
-IMAGE_INODES=$((IMAGE_INODES + 100))
-genext2fs -q -d "${IMAGE_PATH}" -b ${IMAGE_SIZE} -i ${IMAGE_INODES} /initrd || exit 1
-gzip -9f /initrd || exit 1
+echo "done copying files"
diff --git a/targets/netboot/netboot-kernel.sh b/targets/netboot/netboot-kernel.sh
deleted file mode 100644 (file)
index 0a329d2..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/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/Attic/netboot-kernel.sh,v 1.6 2005/01/26 21:59:40 wolf31o2 Exp $
-
-/usr/sbin/env-update
-source /etc/profile
-
-[ -f /tmp/envscript ] && source /tmp/envscript
-
-# setup our environment
-export FEATURES="${clst_myfeatures}"
-export CONFIG_PROTECT="-*"
-export USE_ORDER="env:pkg:conf:defaults"       
-
-mkdir -p ${GK_BINARIES}
-BUILD_KERNEL=1
-CONFIG_MD5_EQUAL=0
-
-GK_PKGDIR="$(portageq envvar PKGDIR)/All/genkernel"
-
-if [ -e "${GK_PKGDIR}/config-md5" -a "`md5sum ${CONFIG}`" = "$(< ${GK_PKGDIR}/config-md5)" ]
-then
-       CONFIG_MD5_EQUAL=1
-       echo "Using the cached kernel since your .config didn't changed."
-fi
-
-if [ -n "${clst_KERNCACHE}" -a ${CONFIG_MD5_EQUAL} -eq 1 ] 
-then
-       mkdir -p ${GK_PKGDIR}
-       if [ -f ${GK_PKGDIR}/kernel ] && [ -d ${GK_PKGDIR}/lib ]
-       then
-               cp -r ${GK_PKGDIR}/lib ${GK_BINARIES}/ || exit 1
-               cp ${GK_PKGDIR}/kernel ${GK_BINARIES}/ || exit 1
-               BUILD_KERNEL=0
-       fi
-fi
-
-if [ ${BUILD_KERNEL} -eq 1 ]
-then
-       # setup genkernel
-       emerge ${clst_myemergeopts} genkernel || exit 1
-
-       # Build the kernel !
-       emerge ${clst_myemergeopts} ${SOURCES} || exit 1
-
-       genkernel \
-               --no-mountboot \
-               --kerneldir=/usr/src/linux \
-               --kernel-config=${CONFIG} \
-               --module-prefix=${GK_BINARIES} \
-               --minkernpackage=${GK_BINARIES}/kernel.tar.bz2 \
-               kernel || exit 1
-
-       # DO NOT STRIP MODULES !!! It makes them unloadable !
-
-
-       kernname="$(tar -tjf ${GK_BINARIES}/kernel.tar.bz2)"
-       tar -jxf ${GK_BINARIES}/kernel.tar.bz2 -C ${GK_BINARIES}
-       mv ${GK_BINARIES}/{${kernname},kernel} || exit 1 
-
-       if [ -n "${clst_KERNCACHE}" ]
-       then
-               case ${clst_mainarch} in
-                       alpha|arm|sparc);;
-                       *)
-                               cp -r ${GK_BINARIES}/lib ${GK_PKGDIR}/ || exit 1
-                               cp ${GK_BINARIES}/kernel ${GK_PKGDIR}/ || exit 1
-                               ;;
-               esac
-       fi
-
-       md5sum "${CONFIG}" > "${GK_PKGDIR}/config-md5"
-fi
-
-cp ${GK_BINARIES}/kernel / || exit 1
diff --git a/targets/netboot/netboot-packages.sh b/targets/netboot/netboot-packages.sh
deleted file mode 100644 (file)
index ea32175..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/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/Attic/netboot-packages.sh,v 1.6 2005/01/28 18:37:23 wolf31o2 Exp $
-
-portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
-       | cut -d/ -f2 | cut -d- -f2,3`
-if [ `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt 51 ]
-then
-       echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
-       echo "2.0.51 or greater is required."
-       exit 1
-fi
-
-/usr/sbin/env-update
-source /etc/profile
-
-[ -f /tmp/envscript ] && source /tmp/envscript
-
-# setup our environment
-export FEATURES="${clst_myfeatures}"
-export CONFIG_PROTECT="-*"
-export USE_ORDER="env:pkg:conf:defaults"
-
-if [ "${clst_FETCH}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} -f"
-fi
-
-# START BUILD
-if [ "${clst_VERBOSE}" ]
-then
-       emerge ${clst_myemergeopts} -vp ${clst_packages}
-       echo "Press any key within 15 seconds to pause the build..."
-       read -s -t 15 -n 1
-       if [ $? -eq 0 ]
-       then
-               echo "Press any key to continue..."
-               read -s -n 1
-       fi
-fi
-
-emerge ${clst_myemergeopts} ${clst_packages}
diff --git a/targets/netboot/netboot-setup.sh b/targets/netboot/netboot-setup.sh
deleted file mode 100644 (file)
index a37b24a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/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/Attic/netboot-setup.sh,v 1.1 2004/10/11 14:28:27 zhen Exp $
-
-/usr/sbin/env-update
-source /etc/profile
-
-[ -f /tmp/envscript ] && source /tmp/envscript
-
-if [ -n "${clst_CCACHE}" ]
-then
-       emerge -b -k --oneshot --nodeps ccache || exit 1
-fi
-               
-if [ -n "${clst_DISTCC}" ]
-then   
-       USE="-gtk -gnome" emerge -b -k --oneshot --nodeps distcc || exit 1
-fi
-
-mkdir -p ${IMAGE_PATH}
diff --git a/targets/netboot/netboot.sh b/targets/netboot/netboot.sh
deleted file mode 100644 (file)
index fafc5d0..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/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/Attic/netboot.sh,v 1.6 2005/01/11 15:22:41 zhen Exp $
-
-export GK_BINARIES=/var/tmp/gk_binaries
-export IMAGE_PATH=/tmp/image
-
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-fi
-if [ -n "${clst_DISTCC}" ]
-then   
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-fi
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg --newuse"
-fi
-
-scriptdir=${clst_sharedir}/targets/netboot
-
-cmd=$1
-shift
-case ${cmd} in
-
-       setup)
-               cp ${scriptdir}/netboot-setup.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-setup.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/netboot-setup.sh
-       ;;
-       
-       packages)
-               cp ${scriptdir}/netboot-packages.sh ${clst_chroot_path}/tmp
-               clst_packages="$*" ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-packages.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/netboot-packages.sh
-       ;;
-
-       busybox)
-               # Custom busybox config support
-               if [ ! -z "${1}" ]
-               then
-                       mkdir -p ${clst_chroot_path}/etc/busybox/${clst_CHOST}
-                       cp -v ${1} ${clst_chroot_path}/etc/busybox/${clst_CHOST}/busybox.config
-               fi
-       
-               cp ${scriptdir}/netboot-busybox.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-busybox.sh "${1}" || exit 1
-               rm -f ${clst_chroot_path}/tmp/netboot-busybox.sh
-       ;;
-
-       kernel)
-               KERNEL_TYPE=${1}
-               SOURCES=${2}
-               CONFIG=${3}
-               if [ "${KERNEL_TYPE}" == "kernel-sources" ]
-               then
-                       cp ${scriptdir}/netboot-kernel.sh ${clst_chroot_path}/tmp
-                       cp ${CONFIG} ${clst_chroot_path}/var/tmp/kernel.config || die
-                       env SOURCES=${SOURCES} CONFIG=/var/tmp/kernel.config \
-                               ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-kernel.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/netboot-kernel.sh
-               else
-                       cp ${clst_netboot_kernel_prebuilt} ${clst_chroot_path}/kernel
-               fi
-       ;;
-
-       image)
-               cp ${scriptdir}/netboot-image.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-image.sh "$@" || exit 1
-               rm -f ${clst_chroot_path}/tmp/netboot-image.sh
-       ;;
-
-       finish)
-               cp ${scriptdir}/netboot-combine.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-combine.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/netboot-combine.sh
-
-               mkdir -p ${clst_target_path}
-               cp \
-                       ${clst_chroot_path}/{initrd.gz,kernel,netboot.$clst_mainarch} \
-                       ${clst_target_path} || exit 1
-       ;;
-
-       clean)
-               exit 0;;
-       *)
-               exit 1;;
-esac
-
-exit 0
index ae64e0d76f90bebfd15128153d697e76905f18b5..9bebfc25f02ca987620c40bdf607ee9661034783 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/python
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/build.py,v 1.1 2004/08/02 23:23:34 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/build.py,v 1.2 2005/04/04 17:48:33 rocket Exp $
 
-import portage
+import portage,sys
 
 # this loads files from the profiles ...
 # wrap it here to take care of the different
@@ -32,4 +32,4 @@ for idx in range(0, len(pkgs)):
                        buildpkgs[bidx] = buildpkgs[bidx][1:]
        except: pass
 
-for b in buildpkgs: print b
+for b in buildpkgs: sys.stdout.write(b+" ")
index 5dbe1460637dac6476036272b261581287eacc29..20b8565309908d9beed02871327584063223b765 100755 (executable)
@@ -1,75 +1,23 @@
 #!/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-chroot.sh,v 1.29 2005/02/28 23:21:09 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.30 2005/04/04 17:48:33 rocket Exp $
                
-portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
-       | cut -d/ -f2 | cut -d- -f2,3`
-if [ `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt 51 ]
-then
-       echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
-       echo "2.0.51 or greater is required."
-       exit 1
-fi
+. /tmp/chroot-functions.sh
+check_portage_version
 
-/usr/sbin/env-update
-source /etc/profile
+update_env_settings
 
-if [ -x /usr/bin/gcc-config ]
-then
-       gcc_current=`gcc-config -c`
-       gcc-config 3 && source /etc/profile
-       gcc-config ${gcc_current} && source /etc/profile
-fi
+setup_gcc
 
-[ -f /tmp/envscript ] && source /tmp/envscript
-               
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"      
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-               
-if [ -n "${clst_DISTCC}" ]
-then   
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gtk -gnome" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
-
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg --newuse"
-fi
-
-if [ -n "${clst_FETCH}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} -f"
-fi
+setup_myfeatures
+setup_myemergeopts
 
 # setup our environment
-export FEATURES="${clst_myfeatures}"
-export ROOT=${1}
-install -d ${ROOT}
-               
-## START BUILD
 export clst_buildpkgs="$(/tmp/build.py)"
-STAGE1_USE="$(portageq envvar STAGE1_USE)"
-
-# duplicate line to below - why is this here??
-#USE="-* build ${STAGE1_USE}" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
-
-if [ -n "${clst_VERBOSE}" ]
-then
-       USE="-* build" emerge ${clst_myemergeopts} -vp --noreplace ${clst_buildpkgs} || exit 1
-       echo "Press any key within 15 seconds to pause the build..."
-       read -s -t 15 -n 1
-       if [ $? -eq 0 ]
-       then
-               echo "Press any key to continue..."
-               read -s -n 1
-       fi
-fi
+export STAGE1_USE="$(portageq envvar STAGE1_USE)"
+export USE="-* build ${STAGE1_USE}"
+export FEATURES="${clst_myfeatures}"
 
-USE="-* build ${STAGE1_USE}" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
+## START BUILD
+run_emerge "--noreplace ${clst_buildpkgs}"
diff --git a/targets/stage1/stage1-controller.sh b/targets/stage1/stage1-controller.sh
new file mode 100755 (executable)
index 0000000..65dcee1
--- /dev/null
@@ -0,0 +1,45 @@
+#!/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.1 2005/04/04 17:48:33 rocket Exp $
+. ${clst_sharedir}/targets/support/functions.sh
+
+case $1 in
+       enter)
+       ;;
+
+       run)
+               cp ${clst_sharedir}/targets/stage1/build.py ${clst_chroot_path}/tmp
+               
+               # set up "ROOT in chroot" dir
+               install -d ${clst_chroot_path}/${clst_root_path}/etc
+               
+               # set up make.conf and make.profile link in "ROOT in chroot":
+               copy_to_chroot ${clst_chroot_path}/etc/make.conf /${clst_root_path}/etc
+               copy_to_chroot ${clst_chroot_path}/etc/make.profile /${clst_root_path}/etc
+               
+               # enter chroot, execute our build script
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh || exit 1
+       ;;
+
+       preclean)
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh /tmp/stage1root || exit 1
+
+       ;;
+
+       clean)
+               # clean out man, info and doc files
+               rm -rf usr/share/{man,doc,info}/*
+               # zap all .pyc and .pyo files
+               find -iname "*.py[co]" -exec rm -f {} \;
+               # cleanup all .a files except libgcc.a, *_nonshared.a and /usr/lib/portage/bin/*.a
+               find -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' | grep -v '/usr/lib/portage/bin/' | grep -v 'libgcc_eh.a' | xargs rm -f
+       ;;
+       
+       *)
+               exit 1
+       ;;
+
+esac
+exit 0
+
similarity index 66%
rename from targets/stage1/stage1-preclean2-chroot.sh
rename to targets/stage1/stage1-preclean-chroot.sh
index f763525b9cc2366ed6ac2a0505a6787c47fcdea9..081bf98deced857b8fe94258c5fbaf1939d670d9 100755 (executable)
@@ -1,15 +1,17 @@
 #!/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/Attic/stage1-preclean2-chroot.sh,v 1.10 2005/03/03 13:59:56 wolf31o2 Exp $
-               
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-preclean-chroot.sh,v 1.1 2005/04/04 17:48:33 rocket Exp $
+
+. /tmp/chroot-functions.sh
+
 # now, some finishing touches to initialize gcc-config....
 unset ROOT
 
 if [ -x /usr/bin/gcc-config ]
 then
        mythang=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
-       gcc-config ${mythang}; /usr/sbin/env-update; source /etc/profile
+       gcc-config ${mythang}; update_env_settings
 fi
 
 # stage1 is not going to have anything in zoneinfo, so save our Factory timezone
@@ -21,4 +23,4 @@ else
 fi
 
 # this cleans out /var/db, but leaves behind files portage needs for removal
-#find /var/db/pkg -type f | grep -v '\(COUNTER\|CONTENTS\|SLOT\|ebuild\)' | xargs rm -f
+#find /var/db/pkg -type f | grep -v '\(COUNTER\|CONTENTS\|ebuild\)' | xargs rm -f
diff --git a/targets/stage1/stage1.sh b/targets/stage1/stage1.sh
deleted file mode 100755 (executable)
index 53336de..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/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/Attic/stage1.sh,v 1.17 2005/01/05 20:18:05 wolf31o2 Exp $
-
-case $1 in
-       enter)
-               ${clst_CHROOT} ${clst_chroot_path} /bin/bash
-       ;;
-
-       run)
-               cp ${clst_sharedir}/targets/stage1/stage1-chroot.sh ${clst_chroot_path}/tmp
-               cp ${clst_sharedir}/targets/stage1/build.py ${clst_chroot_path}/tmp
-               
-               # set up "ROOT in chroot" dir
-               install -d ${clst_chroot_path}/tmp/stage1root/etc
-               
-               # set up make.conf and make.profile link in "ROOT in chroot":
-               cp ${clst_chroot_path}/etc/make.conf ${clst_chroot_path}/tmp/stage1root/etc
-               cp -a ${clst_chroot_path}/etc/make.profile ${clst_chroot_path}/tmp/stage1root/etc
-               
-               # enter chroot, execute our build script
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/stage1-chroot.sh /tmp/stage1root || exit 1
-       ;;
-
-       preclean)
-               #preclean runs with bind mounts active -- for running any commands inside chroot
-               
-               #first we cleanup after ourselves
-               #cp ${clst_sharedir}/targets/stage1/stage1-preclean1-chroot.sh ${clst_chroot_path}/tmp
-        #${clst_CHROOT} ${clst_chroot_path} /tmp/stage1-preclean1-chroot.sh || exit 1
-        #rm -f ${clst_chroot_path}/tmp/stage1-preclean1-chroot.sh
-
-               #second we do the gcc magic
-               cp ${clst_sharedir}/targets/stage1/stage1-preclean2-chroot.sh ${clst_chroot_path}/tmp/stage1root/tmp
-               ${clst_CHROOT} ${clst_chroot_path}/tmp/stage1root /tmp/stage1-preclean2-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/stage1root/tmp/stage1-preclean2-chroot.sh
-       ;;
-       
-       clean)
-               #clean runs after preclean with bind mounts unmounted
-               #keepers="virtual/os-headers sys-devel/binutils sys-devel/gcc sys-apps/baselayout virtual/libc virtual/kernel"
-               # set everything to uid 999 (nouser)
-               #cd ${clst_chroot_path}/tmp/stage1root
-               #install -d var/db/pkg2 
-               
-               #for x in $keepers
-               #do
-               #       category=${x%%/*}
-               #       package=${x##*/}
-               #       [ "`ls var/db/pkg/${x}* 2>/dev/null`" = "" ] && continue
-               #       install -d var/db/pkg2/${category}
-               #       mv var/db/pkg/${category}/${package}* var/db/pkg2/${category}
-               #done
-               #rm -rf var/db/pkg
-               #mv var/db/pkg2 var/db/pkg
-
-               # clean out man, info and doc files
-               rm -rf usr/share/{man,doc,info}/*
-               # zap all .pyc and .pyo files
-               find -iname "*.py[co]" -exec rm -f {} \;
-               # cleanup all .a files except libgcc.a, *_nonshared.a and /usr/lib/portage/bin/*.a
-               find -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' | grep -v '/usr/lib/portage/bin/' | grep -v 'libgcc_eh.a' | xargs rm -f
-       ;;
-       
-*)
-               exit 1
-       ;;
-
-esac
-exit 0
-
index 866348e95faf5f27bf78f5cb3bacacb70d3eecce..32a443ace75921b17b0bd27d4d45b086c6e454fd 100755 (executable)
@@ -1,42 +1,19 @@
 #!/bin/sh
 # 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-chroot.sh,v 1.10 2005/01/11 14:10:19 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-chroot.sh,v 1.11 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
 
-[ -f /tmp/envscript ] && source /tmp/envscript
+update_env_settings
 
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-       emerge -b -k --oneshot --nodeps ccache || exit 1
-fi
-
-if [ -n "${clst_DISTCC}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gnome -gtk" emerge -b -k --oneshot --nodeps distcc || exit 1
-fi
-                                                                               
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export bootstrap_opts="-r"
-fi
-
-if [ -n "${clst_FETCH}" ]
-then
-       export bootstrap_opts="-f"
-fi
-
-GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)"
+setup_myfeatures
+setup_myemergeopts
 
 
 ## setup the environment
 export FEATURES="${clst_myfeatures}"
+GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)"
 
 ## START BUILD
 /usr/portage/scripts/bootstrap.sh ${bootstrap_opts} || exit 1
diff --git a/targets/stage2/stage2-controller.sh b/targets/stage2/stage2-controller.sh
new file mode 100755 (executable)
index 0000000..248e3ba
--- /dev/null
@@ -0,0 +1,35 @@
+#!/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 $
+. ${clst_sharedir}/targets/support/functions.sh
+
+
+# Only put commands in this section that you want every target to execute.
+# This is a global default file and will affect every target
+case $1 in
+       enter)
+               ${clst_CHROOT} ${clst_chroot_path}
+       ;;
+
+       run)
+               shift
+               export clst_packages="$*"
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+       ;;
+
+       preclean)
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
+       ;;
+
+       clean)
+               exit 0
+       ;;
+       
+       *)
+               exit 1
+       ;;
+
+esac
+
+exit 0
index 4d33ea18fbca4423e106a2ad4a69a392c9457102..e06e625efb1f31b7d3ca1790aa689b4c05563c4d 100755 (executable)
@@ -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/stage2/stage2-preclean-chroot.sh,v 1.4 2004/10/15 02:46:58 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-preclean-chroot.sh,v 1.5 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
+update_env_settings
 
 export CONFIG_PROTECT="-*"
 
diff --git a/targets/stage2/stage2.sh b/targets/stage2/stage2.sh
deleted file mode 100755 (executable)
index af60de6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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/Attic/stage2.sh,v 1.16 2004/10/15 02:46:58 zhen Exp $
-
-case $1 in
-       enter)
-               ${clst_CHROOT} ${clst_chroot_path}
-       ;;
-
-       run)
-               cp ${clst_sharedir}/targets/stage2/stage2-chroot.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/stage2-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/stage2-chroot.sh
-       ;;
-
-       preclean)
-               cp ${clst_sharedir}/targets/stage2/stage2-preclean-chroot.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/stage2-preclean-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/stage2-preclean-chroot.sh
-       ;;
-
-       clean)
-               exit 0
-       ;;
-
-       *)
-               exit 1
-       ;;
-
-esac
-exit 0
index 2d3eb3eedf8b8a5cafc403f9b38883669899e205..585e83e589bca85fd8a668b5d894b1f0ed911e06 100755 (executable)
@@ -1,68 +1,28 @@
 #!/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-chroot.sh,v 1.17 2005/01/28 18:37:23 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-chroot.sh,v 1.18 2005/04/04 17:48:33 rocket Exp $
 
-portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
-       | cut -d/ -f2 | cut -d- -f2,3`
-if [ `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt 51 ]
-then
-       echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
-       echo "2.0.51 or greater is required."
-       exit 1
-fi
+. /tmp/chroot-functions.sh
+check_portage_version
 
-/usr/sbin/env-update
-source /etc/profile
+update_env_settings
 
-[ -f /tmp/envscript ] && source /tmp/envscript
+setup_myfeatures
+setup_myemergeopts
 
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-
-if [ -n "${clst_DISTCC}" ]
-then   
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
-
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg --newuse"
-fi
-
-if [ -n "${clst_FETCH}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} -f"
-fi
-
-GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)"
 
 # setup the build environment
 export FEATURES="${clst_myfeatures}"
 export USE="-* ${clst_HOSTUSE} ${GRP_STAGE23_USE}"
 export CONFIG_PROTECT="-*"
+export GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)"
+
 
 ## START BUILD
 # portage needs to be merged manually with USE="build" set to avoid frying our
 # make.conf. emerge system could merge it otherwise.
-USE="build" emerge portage
 
-if [ -n "${clst_VERBOSE}" ]
-then
-       emerge -e ${clst_myemergeopts} -vp system || exit 1
-       echo "Press any key within 15 seconds to pause the build..."
-       read -s -t 15 -n 1
-       if [ $? -eq 0 ]
-       then
-               echo "Press any key to continue..."
-               read -s -n 1
-       fi
-fi
+setup_portage
 
-emerge -e ${clst_myemergeopts} system || exit 1
+run_emerge "-e system"
diff --git a/targets/stage3/stage3-controller.sh b/targets/stage3/stage3-controller.sh
new file mode 100755 (executable)
index 0000000..1eb2554
--- /dev/null
@@ -0,0 +1,35 @@
+#!/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 $
+. ${clst_sharedir}/targets/support/functions.sh
+
+
+# Only put commands in this section that you want every target to execute.
+# This is a global default file and will affect every target
+case $1 in
+       enter)
+               ${clst_CHROOT} ${clst_chroot_path}
+       ;;
+
+       run)
+               shift
+               export clst_packages="$*"
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+       ;;
+
+       preclean)
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
+       ;;
+
+       clean)
+               exit 0
+       ;;
+       
+       *)
+               exit 1
+       ;;
+
+esac
+
+exit 0
index 116c7fa318927c09d50dd079801b8905246f63ca..63b962ae542157637d3bdc163e0a05ca9d8ad76c 100755 (executable)
@@ -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/stage3/stage3-preclean-chroot.sh,v 1.4 2004/10/15 02:46:58 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-preclean-chroot.sh,v 1.5 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
+update_env_settings
 
 export CONFIG_PROTECT="-*"
 
diff --git a/targets/stage3/stage3.sh b/targets/stage3/stage3.sh
deleted file mode 100755 (executable)
index 6982882..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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/Attic/stage3.sh,v 1.16 2004/10/15 02:46:58 zhen Exp $
-
-case $1 in
-       enter)
-               ${clst_CHROOT} ${clst_chroot_path}
-       ;;
-
-       run)
-               cp ${clst_sharedir}/targets/stage3/stage3-chroot.sh ${clst_chroot_path}/tmp     
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/stage3-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/stage3-chroot.sh
-       ;;
-
-       preclean)
-               cp ${clst_sharedir}/targets/stage3/stage3-preclean-chroot.sh ${clst_chroot_path}/tmp
-               ${clst_CHROOT} ${clst_chroot_path} /tmp/stage3-preclean-chroot.sh || exit 1
-               rm -rf ${clst_chroot_path}/tmp/stage3-preclean-chroot.sh
-       ;;
-
-       clean)
-               exit 0
-       ;;
-       
-       *)
-               exit 1
-       ;;
-
-esac
-exit 0
diff --git a/targets/stage4/stage4-chroot.sh b/targets/stage4/stage4-chroot.sh
new file mode 100755 (executable)
index 0000000..07e81af
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+. /tmp/chroot-functions.sh
+
+check_portage_version
+update_env_settings
+
+setup_myfeatures
+setup_myemergeopts
+
+## setup the environment
+export FEATURES="${clst_myfeatures}"
+export CONFIG_PROTECT="-*"
+
+## START BUILD
+setup_portage
+#turn off auto-use:
+export USE_ORDER="env:pkg:conf:defaults"       
+
+run_emerge "${clst_packages}"
diff --git a/targets/stage4/stage4-controller.sh b/targets/stage4/stage4-controller.sh
new file mode 100755 (executable)
index 0000000..1d5730d
--- /dev/null
@@ -0,0 +1,35 @@
+#!/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.1 2005/04/04 17:48:33 rocket Exp $
+. ${clst_sharedir}/targets/support/functions.sh
+
+
+# Only put commands in this section that you want every target to execute.
+# This is a global default file and will affect every target
+case $1 in
+       enter)
+               ${clst_CHROOT} ${clst_chroot_path}
+       ;;
+
+       build_packages)
+               shift
+               export clst_packages="$*"
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+       ;;
+
+       preclean)
+               exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
+       ;;
+
+       clean)
+               exit 0
+       ;;
+       
+       *)
+               exit 1
+       ;;
+
+esac
+
+exit 0
diff --git a/targets/stage4/stage4-preclean-chroot.sh b/targets/stage4/stage4-preclean-chroot.sh
new file mode 100755 (executable)
index 0000000..c1f0a6c
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+. /tmp/chroot-functions.sh
+#update_env_settings
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh
new file mode 100755 (executable)
index 0000000..b6ab09b
--- /dev/null
@@ -0,0 +1,201 @@
+check_portage_version(){
+       portage_version=`/usr/lib/portage/bin/portageq best_version / sys-apps/portage \
+               | cut -d/ -f2 | cut -d- -f2,3`
+       if [ -n ${portage_version} -a `echo ${portage_version} | cut -d- -f1 | cut -d. -f3` -lt '51' ]
+       then
+               echo "ERROR: Your portage version is too low in your seed stage.  Portage version"
+               echo "2.0.51 or greater is required."
+               exit 1
+       fi
+}
+
+#check_genkernel_version(){
+#      genkernel_version=`/usr/lib/portage/bin/portageq best_version / sys-kernel/genkernel \
+#              | cut -d/ -f2 | cut -d- -f2,3`
+#      if [ -n ${genkernel_version} -a `echo ${genkernel_version} | cut -d- -f1 | cut -d. -f3` -lt '3' ]
+#      then
+#              echo "ERROR: Your genkernel version is too low in your seed stage.  genkernel version"
+#              echo "XXXXXXXXXXXXXXX or greater is required."
+#              exit 1
+#      fi
+#}
+
+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
+       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
+       fi
+}
+
+setup_myemergeopts(){
+       if [ -n "${clst_PKGCACHE}" ]
+       then
+               export clst_myemergeopts="--usepkg --buildpkg --newuse"
+               export bootstrap_opts="-r"
+       fi
+
+       if [ -n "${clst_FETCH}" ]
+       then
+               export clst_myemergeopts="${clst_myemergeopts} -f"
+               export bootstrap_opts="-f"
+       fi
+}
+
+
+setup_portage(){
+    # portage needs to be merged manually with USE="build" set to avoid frying our
+    # make.conf. emerge system could merge it otherwise.
+    if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_portage ]
+    then
+       echo "Portage Autoresume point found not emerging portage"
+    else
+       USE="build" emerge portage && touch /tmp/.clst_portage || exit 1
+    fi
+}
+
+setup_gcc(){
+       if [ -x /usr/bin/gcc-config ]
+       then
+              gcc_current=`gcc-config -c`
+              gcc-config 3 && source /etc/profile
+              gcc-config ${gcc_current} && source /etc/profile
+       fi
+}
+
+update_env_settings(){
+    /usr/sbin/env-update
+    source /etc/profile
+    [ -f /tmp/envscript ] && source /tmp/envscript
+}
+
+die() {
+    echo "$1"
+    exit 1
+}
+
+make_destpath() {
+       if  [ "${1}" = "" ]
+       then
+               export ROOT=/
+       else
+               export ROOT=${1}
+               if [ ! -d ${ROOT} ]
+               then
+                       install -d ${ROOT}
+               fi
+       fi
+       echo "ROOT=${ROOT} emerge ...."
+}
+
+run_emerge() {
+
+    # Sets up the ROOT= parameter
+    # with no options ROOT=/
+    make_destpath ${clst_root_path}
+       
+    if [ -n "${clst_VERBOSE}" ]
+       then
+               emerge ${clst_myemergeopts} -vpt $@ || exit 3
+               echo "Press any key within 15 seconds to pause the build..."
+               read -s -t 15 -n 1
+               if [ $? -eq 0 ]
+               then
+                       echo "Press any key to continue..."
+                       read -s -n 1
+               fi
+       fi
+       emerge ${clst_myemergeopts} $@ || exit 1
+}
+
+# Functions
+# Copy libs of a executable in the chroot
+function copy_libs() {
+
+       # Check if it's a dynamix exec
+
+       ldd ${1} > /dev/null 2>&1 || return
+    
+       for lib in `ldd ${1} | awk '{ print $3 }'`
+       do
+               echo ${lib}
+               if [ -e ${lib} ]
+               then
+                       if [ ! -e ${clst_root_path}/${lib} ]
+                       then
+                               copy_file ${lib}
+                               [ -e "${clst_root_path}/${lib}" ] && strip -R .comment -R .note ${clst_root_path}/${lib} || echo "WARNING : Cannot strip lib ${clst_root_path}/${lib} !"
+                       fi
+               else
+                       echo "WARNING : Some library was not found for ${lib} !"
+               fi
+       done
+
+}
+
+function copy_symlink() {
+
+       STACK=${2}
+       [ "${STACK}" = "" ] && STACK=16 || STACK=$((${STACK} - 1 ))
+
+       if [ ${STACK} -le 0 ] 
+       then
+               echo "WARNING : ${TARGET} : too many levels of symbolic links !"
+               return
+       fi
+
+       [ ! -e ${clst_root_path}/`dirname ${1}` ] && mkdir -p ${clst_root_path}/`dirname ${1}`
+       [ ! -e ${clst_root_path}/${1} ] && cp -vfdp ${1} ${clst_root_path}/${1}
+       
+       TARGET=`readlink -f ${1}`
+       if [ -h ${TARGET} ]
+       then
+               copy_symlink ${TARGET} ${STACK}
+       else
+               copy_file ${TARGET}
+       fi
+    }          
+
+function copy_file() {
+
+       f="${1}"
+
+       if [ ! -e "${f}" ]
+       then
+               echo "WARNING : File not found : ${f}"
+               continue
+       fi
+
+       [ ! -e ${clst_root_path}/`dirname ${f}` ] && mkdir -p ${clst_root_path}/`dirname ${f}`
+       [ ! -e ${clst_root_path}/${f} ] && cp -vfdp ${f} ${clst_root_path}/${f}
+       if [ -x ${f} -a ! -h ${f} ]
+       then
+               copy_libs ${f}
+               strip -R .comment -R .note ${clst_root_path}/${f} > /dev/null 2>&1
+       elif [ -h ${f} ]
+       then
+               copy_symlink ${f}
+       fi
+}
+
+
diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh
new file mode 100755 (executable)
index 0000000..2236bc1
--- /dev/null
@@ -0,0 +1,63 @@
+# Dont forget to update functions.sh  check_looptype
+
+
+create_normal_loop() {
+    export source_path="${clst_chroot_path}"
+    export destination_path="${clst_target_path}"
+    export loopname="livecd.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 
+    #we then have a ready-to-burn ISO tree at $clst_target_path.
+
+    echo "Calculating size of loopback filesystem..."
+    loopsize=`du -ks ${source_path} | cut -f1`
+    [ "${loopsize}" = "0" ] && loopsize=1
+    # Add 4MB for filesystem slop
+    loopsize=`expr ${loopsize} + 4096`
+    echo "Creating loopback file..."
+    dd if=/dev/zero of=${destination_path}/${loopname} bs=1k count=${loopsize} || die "${loopname} creation failure"
+    mke2fs -m 0 -F -q ${destination_path}/${loopname} || die "Couldn't create ext2 filesystem"
+    install -d ${destination_path}/loopmount
+    sync; sync; sleep 3 #try to work around 2.6.0+ loopback bug
+    mount -t ext2 -o loop ${destination_path}/${loopname} ${destination_path}/loopmount || die "Couldn't mount loopback ext2 filesystem"
+    sync; sync; sleep 3 #try to work around 2.6.0+ loopback bug
+    echo "cp -a ${source_path}/* ${destination_path}/loopmount"
+    cp -a ${source_path}/* ${destination_path}/loopmount 
+    [ $? -ne 0 ] && { umount ${destination_path}/${loopname}; die "Couldn't copy files to loopback ext2 filesystem"; }
+    umount ${destination_path}/loopmount || die "Couldn't unmount loopback ext2 filesystem"
+    rm -rf ${destination_path}/loopmount
+    #now, $clst_target_path should contain a proper bootable image for our iso, including
+    #boot loader and loopback filesystem.
+}
+
+
+
+create_zisofs() {
+       rm -rf "${clst_target_path}/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"
+
+}
+
+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)"
+       
+}
+
+create_gcloop() {
+       echo "Creating gcloop..."
+       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"
+       # 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?"
+       
+}
+
diff --git a/targets/support/functions.sh b/targets/support/functions.sh
new file mode 100755 (executable)
index 0000000..6a3201a
--- /dev/null
@@ -0,0 +1,147 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+copy_to_chroot(){
+       local file_name=$(basename ${1})
+       if [ "${2}" != "" ]
+       then
+               echo "copying ${file_name} to ${clst_chroot_path}/${2}"
+               cp -a ${1} ${clst_chroot_path}/${2}
+       else
+               echo "copying ${file_name} to ${clst_chroot_path}/tmp"
+               cp -a ${1} ${clst_chroot_path}/tmp
+       fi
+}
+
+delete_from_chroot(){
+       echo "removing ${clst_chroot_path}/${1} from the chroot"
+       rm -f ${clst_chroot_path}/${1}
+}
+
+exec_in_chroot(){
+# Takes the full path to the source file as its argument
+# copies the file to the /tmp directory of the chroot
+# and executes it.
+               
+       local file_name=$(basename ${1})
+       cp -a ${1} ${clst_chroot_path}/tmp
+       chmod 755 ${clst_chroot_path}/tmp/${file_name}
+       
+       if [ "${2}" != "" ]
+       then
+               chroot_path=${clst_chroot_path}/${2}
+       else
+               chroot_path=${clst_chroot_path}
+       fi
+
+       mkdir -p ${chroot_path}/tmp
+       cp -a ${1} ${chroot_path}/tmp/${file_name}
+       chmod 755 ${chroot_path}/tmp/${file_name}
+       copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh /${2}/tmp
+       echo "Running ${file_name} in chroot ${chroot_path}"
+               ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1
+       
+       rm -f ${chroot_path}/tmp/${file_name}
+       delete_from_chroot /${2}/tmp/chroot-functions.sh
+
+}
+
+#return codes
+die() {
+       echo "$1"
+       exit 1
+}
+
+extract_cdtar() {
+       # Create a filesystem tree for the ISO at
+        # $clst_target_path. We extract the "cdtar" to this directory,
+       # 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}"
+}
+
+extract_kernels() {
+       #$1 = Destination
+       #${clst_target_path}/kernel is often a good choice for ${1}
+
+       # Takes the relative desination dir for the kernel as an arguement
+       # i.e boot or isolinux
+       [ -z "$clst_boot_kernel" ] && die "Required key boot/kernel not defined, exiting"
+       # install the kernels built in kmerge.sh
+       for x in ${clst_boot_kernel}
+       do
+
+               first=${first:-""}
+               kbinary="${clst_chroot_path}/usr/portage/packages/gk_binaries/${x}-kernel-initrd-${clst_version_stamp}.tar.bz2"
+               if [ -z "${first}" ]
+               then
+                       # grab name of first kernel
+                       export first="${x}"
+               fi
+               
+               [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
+               mkdir -p ${1}/
+               tar xjf ${kbinary} -C ${1}/ 
+
+               
+               
+               # change config name from "config-*" to "gentoo", for example
+               #mv ${1}/config-* ${1}/${x}-config
+               rm ${1}/config-* 
+               
+               # change kernel name from "kernel" to "gentoo", for example
+               mv ${1}/kernel-* ${1}/${x}
+
+               # change initrd name from "initrd" to "gentoo.igz", for example
+               if [ -e ${1}/initrd-* ]
+               then 
+                       mv ${1}/initrd-* ${1}/${x}.igz
+               fi
+
+               if [ -e ${1}/initramfs-* ]
+               then 
+                       mv ${1}/initramfs-* ${1}/${x}.igz
+               fi
+       done
+}
+
+extract_modules() {
+       #$1 = Destination
+       #$2 = kname     
+       kbinary="${clst_chroot_path}/usr/portage/packages/gk_binaries/${2}-modules-${clst_version_stamp}.tar.bz2"
+               
+       [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
+       mkdir -p ${1}/
+       tar xjf ${kbinary} -C ${1}/ lib
+}
+
+check_dev_manager(){
+       # figure out what device manager we are using and handle it accordingly
+       if [ "${clst_livecd_devmanager}" == "udev" ]
+       then
+               cmdline_opts="${cmdline_opts} udev nodevfs"
+       else
+               cmdline_opts="${cmdline_opts} noudev devfs"
+       fi
+}
+
+check_filesystem_type(){
+       case ${clst_livecd_cdfstype} in
+               normal)
+               cmdline_opts="${cmdline_opts} looptype=normal loop=/livecd.loop"
+               ;;
+       zisofs)
+               cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs"
+               ;;
+       noloop)
+               ;;
+       gcloop)
+               cmdline_opts="${cmdline_opts} looptype=gcloop loop=/livecd.gcloop"
+               ;;
+       squashfs)
+               cmdline_opts="${cmdline_opts} looptype=squashfs loop=/livecd.squashfs"
+       ;;
+       esac
+}                                                                                                                                                                                                                                              
diff --git a/targets/support/gamecdfs-update.sh b/targets/support/gamecdfs-update.sh
new file mode 100755 (executable)
index 0000000..b456f86
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# we grab our configuration
+source "${clst_gamecd_conf}" || exit 1
+
+# here we replace out game information into several files
+sed -i -e "s:livecd:gamecd:" /etc/hosts
+sed -i -e "s:##GAME_NAME:${GAME_NAME}:" /etc/motd
+
+# here we setup our xinitrc
+echo "exec ${GAME_EXECUTABLE}" > /etc/X11/xinit/xinitrc
+
+# we add spind to default here since we don't want the CD to spin down
+rc-update add spind default
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
new file mode 100755 (executable)
index 0000000..07feef0
--- /dev/null
@@ -0,0 +1,237 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source /tmp/chroot-functions.sh
+
+PKGDIR=/usr/portage/packages/gk_binaries/${clst_kname}/ebuilds
+
+setup_gk_args() {
+       # default genkernel args
+       GK_ARGS="${clst_livecd_gk_mainargs} \
+                        ${clst_kernel_gk_kernargs} \
+                        --no-mountboot \
+                        --no-install \
+                        --kerneldir=/usr/src/linux \
+                        --kernel-config=/var/tmp/${clst_kname}.config \
+                        --modulespackage=/usr/portage/packages/gk_binaries/${clst_kname}-modules-${clst_version_stamp}.tar.bz2 \
+                        --minkernpackage=/usr/portage/packages/gk_binaries/${clst_kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 \
+                        --kerncache=/usr/portage/packages/gk_binaries/${clst_kname}-kerncache-${clst_version_stamp}.tar.bz2 all"
+       # extra genkernel options that we have to test for
+       if [ "${clst_livecd_splash_type}" == "bootsplash" -a -n "${clst_livecd_splash_theme}" ]
+       then
+               GK_ARGS="${GK_ARGS} --bootsplash=${clst_livecd_splash_theme}"
+       fi
+       
+       if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+       then
+               GK_ARGS="${GK_ARGS} --gensplash=${clst_livecd_splash_theme}"
+       fi
+
+       if [ -n "${clst_CCACHE}" ]
+       then
+               GK_ARGS="${GK_ARGS} --kernel-cc=/usr/lib/ccache/bin/gcc --utils-cc=/usr/lib/ccache/bin/gcc"
+       fi
+       
+       if [ "${clst_livecd_devmanager}" == "udev" ]
+       then
+               GK_ARGS="${GK_ARGS} --udev"
+       else
+               GK_ARGS="${GK_ARGS} --no-udev"
+       fi
+}
+
+genkernel_compile(){
+
+       setup_gk_args
+       
+       eval "clst_kernel_postconf=\$clst_boot_kernel_${clst_kname}_postconf"
+       eval "clst_kernel_merge=\$clst_boot_kernel_${clst_kname}_packages"
+       export clst_kernel_postconf
+       export clst_kernel_merge
+       # build with genkernel using the set options
+       # callback and postconf are put here to avoid escaping issues
+       if [ -n "${clst_KERNCACHE}" ]
+       then
+               if [ "$clst_kernel_postconf" != "" \
+                       -a "$clst_kernel_merge" != "" ]
+               then
+                       genkernel --callback="PKGDIR=${PKGDIR} emerge -kb ${clst_kernel_merge}" \
+                               --postconf="PKGDIR=${PKGDIR} emerge -kb ${clst_kernel_postconf}" \
+                                       ${GK_ARGS} || exit 1
+               elif [ "$clst_kernel_merge" != "" ]
+               then
+                       genkernel --callback="PKGDIR=${PKGDIR} emerge -kb ${clst_kernel_merge}" \
+                               ${GK_ARGS} || exit 1
+               elif [ "$clst_kernel_postconf" != "" ]
+               then
+                       genkernel --postconf="PKGDIR=${PKGDIR} emerge -kb ${clst_kernel_postconf}" \
+                               ${GK_ARGS} || exit 1
+               else
+                       echo "genkernel"
+                       genkernel ${GK_ARGS} || exit 1
+               fi
+       else
+               if [ "$clst_kernel_postconf" != "" \
+                       -a "$clst_kernel_merge" != "" ]
+               then
+                       genkernel --callback="emerge ${clst_kernel_merge}" \
+                               --postconf="emerge ${clst_kernel_postconf}" \
+                               ${GK_ARGS} || exit 1
+               elif [ "$clst_kernel_merge" != "" ]
+               then
+                       genkernel --callback="emerge ${clst_kernel_merge}" \
+                               ${GK_ARGS} || exit 1
+               elif [ "$clst_kernel_postconf" != "" ]
+               then
+                       genkernel --postconf="emerge ${clst_kernel_postconf}" \
+                               ${GK_ARGS} || exit 1
+               else
+                       echo "genkernel"
+                       genkernel ${GK_ARGS} || exit 1
+               fi
+       fi
+       md5sum /var/tmp/${clst_kname}.config|awk '{print $1}' > /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
+}
+
+build_kernel() {
+       genkernel_compile
+}
+
+
+
+# Script to build each kernel, kernel-related packages
+/usr/sbin/env-update
+source /etc/profile
+
+setup_myfeatures
+setup_myemergeopts
+
+[ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
+export CONFIG_PROTECT="-*"
+
+#set the timezone for the kernel build
+rm /etc/localtime
+ln -s /usr/share/zoneinfo/UTC /etc/localtime
+
+eval "clst_kernel_use=\$clst_boot_kernel_${clst_kname}_use"
+export USE=$clst_kernel_use
+
+eval "clst_kernel_gk_kernargs=\$clst_boot_kernel_${clst_kname}_gk_kernargs"
+eval "clst_ksource=\$clst_boot_kernel_${clst_kname}_sources"
+
+
+
+# Don't use pkgcache here, as the kernel source may get emerge with different USE variables
+# (and thus different patches enabled/disabled.) Also, there's no real benefit in using the
+# pkgcache for kernel source ebuilds.
+
+USE_MATCH=0 
+if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ]
+then
+
+       STR1=$(for i in `cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
+       STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort)
+       if [ "${STR1}" = "${STR2}" ]
+       then 
+               #echo "USE Flags match"
+               USE_MATCH=1 
+       else
+           if [ -n "${clst_KERNCACHE}" ]
+           then
+               [ -d /usr/portage/packages/gk_binaries/${clst_kname}/ebuilds ] && \
+                       rm -r /usr/portage/packages/gk_binaries/${clst_kname}/ebuilds
+               [ -e /usr/portage/packages/gk_binaries/${clst_kname}/usr/src/linux/.config ] && \
+                       rm /usr/portage/packages/gk_binaries/${clst_kname}/usr/src/linux/.config
+           fi
+       fi
+fi
+
+EXTRAVERSION_MATCH=0
+if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION ]
+then
+       STR1=`cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION`
+       STR2=${clst_kextraversion}
+       if [ "${STR1}" = "${STR2}" ]
+       then 
+               if [ -n "${clst_KERNCACHE}" ]
+               then
+                       #echo "EXTRAVERSION match"
+                       EXTRAVERSION_MATCH=1
+               fi
+
+       fi
+fi
+
+CONFIG_MATCH=0
+if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
+then
+       STR1=`cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
+       STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
+       if [ "${STR1}" = "${STR2}" ]
+       then 
+               if [ -n "${clst_KERNCACHE}" ]
+               then
+                       echo "CONFIG match"
+                       CONFIG_MATCH=1
+               fi
+
+       fi
+fi
+
+if [ "${USE_MATCH}" = "0" -o "${EXTRAVERSION_MATCH}" = "0" -o "${CONFIG_MATCH}" = "0" ]
+then
+       echo "Cleaning up ${clst_kname} kernel install ..."
+       echo "This may take some time ..."
+       if [ -d /usr/portage/packages/gk_binaries/${clst_kname}/ ] 
+       then
+               rm -r /usr/portage/packages/gk_binaries/${clst_kname}/ || exit 1
+       fi
+fi
+
+mkdir -p /usr/portage/packages/gk_binaries/${clst_kname}
+       
+if [ -n "${clst_KERNCACHE}" ]
+then
+       ROOT=/usr/portage/packages/gk_binaries/${clst_kname} PKGDIR=${PKGDIR} USE="${USE} symlink build" emerge -ukb  "${clst_ksource}" || exit 1
+       KERNELVERSION=`/usr/lib/portage/bin/portageq best_visible / "${clst_ksource}"`
+       if [ ! -e /etc/portage/profile/package.provided ]
+       then
+               mkdir -p /etc/portage/profile
+               echo "${KERNELVERSION}" > /etc/portage/profile/package.provided
+       else
+               if ( ! grep -q "^${KERNELVERSION}"  /etc/portage/profile/package.provided ) 
+               then
+                       echo "${KERNELVERSION}" >> /etc/portage/profile/package.provided
+               fi
+       fi
+       [ -d /usr/src/linux ] && rm /usr/src/linux
+       ln -s /usr/portage/packages/gk_binaries/${clst_kname}/usr/src/linux /usr/src/linux
+else
+       USE="${USE} symlink build" emerge "${clst_ksource}" || exit 1
+fi
+
+#if catalyst has set NULL_VALUE, extraversion wasn't specified so we skip this part
+if [ "${EXTRAVERSION_MATCH}" != "1" ]
+then
+    if [ "${clst_kextraversion}" != "NULL_VALUE" ]
+    then
+       echo "Setting extraversion to ${clst_kextraversion}"
+       sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
+    fi
+    echo ${clst_kextraversion} > /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
+fi
+       
+
+build_kernel
+# grep out the kernel version so that we can do our modules magic
+VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
+PAT=`grep ^PATCHLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
+SUB=`grep ^SUBLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
+EXV=`grep ^EXTRAVERSION\ \= /usr/src/linux/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g"`
+clst_fudgeuname=${VER}.${PAT}.${SUB}${EXV}
+
+/sbin/modules-update --assume-kernel=${clst_fudgeuname}
+
+unset USE
+echo ${clst_kernel_use} > /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE
diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh
new file mode 100755 (executable)
index 0000000..f6621e8
--- /dev/null
@@ -0,0 +1,211 @@
+#!/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.1 2005/04/04 17:48:33 rocket Exp $
+
+/usr/sbin/env-update
+source /etc/profile
+
+# allow root logins to the livecd by default
+if [ -e /etc/sshd/sshd_config ]
+then
+       sed -i 's:^#PermitRootLogin\ yes:PermitRootLogin\ yes:' /etc/ssh/sshd_config
+fi
+
+# turn off udev tarball
+sed -i 's:RC_DEVICE_TARBALL="yes":RC_DEVICE_TARBALL="no":' /etc/conf.d/rc
+
+# turn bashlogin shells to actual login shells
+sed -i 's:exec -l /bin/bash:exec -l /bin/bash -l:' /bin/bashlogin
+
+# default programs that we always want to start
+rc-update del iptables default
+rc-update del netmount default
+rc-update add autoconfig default
+rc-update del keymaps
+rc-update del serial
+rc-update del consolefont
+rc-update add modules default
+rc-update add pwgen default
+[ -e /etc/init.d/bootsplash ] && rc-update add bootsplash default
+[ -e /etc/init.d/splash ] && rc-update add splash default
+[ -e /etc/init.d/sysklogd ] && rc-update add sysklogd default
+[ -e /etc/init.d/metalog ] && rc-update add metalog default
+[ -e /etc/init.d/syslog-ng ] && rc-update add syslog-ng default
+[ -e /etc/init.d/alsasound ] && rc-update add alsasound default
+[ -e /etc/init.d/hdparm ] && rc-update add hdparm default
+
+# Comment out current getty settings
+sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab
+
+# Add our own getty settings
+for x in 1 2 3 4 5 6
+do
+       echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty${x} linux" >> /etc/inittab
+done
+
+# perform any rcadd then any rcdel
+if [ -n "${clst_livecd_rcadd}" ] || [ -n "${clst_livecd_rcdel}" ]
+then
+       if [ -n "${clst_livecd_rcadd}" ]
+       then
+               for x in ${clst_livecd_rcadd}
+               do
+                       rc-update add "${x%%:*}" "${x##*:}"
+               done
+       fi
+       
+       if [ -n "${clst_livecd_rcdel}" ]
+       then
+               for x in ${clst_livecd_rcdel}
+               do
+                       rc-update del "${x%%:*}" "${x##*:}"
+               done
+       fi
+fi
+
+# clean up the time and set to GMT
+rm -rf /etc/localtime
+cp /usr/share/zoneinfo/GMT /etc/localtime
+
+# setup the hostname
+echo "livecd" > /etc/hostname
+echo "gentoo" > /etc/dnsdomainname
+#sed -i 's:localhost:livecd.gentoo localhost:' /etc/hosts
+echo "127.0.0.1        livecd.gentoo livecd localhost" > /etc/hosts
+
+# setup sudoers
+sed -i '/NOPASSWD: ALL/ s/^# //' /etc/sudoers
+
+# setup dhcp on all detected ethernet devices
+echo "iface_eth0=\"dhcp\""> /etc/conf.d/net
+echo "iface_eth1=\"dhcp\"" >> /etc/conf.d/net
+echo "iface_eth2=\"dhcp\"" >> /etc/conf.d/net
+echo "iface_eth3=\"dhcp\"" >> /etc/conf.d/net
+echo "iface_eth4=\"dhcp\"" >> /etc/conf.d/net
+
+# setup links for ethernet devices
+cd /etc/init.d
+ln -sf net.eth0 net.eth1
+ln -sf net.eth0 net.eth2
+ln -sf net.eth0 net.eth3
+ln -sf net.eth0 net.eth4
+
+# add this for hwsetup/mkx86config
+mkdir -p /etc/sysconfig
+
+# fstab tweaks
+echo "tmpfs    /                                       tmpfs   defaults        0 0" > /etc/fstab
+echo "tmpfs    /lib/firmware                   tmpfs   defaults        0 0" >> /etc/fstab
+# if /usr/lib/X11/xkb/compiled then make it tmpfs
+if [ -d /usr/lib/X11/xkb/compiled ]
+then
+       echo "tmpfs     /usr/lib/X11/xkb/compiled       tmpfs   defaults        0 0" >> /etc/fstab
+fi
+
+# devfs tweaks
+sed -i '/dev-state/ s:^:#:' /etc/devfsd.conf
+
+# tweak the livecd fstab so that users know not to edit it
+# http://bugs.gentoo.org/show_bug.cgi?id=60887
+mv /etc/fstab /etc/fstab.old
+echo "####################################################" >> /etc/fstab
+echo "## ATTENTION: THIS IS THE FSTAB ON THE LIVECD     ##" >> /etc/fstab     
+echo "## PLEASE EDIT THE FSTAB at /mnt/gentoo/etc/fstab ##" >> /etc/fstab     
+echo "####################################################" >> /etc/fstab
+cat /etc/fstab.old >> /etc/fstab
+rm /etc/fstab.old
+
+# add some helpful aliases
+echo "alias cp='cp -i'" >> /etc/profile
+echo "alias mv='mv -i'" >> /etc/profile
+echo "alias rm='rm -i'" >> /etc/profile
+echo "alias ls='ls --color=auto'" >> /etc/profile
+echo "alias grep='grep --color=auto'" >> /etc/profile
+
+# make sure we have the latest pci and hotplug ids
+if [ -d /usr/share/hwdata ]
+then
+       [ -f /usr/share/hwdata/pci.ids ] && rm -f /usr/share/hwdata/pci.ids
+       [ -f /usr/share/hwdata/usb.ids ] && rm -f /usr/share/hwdata/usb.ids
+       ln -s /usr/share/misc/pci.ids /usr/share/hwdata/pci.ids
+       ln -s /usr/share/misc/usb.ids /usr/share/hwdata/usb.ids
+fi
+
+# setup opengl in /etc (if configured)
+[ -x /usr/sbin/openglify ] && /usr/sbin/openglify
+
+# touch /etc/asound.state if alsa is configured
+[ -d /proc/asound/card0 ] && touch /etc/asound.state
+
+# tweak the motd for gentoo releases 
+if [ "${clst_livecd_type}" = "gentoo-release-universal" ]
+then
+       cat /etc/generic.motd.txt /etc/universal.motd.txt \
+               /etc/minimal.motd.txt > /etc/motd
+       sed -i 's:^##GREETING:Welcome to the Gentoo Linux Universal Installation CD!:' /etc/motd
+fi
+
+if [ "${clst_livecd_type}" = "gentoo-release-minimal" ]
+then
+       cat /etc/generic.motd.txt /etc/minimal.motd.txt > /etc/motd
+       sed -i 's:^##GREETING:Welcome to the Gentoo Linux Minimal Installation CD!:' /etc/motd
+fi
+
+if [ "${clst_livecd_type}" = "gentoo-release-environmental" ]
+then
+       cat /etc/generic.motd.txt /etc/universal.motd.txt \
+               /etc/minimal.motd.txt /etc/environmental.motd.txt > /etc/motd
+       sed -i 's:^##GREETING:Welcome to the Gentoo Linux LiveCD Environment!:' /etc/motd
+fi
+
+if [ "${clst_livecd_type}" = "gentoo-gamecd" ]
+then
+       cat /etc/generic.motd.txt /etc/gamecd.motd.txt > /etc/motd
+       sed -i 's:^##GREETING:Welcome to the Gentoo Linux ##GAME_NAME GameCD!:' /etc/motd
+fi
+
+rm -f /etc/generic.motd.txt /etc/universal.motd.txt /etc/minimal.motd.txt /etc/environmental.motd.txt /etc/gamecd.motd.txt
+
+# setup splash/bootsplash (if called for)
+if [ "${clst_livecd_splash_type}" == "bootsplash" -a -n "${clst_livecd_splash_theme}" ]
+then
+       if [ -d /etc/bootsplash/${clst_livecd_splash_theme} ]
+       then
+               sed -i 's:BOOTSPLASH_THEME=\"gentoo\":BOOTSPLASH_THEME=\"${clst_livecd_splash_theme}\":' /etc/conf.d/bootsplash
+               rm /etc/bootsplash/default
+               ln -s "/etc/bootsplash/${clst_livecd_splash_theme}" /etc/bootsplash/default
+       else
+               echo "Error, cannot setup bootsplash theme ${clst_livecd_splash_theme}"
+               exit 1
+       fi
+
+elif [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+then
+       if [ -d /etc/splash/${clst_livecd_splash_theme} ]
+       then
+               sed -i 's:# SPLASH_THEME="gentoo":SPLASH_THEME=\"${clst_livecd_splash_theme}\":' /etc/conf.d/splash
+               rm /etc/splash/default
+               ln -s /etc/splash/${clst_livecd_splash_theme} /etc/splash/default
+       else
+               echo "Error, cannot setup splash theme ${clst_livecd_splash_theme}"
+               exit 1
+       fi
+fi
+
+# Create firmware directory if it does not exist
+[ ! -d /lib/firmware ] && mkdir -p /lib/firmware
+
+# tar up the firmware so that it does not get clobbered by the livecd mounts
+if [ -n "$(ls /lib/firmware)" ]
+then
+       cd /lib/firmware
+       if [ -n "$(ls /usr/lib/hotplug/firmware)" ]
+       then
+               cp /usr/lib/hotplug/firmware/* /lib/firmware
+       fi
+       tar cvjpf /lib/firmware.tar.bz2 .
+       rm -f /lib/firmware/*
+       mkdir -p /usr/lib/hotplug
+       ln -sf /lib/firmware /usr/lib/hotplug/firmware
+fi
similarity index 55%
rename from targets/stage1/stage1-preclean1-chroot.sh
rename to targets/support/post-kmerge.sh
index ecb2bc957272251b15ce9a454b42bd9729d6d4ad..a89e13e52a9c434d8c95c76f61df014565d7d6eb 100755 (executable)
@@ -1,7 +1,9 @@
 #!/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/Attic/stage1-preclean1-chroot.sh,v 1.4 2004/10/15 02:46:58 zhen Exp $
 
 /usr/sbin/env-update
 source /etc/profile
+
+/sbin/depscan.sh
+find /lib/modules -name modules.dep -exec touch {} \;
diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh
new file mode 100755 (executable)
index 0000000..2a43533
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+/usr/sbin/env-update
+source /etc/profile
+
+
+
+#if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_genkernel -a -e "/usr/bin/genkernel" ]
+#then
+#    echo "Autoresume point found not emerging genkernel"
+#else
+#    emerge --oneshot --nodeps -b -k genkernel && touch /tmp/.clst_genkernel || exit 1
+#fi
+
+CONFIG_PROTECT="-*" USE="livecd" emerge --oneshot --nodeps -u genkernel 
+
+install -d /usr/portage/packages/gk_binaries
+
+sed -i 's/uchi-hcd/uhci-hcd/' /usr/share/genkernel/x86/modules_load
+
+if [ "${clst_livecd_type}" = "gentoo-release-minimal" -o \
+        "${clst_livecd_type}" = "gentoo-release-universal" ]; then
+               sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /'\
+               /usr/share/genkernel/genkernel
+fi
index 3bbe96abb4e8e59207b23af27b8945f839235a33..8fec85a768e20ad0fb2d192cceed6d45f70608a4 100755 (executable)
@@ -1,36 +1,25 @@
 #!/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-chroot.sh,v 1.10 2005/01/28 18:37:23 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/tinderbox/tinderbox-chroot.sh,v 1.11 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
 
-[ -f /tmp/envscript ] && source /tmp/envscript
+update_env_settings
 
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-
-if [ -n "${clst_DISTCC}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
+setup_myfeatures
 
 # setup the environment
 export FEATURES="${clst_myfeatures}"
 export CONFIG_PROTECT="-*"
 
 # START THE BUILD
-USE="build" emerge portage
+setup_portage
+
 #turn off auto-use:
 export USE_ORDER="env:pkg:conf:defaults"       
 #back up pristine system
+
 rsync -avx --exclude "/root/" --exclude "/tmp/" --exclude "/usr/portage/" / /tmp/rsync-bak/ 
 
 for x in ${clst_tinderbox_packages}
diff --git a/targets/tinderbox/tinderbox-controller.sh b/targets/tinderbox/tinderbox-controller.sh
new file mode 100755 (executable)
index 0000000..e75cac5
--- /dev/null
@@ -0,0 +1,30 @@
+#!/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 $
+
+. ${clst_sharedir}/targets/support/functions.sh
+
+case $1 in
+       run)
+               shift
+               exec_in_chroot ${clst_sharedir}/targets/tinderbox/tinderbox-chroot.sh
+       ;;
+
+       preclean)
+               #exec_in_chroot ${clst_sharedir}/targets/grp/tinderbox-preclean-chroot.sh
+               delete_from_chroot /tmp/chroot-functions.sh
+               exit 0
+       ;;
+
+       clean)
+               exit 0
+       ;;
+
+       *)
+               exit 1
+       ;;
+       
+esac
+
+exit 0
index baf300d19abab2ef2ed13a1fc05d0304dd390cc0..af84b091468e005b271a76d1ce0e96c5383270d2 100755 (executable)
@@ -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-preclean-chroot.sh,v 1.4 2004/10/15 02:46:58 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/tinderbox/tinderbox-preclean-chroot.sh,v 1.5 2005/04/04 17:48:33 rocket Exp $
 
-/usr/sbin/env-update
-source /etc/profile
+. /tmp/chroot-functions.sh
+update_env_settings
diff --git a/targets/tinderbox/tinderbox.sh b/targets/tinderbox/tinderbox.sh
deleted file mode 100755 (executable)
index d49cd74..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/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/Attic/tinderbox.sh,v 1.10 2004/10/15 02:46:58 zhen Exp $
-
-case $1 in
-       run)
-               shift
-
-               cp ${clst_sharedir}/targets/tinderbox/tinderbox-chroot.sh ${clst_chroot_path}/tmp
-               clst_tinderbox_packages="$*" ${clst_CHROOT} ${clst_chroot_path} /tmp/tinderbox-chroot.sh || exit 1
-               rm -f ${clst_chroot_path}/tmp/tinderbox-chroot.sh
-       ;;
-
-       preclean)
-        #cp ${clst_sharedir}/targets/grp/tinderbox-preclean-chroot.sh ${clst_chroot_path}/tmp
-        #${clst_CHROOT} ${clst_chroot_path} /tmp/tinderbox-preclean-chroot.sh || exit 1
-        #rm -f ${clst_chroot_path}/tmp/tinderbox-preclean-chroot.sh
-               exit 0
-    ;;
-
-    clean)
-        exit 0
-    ;;
-
-    *)
-        exit 1
-    ;;
-       
-esac
-exit 0