From d2bcc216c789d2eaec016339045764df72ac48b7 Mon Sep 17 00:00:00 2001 From: Daniel Robbins Date: Sun, 11 Jan 2004 23:42:56 +0000 Subject: [PATCH] runscript now runs in livecd-stage2 and the entire genkernel creation stuff is now in the runscript git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@134 d1e1f19c-881f-0410-ab34-b69fee027534 --- .../runscript/x86-isolinux-loop-example.sh | 56 +++++++++++++++---- modules/targets.py | 12 ++-- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/examples/livecd/runscript/x86-isolinux-loop-example.sh b/examples/livecd/runscript/x86-isolinux-loop-example.sh index 75b50e5b..9c285fc8 100644 --- a/examples/livecd/runscript/x86-isolinux-loop-example.sh +++ b/examples/livecd/runscript/x86-isolinux-loop-example.sh @@ -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 ...". 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/.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 diff --git a/modules/targets.py b/modules/targets.py index cd2687b1..c5913fe3 100644 --- a/modules/targets.py +++ b/modules/targets.py @@ -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: -- 2.26.2