From: Daniel Robbins Date: Wed, 21 Jan 2004 05:48:24 +0000 (+0000) Subject: x86 livecd working X-Git-Tag: CATALYST_1_0_1~52 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e02976da05aa20cb60c93176bc0a2217deb3d354;p=catalyst.git x86 livecd working git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@188 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/examples/livecd/runscript/default-runscript.sh b/examples/livecd/runscript/default-runscript.sh index 435daaa3..8997a869 100644 --- a/examples/livecd/runscript/default-runscript.sh +++ b/examples/livecd/runscript/default-runscript.sh @@ -1,15 +1,12 @@ # 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/default-runscript.sh,v 1.8 2004/01/20 22:24:39 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/default-runscript.sh,v 1.9 2004/01/21 05:48:24 drobbins Exp $ #return codes to be used by archscript -RETURN_GOOD=0 -RETURN_BAD=1 -RETURN_CONTINUE=2 die() { echo "$1" - exit $RETURN_BAD + exit 1 } case $clst_livecd_cdfstype in @@ -23,14 +20,8 @@ noloop) cmdline_opts="looptype=noloop" ;; esac -export cmdline_opts -/bin/bash ${clst_livecd_archscript} $* -RET="$?" - -[ "${RET}" = "0" ] && exit 0 -[ "${RET}" = "1" ] && exit 1 -# if $RET is 2, then we continue and run the runscript portion as well. +source ${clst_livecd_archscript} create_normal_loop() { @@ -64,7 +55,6 @@ create_normal_loop() rm -rf $clst_cdroot_path/loopmount #now, $clst_cdroot_path should contain a proper bootable image for our iso, including #boot loader and loopback filesystem. - return $RETURN_GOOD } create_zisofs() @@ -72,14 +62,12 @@ create_zisofs() rm -rf ${clst_cdroot_path}/zisofs > /dev/null 2>&1 echo "Creating zisofs..." mkzftree -z 9 -p2 ${clst_chroot_path} ${clst_cdroot_path}/zisofs || die "Could not run mkzftree, did you emerge zisofs" - return $RETURN_GOOD } create_noloop() { echo "Copying files for image (no loop)..." cp -a $clst_chroot_path/* $clst_cdroot_path || die "Could not copy files to image (no loop)" - return $RETURN_GOOD } case $1 in @@ -88,7 +76,6 @@ case $1 in numkernels="$1" shift count=0 - install -d /tmp/binaries while [ $count -lt $numkernels ] do clst_kname="$1" @@ -100,6 +87,7 @@ case $1 in env-update source /etc/profile export CONFIG_PROTECT="-*" + install -d /tmp/binaries emerge genkernel rm -f /usr/src/linux export USE="-* build" @@ -113,10 +101,9 @@ case $1 in emerge -C genkernel $clst_ksource # END OF SCRIPT TO BUILD EACH KERNEL EOF - [ $? -ne 0 ] && exit $RETURN_BAD + [ $? -ne 0 ] && exit 1 count=$(( $count + 1 )) done - exit $RETURN_GOOD ;; preclean) @@ -140,18 +127,14 @@ EOF sed -i -e '/dev-state/ s/^/#/' /etc/devfsd.conf # END OF SCRIPT TO UPDATE FILESYSTEM EOF - [ $? -ne 0 ] && exit $RETURN_BAD - - exit $RETURN_GOOD + [ $? -ne 0 ] && exit 1 ;; clean) find $clst_chroot_path/usr/lib -iname "*.pyc" -exec rm -f {} \; - exit $RETURN_GOOD ;; bootloader) - exit $RETURN_GOOD ;; cdfs) @@ -173,7 +156,6 @@ EOF ;; iso) - exit $RETURN_GOOD ;; esac -exit $RETURN_GOOD +exit 0 diff --git a/examples/livecd/runscript/x86-archscript.sh b/examples/livecd/runscript/x86-archscript.sh index 9a47fb18..d1ae1dbe 100644 --- a/examples/livecd/runscript/x86-archscript.sh +++ b/examples/livecd/runscript/x86-archscript.sh @@ -1,18 +1,15 @@ # 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-archscript.sh,v 1.2 2004/01/20 22:24:39 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/x86-archscript.sh,v 1.3 2004/01/21 05:48:24 drobbins Exp $ case $1 in kernel) - exit $RETURN_CONTINUE ;; - + preclean) - exit $RETURN_CONTINUE ;; clean) - exit $RETURN_CONTINUE ;; bootloader) @@ -26,11 +23,7 @@ case $1 in cdtar=$clst_livecd_cdtar [ "$cdtar" = "" ] && die "No livecd/cdtar specified (required)" tar xjpvf $cdtar -C $clst_cdroot_path || die "Couldn't extract cdtar $cdtar" - if [ "$clst_boot_kernel" = "" ] - then - echo "No boot/kernel setting defined, exiting." - exit 1 - fi + [ "$clst_boot_kernel" = "" ] && die "No boot/kernel setting defined, exiting." first="" for x in $clst_boot_kernel do @@ -39,12 +32,8 @@ case $1 in #grab name of first kernel first="$x" fi - if [ ! -e "/tmp/binaries/$x.tar.bz2" ] - then - echo "Can't find kernel tarball at /tmp/binaries/$x.tar.bz2" - exit 1 - fi - tar xjvf /tmp/binaries/$x.tar.bz2 -C $clst_cdroot_path/isolinux + [ ! -e "$clst_chroot_path/tmp/binaries/$x.tar.bz2" ] && die "Can't find kernel tarball at $clst_chroot_path/tmp/binaries/$x.tar.bz2" + tar xjvf $clst_chroot_path/tmp/binaries/$x.tar.bz2 -C $clst_cdroot_path/isolinux #change kernel name from "kernel" to "gentoo", for example mv $clst_cdroot_path/isolinux/kernel $clst_cdroot_path/isolinux/$x #change initrd name from "initrd" to "gentoo.igz", for example @@ -68,28 +57,23 @@ case $1 in echo >> $icfg echo "label $x" >> $icfg echo " kernel $x" >> $icfg - echo " append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${loop_opts} cdroot vga=0x317 splash=silent" >> $icfg + echo " append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} 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 ${loop_opts} cdroot" >> $icfg + echo " append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot" >> $icfg echo >> $icfg echo " ${x}-nofb" >> $kmsg done - exit $RETURN_CONTINUE ;; cdfs) - echo "no generic process for x86, continuing" - exit $RETURN_CONTINUE ;; iso) #this is for the livecd-final target, and calls the proper command to build the iso file mkisofs -J -R -l -o ${clst_iso_path} -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table $clst_cdroot_path - exit $RETURN_GOOD ;; esac -exit $RETURN_CONTINUE diff --git a/modules/targets.py b/modules/targets.py index 412b1643..d30c863a 100644 --- a/modules/targets.py +++ b/modules/targets.py @@ -218,7 +218,7 @@ class generic_stage_target(generic_target): for x in cleanables: print "Cleaning chroot: "+x+"..." cmd("rm -rf "+destpath+x,"Couldn't clean "+x) - if self.settings["target"]=="livecd-stage3": + if self.settings["target"]=="livecd-stage2": if self.settings.has_key("livecd/empty"): if type(self.settings["livecd/empty"])==types.StringType: self.settings["livecd/empty"]=[self.settings["livecd/empty"]] @@ -241,7 +241,7 @@ class generic_stage_target(generic_target): #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) - if self.settings["target"]!="livecd-stage3": + if self.settings["target"]!="livecd-stage2": cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/"+self.settings["target"]+".sh clean","clean script failed.") def preclean(self): @@ -423,10 +423,10 @@ class livecd_stage2_target(generic_stage_target): self.valid_values=self.required_values[:] self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm","livecd/unmerge"]) generic_stage_target.__init__(self,spec,addlargs) - if self.settings.has_key("livecd/cdtar"): - if not os.path.exists(self.settings["livecd/cdtar"]): - raise CatalystError, "Cannot locate specified livecd/cdtar: "+self.settings["livecd/cdtar"] - for myscript in ["livecd/archscript","livecd/runscript"]: + for myscript in ["livecd/cdtar","livecd/archscript","livecd/runscript"]: + if not self.settings.has_key(myscript): + #cdtar is optional, so we don't assume the variable is defined. + pass if self.settings[myscript][0]=="/": if not os.path.exists(self.settings[myscript]): raise CatalystError, "Cannot locate specified "+myscript+": "+self.settings[myscript] @@ -451,13 +451,16 @@ class livecd_stage2_target(generic_stage_target): except CatalystError: self.unbind() raise - def setupfs(self): + + def clean(self): + generic_stage_target.clean(self) try: - cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","cdfs runscript failed.") + 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.") @@ -465,29 +468,17 @@ class livecd_stage2_target(generic_stage_target): self.unbind() raise - def clean(self): - try: - cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean","clean runscript failed.") - except: - self.unbind() - raise - def cdroot_setup(self): - if os.path.exists(self.settings["cdroot_path"]): - print "cleaning previous livecd-stage3 build" - cmd("rm -rf "+self.settings["cdroot_path"],"Could not remove existing directory: "+self.settings["cdroot_path"]) - - print "creating livecd-stage3 cdroot" - os.makedirs(self.settings["cdroot_path"]) - - cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader","bootloader runscript failed.") cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","cdfs runscript failed.") print "livecd-stage3: complete!" def run_local(self): - pass - -def run_local(self): + #first clean up any existing cdroot stuff + if os.path.exists(self.settings["cdroot_path"]): + print "cleaning previous livecd-stage2 build" + cmd("rm -rf "+self.settings["cdroot_path"],"Could not remove existing directory: "+self.settings["cdroot_path"]) + os.makedirs(self.settings["cdroot_path"]) + #now, start building the kernel mynames=self.settings["boot/kernel"] if type(mynames)==types.StringType: mynames=[mynames] @@ -505,6 +496,7 @@ def run_local(self): raise CatalystError, "Couldn't copy kernel config: "+self.settings["boot/kernel/"+x+"/config"] try: cmd("/bin/bash "+self.settings["livecd/runscript"]+" kernel "+list_bashify(args),"runscript kernel build failed") + cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader","bootloader runscript failed.") except CatalystError: self.unbind() raise CatalystError,"livecd-stage2 build aborting due to error."