runscript now runs in livecd-stage2 and the entire genkernel creation stuff is
authorDaniel Robbins <drobbins@gentoo.org>
Sun, 11 Jan 2004 23:42:56 +0000 (23:42 +0000)
committerDaniel Robbins <drobbins@gentoo.org>
Sun, 11 Jan 2004 23:42:56 +0000 (23:42 +0000)
now in the runscript

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@134 d1e1f19c-881f-0410-ab34-b69fee027534

examples/livecd/runscript/x86-isolinux-loop-example.sh
modules/targets.py

index 75b50e5bde5939fd6de386f5dcb7aaf581ffe860..9c285fc86653153b24f621e11dfcffc24b4f55c5 100644 (file)
@@ -1,32 +1,66 @@
 # Copyright 1999-2004 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/x86-isolinux-loop-example.sh,v 1.4 2004/01/11 23:28:47 drobbins Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/x86-isolinux-loop-example.sh,v 1.5 2004/01/11 23:42:56 drobbins Exp $
 
 die() {
        echo "$1"
        exit 1
 }
 
-#The order that catalyst does things for livecd-stage3 is as follows:
-#
-# runscript: run
-# runscript: preclean (bind mounts still mounted)
-# catalyst: do livecd/unmerge (bind mounts still mounted)
+#Here is how the livecd runscript works:
+
+# livecd-stage2 begins. The "run" part of this script is executed, which is used to build
+# kernels and copy any needed binaries to /tmp/binaries. The arguments passed to this 
+# runscript are "run <numkernels> <kname1> <ksource1> <kname2> <ksource2> ...". For example,
+# the args might be "run 2 gentoo =sys-kernel/gentoo-dev-sources-2.6.1 smp 
+# =sys-kernel/foo-sources-2.4.24". The kernel configs for each kernel can be found already
+# copied to /var/tmp/<kname>.config.
+
+# livecd-stage2 ends.
+# livecd-stage3 begins.
+
+# runscript: preclean executes (with bind mounts still mounted)
+# catalyst: do livecd/unmerge (with bind mounts still mounted)
 # catalyst: bind mounts unmounted
 # catalyst: do livecd/empty
 # catalyst: do livecd/delete
 # runscript: livecd/clean
 # runscript: cdroot_setup
 
+# livecd-stage3 completes.
+
 case $1 in
 run)
-       #For doing things inside the chroot before the "preclean". Normally, "preclean"
-       #should be used, or steps should be performed in the livecd-stage2 stage.
-       $clst_CHROOT $clst_chroot_path /bin/bash << EOF
-       echo "meep"
+       shift
+       numkernels="$1"
+       shift
+       count=0
+       while [ $count -lt $numkernels ]
+       do
+               clst_kname="$1"
+               shift
+               clst_ksource="$1"
+               shift
+               $clst_CHROOT $clst_chroot_path /bin/bash << EOF
+env-update
+source /etc/profile
+export CONFIG_PROTECT="-*"
+emerge genkernel
+rm -f /usr/src/linux
+export USE="-* build"
+if [ -n "${clst_PKGCACHE}" ]
+then
+       emerge --usepkg --buildpkg --noreplace $clst_ksource || exit 1
+else
+       emerge --noreplace $clst_ksource || exit 1
+fi
+genkernel --no-bootsplash --kerneldir=/usr/src/linux --kernel-config=/var/tmp/$clst_kname.config --minkernpackage=/tmp/binaries/$clst_kname.tar.bz2 all || exit 1
+emerge -C genkernel $clst_ksource
 EOF
        [ $? -ne 0 ] && exit 1
-;;
+       count=$(( $count + 1 ))
+       done
+       ;;
 preclean)
        #preclean runs with bind mounts active -- for running any commands inside chroot.
        #The chroot environment has not been trimmed in any way, so you still have a full
index cd2687b1ac7c3c8e53d1e6a865600fc9974add0c..c5913fe3f9c23dd325cb097146b08229028007fd 100644 (file)
@@ -425,7 +425,7 @@ class livecd_stage1_target(generic_stage_target):
 
 class livecd_stage2_target(generic_stage_target):
        def __init__(self,spec,addlargs):
-               self.required_values=["boot/kernel"]
+               self.required_values=["boot/kernel","livecd/runscript"]
                if not addlargs.has_key("boot/kernel"):
                        raise CatalystError, "Required value boot/kernel not specified."
                if type(addlargs["boot/kernel"]) == types.StringType:
@@ -453,10 +453,10 @@ class livecd_stage2_target(generic_stage_target):
                                self.unbind()
                                raise CatalystError, "Couldn't copy kernel config: "+self.settings["boot/kernel/"+x+"/config"]
                try:
-                       cmd("/bin/bash "+self.settings["sharedir"]+"/targets/livecd-stage2/livecd-stage2.sh run "+args)
+                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" run "+args,"runscript failed")
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"GRP build aborting due to error."
+                       raise CatalystError,"livecd-stage2 build aborting due to error."
 
 class livecd_stage3_target(generic_stage_target):
        def __init__(self,spec,addlargs):
@@ -483,11 +483,7 @@ class livecd_stage3_target(generic_stage_target):
                        cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/unmerge.sh "+myunmerge,"unmerge script failed.")
 
        def run_local(self):
-               try:
-                       cmd("/bin/bash "+self.settings["livecd/runscript"]+" run","runscript failed")
-               except CatalystError:
-                       self.unbind()
-                       raise CatalystError,"Stage build aborting due to error."
+               pass
 
        def preclean(self):
                try: