From 96a631814dbb6e3e54deb375f7b3db391a3abe6e Mon Sep 17 00:00:00 2001 From: Daniel Robbins Date: Tue, 20 Jan 2004 22:24:39 +0000 Subject: [PATCH] massive changes to livecd building. there are likely bugs. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@185 d1e1f19c-881f-0410-ab34-b69fee027534 --- .../amd64/amd64-livecd-stage1-20031222.spec | 2 + .../amd64/amd64-livecd-stage2-20031222.spec | 46 ++++- .../amd64/amd64-livecd-stage3-20031222.spec | 50 ----- .../livecd/runscript/default-runscript.sh | 123 +++---------- .../livecd/runscript/sparc64-archscript.sh | 55 +----- examples/livecd/runscript/x86-archscript.sh | 46 ++--- .../runscript/x86-isolinux-loop-example.sh | 174 ------------------ .../sparc64-livecd-stage1-20040111.spec | 1 + .../sparc64-livecd-stage2-20040111.spec | 43 ++++- .../sparc64-livecd-stage3-20040111.spec | 52 ------ .../x86/x86-livecd-stage1-20040114.spec | 1 + .../x86/x86-livecd-stage2-20040114.spec | 41 +++++ .../x86/x86-livecd-stage3-20040114.spec | 52 ------ modules/targets.py | 115 +++++------- 14 files changed, 227 insertions(+), 574 deletions(-) delete mode 100644 examples/livecd/amd64/amd64-livecd-stage3-20031222.spec delete mode 100644 examples/livecd/runscript/x86-isolinux-loop-example.sh delete mode 100644 examples/livecd/sparc64/sparc64-livecd-stage3-20040111.spec delete mode 100644 examples/livecd/x86/x86-livecd-stage3-20040114.spec diff --git a/examples/livecd/amd64/amd64-livecd-stage1-20031222.spec b/examples/livecd/amd64/amd64-livecd-stage1-20031222.spec index 496394c4..51685530 100644 --- a/examples/livecd/amd64/amd64-livecd-stage1-20031222.spec +++ b/examples/livecd/amd64/amd64-livecd-stage1-20031222.spec @@ -6,7 +6,9 @@ rel_version: 1.4 snapshot: 20031222 source_subpath: default-amd64-1.4/stage3-amd64-20031221 livecd/packages: + >=sys-apps/baselayout-1.8.6.12-r4 irssi livecd/use: -X -gtk + livecd diff --git a/examples/livecd/amd64/amd64-livecd-stage2-20031222.spec b/examples/livecd/amd64/amd64-livecd-stage2-20031222.spec index d00f1655..b560ecb2 100644 --- a/examples/livecd/amd64/amd64-livecd-stage2-20031222.spec +++ b/examples/livecd/amd64/amd64-livecd-stage2-20031222.spec @@ -8,5 +8,47 @@ source_subpath: default-amd64-1.4/livecd-stage1-amd64-20031222 boot/kernel: gentoo boot/kernel/gentoo/sources: =sys-kernel/gentoo-dev-sources-2.6.0 boot/kernel/gentoo/config: /home/drobbins/cvs/gentoo/src/catalyst/kconfig/config-2.6.0-amd64 -livecd/runscript: /home/drobbins/cvs/gentoo/src/catalyst/examples/x86-livecd-stage3-runscript.sh - +livecd/cdfstype: zisofs +livecd/cdtar: /home/drobbins/cvs/gentoo/src/catalyst/examples/isolinux-2.08-cdtar.tar.bz2 +livecd/runscript: /home/drobbins/cvs/gentoo/src/catalyst/examples/runscript.sh +livecd/archscript: /home/drobbins/cvs/gentoo/src/catalyst/examples/x86-archscript.sh +livecd/unmerge: + autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages + sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl +livecd/empty: + /var/tmp + /var/cache + /var/db + /var/empty + /var/cache + /var/lock + /tmp + /usr/portage + /usr/share/man + /usr/share/info + /usr/share/unimaps + /usr/include + /usr/share/zoneinfo + /usr/share/dict + /usr/share/doc + /usr/share/ss + /usr/share/state + /usr/share/texinfo + /usr/lib/python2.2 + /usr/lib/portage + /usr/share/gettext + /usr/share/i18n + /usr/share/rfc + /usr/X11R6/man + /usr/X11R6/include + /usr/X11R6/lib/X11/config + /usr/X11R6/lib/X11/etc + /usr/X11R6/lib/X11/doc + /usr/src + /usr/share/doc + /usr/share/man +livecd/rm: + /lib/*.a + /usr/lib/*.a + /usr/lib/gcc-lib/*/*/libgcj* + /usr/X11R6/lib/*.a diff --git a/examples/livecd/amd64/amd64-livecd-stage3-20031222.spec b/examples/livecd/amd64/amd64-livecd-stage3-20031222.spec deleted file mode 100644 index 4453327f..00000000 --- a/examples/livecd/amd64/amd64-livecd-stage3-20031222.spec +++ /dev/null @@ -1,50 +0,0 @@ -subarch: amd64 -version_stamp: 20031222 -target: livecd-stage3 -rel_type: default -rel_version: 1.4 -snapshot: 20031222 -source_subpath: default-amd64-1.4/livecd-stage2-amd64-20031222 -boot/kernel: gentoo -livecd/cdtar: /home/drobbins/cvs/gentoo/src/catalyst/examples/isolinux-2.08-cdtar.tar.bz2 -livecd/runscript: /home/drobbins/cvs/gentoo/src/catalyst/examples/x86-livecd-stage3-runscript.sh -livecd/unmerge: - autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages - sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl -livecd/empty: - /var/tmp - /var/cache - /var/db - /var/empty - /var/cache - /var/lock - /tmp - /usr/portage - /usr/share/man - /usr/share/info - /usr/share/unimaps - /usr/include - /usr/share/zoneinfo - /usr/share/dict - /usr/share/doc - /usr/share/ss - /usr/share/state - /usr/share/texinfo - /usr/lib/python2.2 - /usr/lib/portage - /usr/share/gettext - /usr/share/i18n - /usr/share/rfc - /usr/X11R6/man - /usr/X11R6/include - /usr/X11R6/lib/X11/config - /usr/X11R6/lib/X11/etc - /usr/X11R6/lib/X11/doc - /usr/src - /usr/share/doc - /usr/share/man -livecd/rm: - /lib/*.a - /usr/lib/*.a - /usr/lib/gcc-lib/*/*/libgcj* - /usr/X11R6/lib/*.a diff --git a/examples/livecd/runscript/default-runscript.sh b/examples/livecd/runscript/default-runscript.sh index 54de337c..435daaa3 100644 --- a/examples/livecd/runscript/default-runscript.sh +++ b/examples/livecd/runscript/default-runscript.sh @@ -1,12 +1,10 @@ # 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.7 2004/01/18 21:24:28 brad_mssw Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/default-runscript.sh,v 1.8 2004/01/20 22:24:39 drobbins Exp $ -# Section has been handled, do not execute additional scripts +#return codes to be used by archscript RETURN_GOOD=0 -# An error has occurred RETURN_BAD=1 -# Should continue RETURN_CONTINUE=2 die() { @@ -14,71 +12,25 @@ die() { exit $RETURN_BAD } -#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. -# Set default looptype to zisofs - -if [ "${LOOPTYPE}" == "" ] -then - LOOPTYPE="zisofs" -fi - -export LOOPTYPE - -if [ "${LOOPTYPE}" = "zisofs" ] -then - loop_opts="looptype=zisofs loop=/zisofs" -elif [ "${LOOPTYPE}" = "normal" ] -then - loop_opts="looptype=normal loop=/livecd.loop" -elif [ "${LOOPTYPE}" = "noloop" ] -then - # no loop at all wanted, just a raw copy on a cd - loop_opts="looptype=noloop" -fi -# loop options to be passed to the kernel -export loop_opts - -if [ "${ARCH_RUNSCRIPT}" == "" -o ! -f "${ARCH_RUNSCRIPT}" ] -then - die "ARCH_RUNSCRIPT NOT DEFINED OR NOT FOUND" -fi - -/bin/bash ${ARCH_RUNSCRIPT} $* +case $clst_livecd_cdfstype in +zisofs) + cmdline_opts="looptype=zisofs loop=/zisofs" + ;; +normal) + cmdline_opts="looptype=normal loop=/livecd.loop" + ;; +noloop) + cmdline_opts="looptype=noloop" + ;; +esac +export cmdline_opts + +/bin/bash ${clst_livecd_archscript} $* RET="$?" -if [ "${RET}" != "${RETURN_CONTINUE}" ] -then - if [ "${RET}" -eq "0" ] - then - echo "${ARCH_RUNSCRIPT} finished successfully, don\'t have to run default commands" - exit 0 - else - echo "${ARCH_RUNSCRIPT} errored out, not continuing" - exit 1 - fi -else - echo "${ARCH_RUNSCRIPT} finished successfully, running default commands" -fi +[ "${RET}" = "0" ] && exit 0 +[ "${RET}" = "1" ] && exit 1 +# if $RET is 2, then we continue and run the runscript portion as well. create_normal_loop() { @@ -131,11 +83,12 @@ create_noloop() } case $1 in - kernbuild) + kernel) shift numkernels="$1" shift count=0 + install -d /tmp/binaries while [ $count -lt $numkernels ] do clst_kname="$1" @@ -166,7 +119,7 @@ EOF exit $RETURN_GOOD ;; - setupfs) + preclean) $clst_CHROOT $clst_chroot_path /bin/bash << EOF # SCRIPT TO UPDATE FILESYSTEM SPECIFIC FOR LIVECD. THIS GETS EXECUTED IN CHROOT env-update @@ -192,45 +145,26 @@ EOF exit $RETURN_GOOD ;; - 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 - #environment. - # This below doesn't seem to get honored - #$clst_CHROOT $clst_chroot_path /bin/bash << EOF - # echo "CDBOOT=1" >> /etc/rc.conf - #EOF - #[ $? -ne 0 ] && exit $RETURN_BAD - exit $RETURN_GOOD - ;; - clean) - #livecd/unmerge, bind-unmount, and livecd/{empty,delete,prune} - #have already executed at this point. You now have the opportunity to perform - #any additional cleaning steps that may be required. - find $clst_chroot_path/usr/lib -iname "*.pyc" -exec rm -f {} \; exit $RETURN_GOOD ;; - setup_bootloader) - #Time to create a filesystem tree for the ISO at $clst_cdroot_path. - #We extract the "cdtar" to this directory, which will normally contains a pre-built - #binary boot-loader/filesystem skeleton for the ISO. + bootloader) exit $RETURN_GOOD ;; - loop) + cdfs) loopret=1 - if [ "${LOOPTYPE}" = "normal" ] + if [ "${clst_livecd_cdfstype}" = "normal" ] then create_normal_loop loopret=$? - elif [ "${LOOPTYPE}" = "zisofs" ] + elif [ "${clst_livecd_cdfstype}" = "zisofs" ] then create_zisofs loopret=$? - elif [ "${LOOPTYPE}" = "noloop" ] + elif [ "${clst_livecd_cdfstype}" = "noloop" ] then create_noloop loopret=$? @@ -238,8 +172,7 @@ EOF exit $loopret ;; - iso_create) - #this is for the livecd-final target, and calls the proper command to build the iso file + iso) exit $RETURN_GOOD ;; esac diff --git a/examples/livecd/runscript/sparc64-archscript.sh b/examples/livecd/runscript/sparc64-archscript.sh index 49feeca2..52d12423 100644 --- a/examples/livecd/runscript/sparc64-archscript.sh +++ b/examples/livecd/runscript/sparc64-archscript.sh @@ -1,55 +1,21 @@ # 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/sparc64-archscript.sh,v 1.1 2004/01/20 20:01:41 drobbins Exp $ - -# Section has been handled, do not execute additional scripts -RETURN_GOOD=0 -# An error has occurred -RETURN_BAD=1 -# This script executed properly, continue with additional scripts -RETURN_CONTINUE=2 - -die() { - echo "$1" - exit $RETURN_BAD -} +# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/sparc64-archscript.sh,v 1.2 2004/01/20 22:24:39 drobbins Exp $ case $1 in - kernbuild) - echo "no generic process for sparc64, continuing" - exit $RETURN_CONTINUE - ;; - - setupfs) - echo "no generic process for sparc64, continuing" + kernel) exit $RETURN_CONTINUE ;; preclean) - echo "no generic process for sparc64, continuing" - exit 2 + exit $RETURN_CONTINUE ;; clean) - echo "no generic process for sparc64, continuing" exit $RETURN_CONTINUE ;; - setup_bootloader) - # LOOPTYPE should be exported from default runscript, we use - # it to determine kernel args - if [ "${LOOPTYPE}" = "zisofs" ] - then - loop_opts="looptype=zisofs loop=/zisofs" - elif [ "${LOOPTYPE}" = "normal" ] - then - loop_opts="looptype=normal loop=/livecd.loop" - elif [ "${LOOPTYPE}" = "noloop" ] - then - # no loop at all wanted, just a raw copy on a cd - loop_opts="looptype=noloop" - fi - + bootloader) # Time to create a filesystem tree for the ISO at # $clst_cdroot_path. We extract the "cdtar" to this directory, # which will normally contains a pre-built binary @@ -72,12 +38,12 @@ case $1 in #grab name of first kernel first="$x" fi - if [ ! -e "$clst_binaries_source_path/$x.tar.bz2" ] + if [ ! -e "/tmp/binaries/$x.tar.bz2" ] then - echo "Can't find kernel tarball at $clst_binaries_source_path/$x.tar.bz2" + echo "Can't find kernel tarball at /tmp/binaries/$x.tar.bz2" exit 1 fi - tar xjvf $clst_binaries_source_path/$x.tar.bz2 -C \ + tar xjvf /tmp/binaries/$x.tar.bz2 -C \ $clst_cdroot_path/boot # change kernel name from "kernel" to "gentoo", for # example @@ -103,7 +69,7 @@ case $1 in echo >> $icfg echo "image=\"/boot/$x\"" >> $scfg echo -e "\tlabel=\"$x\"" >> $scfg - echo -e "\tappend=\"initrd=/boot/$x.igz root=/dev/ram0 init=/linuxrc ${loop_opts} cdroot\"" >> $scfg + echo -e "\tappend=\"initrd=/boot/$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> $scfg done @@ -112,12 +78,11 @@ case $1 in exit $RETURN_CONTINUE ;; - loop) - echo "no generic process for sparc64, continuing" + cdfs) exit $RETURN_CONTINUE ;; - iso_create) + 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} -G /boot/isofs.b -B ... \ diff --git a/examples/livecd/runscript/x86-archscript.sh b/examples/livecd/runscript/x86-archscript.sh index b41e883b..9a47fb18 100644 --- a/examples/livecd/runscript/x86-archscript.sh +++ b/examples/livecd/runscript/x86-archscript.sh @@ -1,47 +1,27 @@ # 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.1 2004/01/20 20:01:41 drobbins Exp $ - -# Section has been handled, do not execute additional scripts -RETURN_GOOD=0 -# An error has occurred -RETURN_BAD=1 -# This script executed properly, continue with additional scripts -RETURN_CONTINUE=2 - -die() { - echo "$1" - exit $RETURN_BAD -} +# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/x86-archscript.sh,v 1.2 2004/01/20 22:24:39 drobbins Exp $ case $1 in - kernbuild) - echo "no generic process for x86, continuing" - exit $RETURN_CONTINUE - ;; - - setupfs) - echo "no generic process for x86, continuing" + kernel) exit $RETURN_CONTINUE ;; preclean) - echo "no generic process for x86, continuing" - exit 2 + exit $RETURN_CONTINUE ;; clean) - echo "no generic process for x86, continuing" exit $RETURN_CONTINUE ;; - setup_bootloader) - # LOOPTYPE and loop_opts are exported from the default + bootloader) + # CDFSTYPE and loop_opts are exported from the default # runscript - #Time to create a filesystem tree for the ISO at $clst_cdroot_path. - #We extract the "cdtar" to this directory, which will normally contains a pre-built - #binary boot-loader/filesystem skeleton for the ISO. + # Time to create a filesystem tree for the ISO at $clst_cdroot_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 [ "$cdtar" = "" ] && die "No livecd/cdtar specified (required)" @@ -59,12 +39,12 @@ case $1 in #grab name of first kernel first="$x" fi - if [ ! -e "$clst_binaries_source_path/$x.tar.bz2" ] + if [ ! -e "/tmp/binaries/$x.tar.bz2" ] then - echo "Can't find kernel tarball at $clst_binaries_source_path/$x.tar.bz2" + echo "Can't find kernel tarball at /tmp/binaries/$x.tar.bz2" exit 1 fi - tar xjvf $clst_binaries_source_path/$x.tar.bz2 -C $clst_cdroot_path/isolinux + tar xjvf /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 @@ -100,12 +80,12 @@ case $1 in exit $RETURN_CONTINUE ;; - loop) + cdfs) echo "no generic process for x86, continuing" exit $RETURN_CONTINUE ;; - iso_create) + 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 diff --git a/examples/livecd/runscript/x86-isolinux-loop-example.sh b/examples/livecd/runscript/x86-isolinux-loop-example.sh deleted file mode 100644 index 79e4dea9..00000000 --- a/examples/livecd/runscript/x86-isolinux-loop-example.sh +++ /dev/null @@ -1,174 +0,0 @@ -# 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.7 2004/01/13 05:59:51 brad_mssw Exp $ - -die() { - echo "$1" - exit 1 -} - -#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) - 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 - -# Setup all runtime filesystem stuff - $clst_CHROOT $clst_chroot_path /bin/bash << EOF -env-update -source /etc/profile -rc-update del iptables default -rc-update del netmount default -rc-update add hotplug default -rc-update add kudzu default -rc-update del keymaps -rc-update del consolefont -rc-update add metalog default -rm -rf /etc/localtime -cp /usr/share/zoneinfo/GMT /etc/localtime -echo "livecd" > /etc/hostname -sed -i -e 's:^/dev/[RBS]*::' /etc/fstab -sed -i -e '/dev-state/ s/^/#/' /etc/devfsd.conf -EOF - - ;; -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 - #environment. - $clst_CHROOT $clst_chroot_path /bin/bash << EOF - echo "CDBOOT=1" >> /etc/rc.conf -EOF - [ $? -ne 0 ] && exit 1 -;; -clean) - #livecd/unmerge, bind-unmount, and livecd/{empty,delete,prune} - #have already executed at this point. You now have the opportunity to perform - #any additional cleaning steps that may be required. - find $clst_chroot_path/usr/lib -iname "*.pyc" -exec rm -f {} \; - ;; -cdroot_setup) - #Time to create a filesystem tree for the ISO at $clst_cdroot_path. - #We extract the "cdtar" to this directory, which will normally contains a pre-built - #binary boot-loader/filesystem skeleton for the ISO. Then we get genkernel-built - #kernels and initrds in place, create the loopback fs on $clst_cdroot_path, - #mount it, copy our bootable filesystem over, umount it, and we then have a - #ready-to-burn ISO tree at $clst_cdroot_path. - - 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 - first="" - for x in $clst_boot_kernel - do - if [ "$first" = "" ] - then - #grab name of first kernel - first="$x" - fi - if [ ! -e "$clst_binaries_source_path/$x.tar.bz2" ] - then - echo "Can't find kernel tarball at $clst_binaries_source_path/$x.tar.bz2" - exit 1 - fi - tar xjvf $clst_binaries_source_path/$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 - mv $clst_cdroot_path/isolinux/initrd $clst_cdroot_path/isolinux/$x.igz - done - icfg=$clst_cdroot_path/isolinux/isolinux.cfg - echo "default $first" > $icfg - for x in $clst_boot_kernel - do - echo >> $icfg - echo "label $x" >> $icfg - echo " kernel $x" >> $icfg - echo " append initrd=$x.igz root=/dev/ram0 init=/linuxrc loop=/livecd.loop cdroot" >> $icfg - done - #OK, now we need to prepare the loopback filesystem that we'll be booting. This is - #tricky. - echo "Calculating size of loopback filesystem..." - loopsize=`du -ks $clst_chroot_path | cut -f1` - [ "$loopsize" = "0" ] && loopsize=1 - #increase the size by 1/3, then divide by 4 to get 4k blocks - loopsize=$(( ( $loopsize + ( $loopsize / 2 ) ) / 4 )) - echo "Creating loopback file..." - dd if=/dev/zero of=$clst_cdroot_path/livecd.loop bs=4k count=$loopsize || die "livecd.loop creation failure" - #echo "Calculating number of inodes required for ext2 filesystem..." - #numnodes=`find $clst_chroot_path | wc -l` - #numnodes=$(( $numnodes + 200 )) - mke2fs -m 0 -F -b 4096 -q $clst_cdroot_path/livecd.loop || die "Couldn't create ext2 filesystem" - install -d $clst_cdroot_path/loopmount - sync; sync; sleep 3 #try to work around 2.6.0+ loopback bug - mount -t ext2 -o loop $clst_cdroot_path/livecd.loop $clst_cdroot_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 $clst_chroot_path/* $clst_cdroot_path/loopmount" - cp -a $clst_chroot_path/* $clst_cdroot_path/loopmount - - [ $? -ne 0 ] && { umount $clst_cdroot_path/loopmount; die "Couldn't copy files to loopback ext2 filesystem"; } - umount $clst_cdroot_path/loopmount || die "Couldn't unmount loopback ext2 filesystem" - 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. - ;; -iso_create) - #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 - ;; -esac -exit 0 diff --git a/examples/livecd/sparc64/sparc64-livecd-stage1-20040111.spec b/examples/livecd/sparc64/sparc64-livecd-stage1-20040111.spec index 6367d3c1..ed799477 100644 --- a/examples/livecd/sparc64/sparc64-livecd-stage1-20040111.spec +++ b/examples/livecd/sparc64/sparc64-livecd-stage1-20040111.spec @@ -8,6 +8,7 @@ source_subpath: default-sparc64-1.4/stage3-sparc64-20040111 livecd/use: -X -gtk + livecd livecd/packages: >=sys-apps/baselayout-1.8.6.12-r4 module-init-tools diff --git a/examples/livecd/sparc64/sparc64-livecd-stage2-20040111.spec b/examples/livecd/sparc64/sparc64-livecd-stage2-20040111.spec index a99eb5db..20e7ae2d 100644 --- a/examples/livecd/sparc64/sparc64-livecd-stage2-20040111.spec +++ b/examples/livecd/sparc64/sparc64-livecd-stage2-20040111.spec @@ -5,9 +5,50 @@ rel_type: default rel_version: 1.4 snapshot: 20040111 source_subpath: default-sparc64-1.4/livecd-stage1-sparc64-20040111 -livecd/looptype: normal +livecd/cdfstype: normal livecd/archscript: examples/livecd/runscript/sparc64-archscript.sh livecd/runscript: examples/livecd/runscript/default-runscript.sh +livecd/cdtar: examples/livecd/cdtar/silo-1.3.1-cdtar.tar.bz2 boot/kernel: gentoo boot/kernel/gentoo/sources: =sys-kernel/vanilla-sources-2.4.24 boot/kernel/gentoo/config: examples/livecd/sparc64/config-2.4.24-sparc64 +livecd/unmerge: + autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages + sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl +livecd/empty: + /var/tmp + /var/cache + /var/db + /var/empty + /var/cache + /var/lock + /tmp + /usr/portage + /usr/share/man + /usr/share/info + /usr/share/unimaps + /usr/include + /usr/share/zoneinfo + /usr/share/dict + /usr/share/doc + /usr/share/ss + /usr/share/state + /usr/share/texinfo + /usr/lib/python2.2 + /usr/lib/portage + /usr/share/gettext + /usr/share/i18n + /usr/share/rfc + /usr/X11R6/man + /usr/X11R6/include + /usr/X11R6/lib/X11/config + /usr/X11R6/lib/X11/etc + /usr/X11R6/lib/X11/doc + /usr/src + /usr/share/doc + /usr/share/man +livecd/rm: + /lib/*.a + /usr/lib/*.a + /usr/lib/gcc-lib/*/*/libgcj* + /usr/X11R6/lib/*.a diff --git a/examples/livecd/sparc64/sparc64-livecd-stage3-20040111.spec b/examples/livecd/sparc64/sparc64-livecd-stage3-20040111.spec deleted file mode 100644 index 34320d9f..00000000 --- a/examples/livecd/sparc64/sparc64-livecd-stage3-20040111.spec +++ /dev/null @@ -1,52 +0,0 @@ -subarch: sparc64 -version_stamp: 20040111 -target: livecd-stage3 -rel_type: default -rel_version: 1.4 -snapshot: 20040111 -source_subpath: default-sparc64-1.4/livecd-stage2-sparc64-20040111 -boot/kernel: gentoo -livecd/looptype: normal -livecd/archscript: examples/livecd/runscript/sparc64-archscript.sh -livecd/runscript: examples/livecd/runscript/default-runscript.sh -livecd/cdtar: examples/livecd/cdtar/silo-1.3.1-cdtar.tar.bz2 -livecd/unmerge: - autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages - sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl -livecd/empty: - /var/tmp - /var/cache - /var/db - /var/empty - /var/cache - /var/lock - /tmp - /usr/portage - /usr/share/man - /usr/share/info - /usr/share/unimaps - /usr/include - /usr/share/zoneinfo - /usr/share/dict - /usr/share/doc - /usr/share/ss - /usr/share/state - /usr/share/texinfo - /usr/lib/python2.2 - /usr/lib/portage - /usr/share/gettext - /usr/share/i18n - /usr/share/rfc - /usr/X11R6/man - /usr/X11R6/include - /usr/X11R6/lib/X11/config - /usr/X11R6/lib/X11/etc - /usr/X11R6/lib/X11/doc - /usr/src - /usr/share/doc - /usr/share/man -livecd/rm: - /lib/*.a - /usr/lib/*.a - /usr/lib/gcc-lib/*/*/libgcj* - /usr/X11R6/lib/*.a diff --git a/examples/livecd/x86/x86-livecd-stage1-20040114.spec b/examples/livecd/x86/x86-livecd-stage1-20040114.spec index e678376a..f4c7d579 100644 --- a/examples/livecd/x86/x86-livecd-stage1-20040114.spec +++ b/examples/livecd/x86/x86-livecd-stage1-20040114.spec @@ -8,6 +8,7 @@ source_subpath: default-x86-1.4/stage3-x86-20040111 livecd/use: -X -gtk + livecd livecd/packages: >=sys-apps/baselayout-1.8.6.12-r4 kudzu diff --git a/examples/livecd/x86/x86-livecd-stage2-20040114.spec b/examples/livecd/x86/x86-livecd-stage2-20040114.spec index ba873316..f0051a16 100644 --- a/examples/livecd/x86/x86-livecd-stage2-20040114.spec +++ b/examples/livecd/x86/x86-livecd-stage2-20040114.spec @@ -8,6 +8,47 @@ source_subpath: default-x86-1.4/livecd-stage1-x86-20040114 livecd/looptype: normal livecd/archscript: examples/livecd/runscript/x86-archcript.sh livecd/runscript: examples/livecd/runscript/default-runscript.sh +livecd/cdtar: examples/livecd/cdtar/isolinux-2.08-cdtar.tar.bz2 boot/kernel: gentoo boot/kernel/gentoo/sources: =sys-kernel/gentoo-dev-sources-2.6.1-r1 boot/kernel/gentoo/config: examples/livecd/x86/config-2.6.1-x86 +livecd/unmerge: + autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages + sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl +livecd/empty: + /var/tmp + /var/cache + /var/db + /var/empty + /var/cache + /var/lock + /tmp + /usr/portage + /usr/share/man + /usr/share/info + /usr/share/unimaps + /usr/include + /usr/share/zoneinfo + /usr/share/dict + /usr/share/doc + /usr/share/ss + /usr/share/state + /usr/share/texinfo + /usr/lib/python2.2 + /usr/lib/portage + /usr/share/gettext + /usr/share/i18n + /usr/share/rfc + /usr/X11R6/man + /usr/X11R6/include + /usr/X11R6/lib/X11/config + /usr/X11R6/lib/X11/etc + /usr/X11R6/lib/X11/doc + /usr/src + /usr/share/doc + /usr/share/man +livecd/rm: + /lib/*.a + /usr/lib/*.a + /usr/lib/gcc-lib/*/*/libgcj* + /usr/X11R6/lib/*.a diff --git a/examples/livecd/x86/x86-livecd-stage3-20040114.spec b/examples/livecd/x86/x86-livecd-stage3-20040114.spec deleted file mode 100644 index b8ba2ee9..00000000 --- a/examples/livecd/x86/x86-livecd-stage3-20040114.spec +++ /dev/null @@ -1,52 +0,0 @@ -subarch: x86 -version_stamp: 20040114 -target: livecd-stage3 -rel_type: default -rel_version: 1.4 -snapshot: 20040114 -source_subpath: default-x86-1.4/livecd-stage2-x86-20040114 -boot/kernel: gentoo -livecd/looptype: normal -livecd/archscript: examples/livecd/runscript/x86-archscript.sh -livecd/runscript: examples/livecd/runscript/default-runscript.sh -livecd/cdtar: examples/livecd/cdtar/isolinux-2.08-cdtar.tar.bz2 -livecd/unmerge: - autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages - sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl -livecd/empty: - /var/tmp - /var/cache - /var/db - /var/empty - /var/cache - /var/lock - /tmp - /usr/portage - /usr/share/man - /usr/share/info - /usr/share/unimaps - /usr/include - /usr/share/zoneinfo - /usr/share/dict - /usr/share/doc - /usr/share/ss - /usr/share/state - /usr/share/texinfo - /usr/lib/python2.2 - /usr/lib/portage - /usr/share/gettext - /usr/share/i18n - /usr/share/rfc - /usr/X11R6/man - /usr/X11R6/include - /usr/X11R6/lib/X11/config - /usr/X11R6/lib/X11/etc - /usr/X11R6/lib/X11/doc - /usr/src - /usr/share/doc - /usr/share/man -livecd/rm: - /lib/*.a - /usr/lib/*.a - /usr/lib/gcc-lib/*/*/libgcj* - /usr/X11R6/lib/*.a diff --git a/modules/targets.py b/modules/targets.py index 9a98f835..474f25e2 100644 --- a/modules/targets.py +++ b/modules/targets.py @@ -84,21 +84,8 @@ class generic_stage_target(generic_target): self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"] self.settings["source_path"]=st+"/builds/"+self.settings["source_subpath"]+".tar.bz2" elif self.settings["target"] == "livecd-stage2": - #we have a main directory and a tarball in this case - #making these directories before we clean doesn't make sense: - #os.makedirs(st+"/builds/"+self.settings["target_subpath"]) - self.settings["binaries_target_path"]=st+"/builds/"+self.settings["target_subpath"]+"/binaries" - self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"]+"/"+self.settings["target_subpath"]+".tar.bz2" self.settings["source_path"]=st+"/builds/"+self.settings["source_subpath"]+".tar.bz2" - elif self.settings["target"]=="livecd-stage3": - self.settings["cdroot_path"]=st+"/builds/"+self.settings["target_subpath"]+"/cdroot" - #making these directories before we clean doesn't make sense: - #if not os.path.exists(self.settings["target_path"]): - # os.makedirs(self.settings["target_path"]) - #if not os.path.exists(self.settings["cdroot_path"]): - # os.makedirs(self.settings["cdroot_path"]) - self.settings["binaries_source_path"]=st+"/builds/"+self.settings["source_subpath"]+"/binaries" - self.settings["source_path"]=st+"/builds/"+self.settings["source_subpath"]+"/"+self.settings["source_subpath"]+".tar.bz2" + self.settings["cdroot_path"]=st+"/builds/"+self.settings["target_subpath"] else: self.settings["target_path"]=st+"/builds/"+self.settings["target_subpath"]+".tar.bz2" self.settings["source_path"]=st+"/builds/"+self.settings["source_subpath"]+".tar.bz2" @@ -117,9 +104,6 @@ class generic_stage_target(generic_target): if self.settings["target"]=="grp": self.mounts.append("/tmp/grp") self.mountmap["/tmp/grp"]=self.settings["target_path"] - if self.settings["target"]=="livecd-stage2": - self.mounts.append("/tmp/binaries") - self.mountmap["/tmp/binaries"]=self.settings["binaries_target_path"] def mount_safety_check(self): mypath=self.settings["chroot_path"] @@ -309,19 +293,17 @@ class generic_stage_target(generic_target): os.environ[varname]=string.join(self.settings[x]) self.run_local() - if self.settings["target"] in ["livecd-stage3"]: - self.setupfs() - if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage3"]: + if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage2"]: self.preclean() - if self.settings["target"] in ["livecd-stage3"]: + if self.settings["target"] in ["livecd-stage2"]: self.unmerge() self.unbind() - if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage3"]: + if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage2"]: #clean is for removing things after bind-mounts are unmounted (general file removal and cleanup) self.clean() - if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage1","livecd-stage2"]: + if self.settings["target"] in ["stage1","stage2","stage3","livecd-stage1"]: self.capture() - if self.settings["target"] in ["livecd-stage3"]: + if self.settings["target"] in ["livecd-stage2"]: self.cdroot_setup() class snapshot_target(generic_target): @@ -428,7 +410,14 @@ class livecd_stage1_target(generic_stage_target): class livecd_stage2_target(generic_stage_target): def __init__(self,spec,addlargs): - self.required_values=["boot/kernel","livecd/looptype","livecd/archscript","livecd/runscript"] + self.required_values=["boot/kernel","livecd/cdfstype","livecd/archscript","livecd/runscript"] + 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"] + if not os.path.exists(self.settings["livecd/runscript"]): + raise CatalystError, "Cannot locate specified livecd/runscript: "+self.settings["livecd/runscript"] + if not os.path.exists(self.settings["livecd/archscript"]): + raise CatalystError, "Cannot locate specified livecd/archscript: "+self.settings["livecd/archscript"] if not addlargs.has_key("boot/kernel"): raise CatalystError, "Required value boot/kernel not specified." if type(addlargs["boot/kernel"]) == types.StringType: @@ -439,46 +428,11 @@ class livecd_stage2_target(generic_stage_target): self.required_values.append("boot/kernel/"+x+"/sources") self.required_values.append("boot/kernel/"+x+"/config") self.valid_values=self.required_values[:] - generic_stage_target.__init__(self,spec,addlargs) - - def run_local(self): - mynames=self.settings["boot/kernel"] - if type(mynames)==types.StringType: - mynames=[mynames] - args=[] - args.append(`len(mynames)`) - for x in mynames: - args.append(x) - args.append(self.settings["boot/kernel/"+x+"/sources"]) - if not os.path.exists(self.settings["boot/kernel/"+x+"/config"]): - self.unbind() - raise CatalystError, "Can't find kernel config: "+self.settings["boot/kernel/"+x+"/config"] - retval=os.system("cp "+self.settings["boot/kernel/"+x+"/config"]+" "+self.settings["chroot_path"]+"/var/tmp/"+x+".config") - if retval!=0: - self.unbind() - raise CatalystError, "Couldn't copy kernel config: "+self.settings["boot/kernel/"+x+"/config"] - try: - cmd("env ARCH_RUNSCRIPT="+self.settings["livecd/archscript"]+" LOOPTYPE="+self.settings["livecd/looptype"]+" /bin/bash "+self.settings["livecd/runscript"]+" kernbuild "+list_bashify(args),"runscript kernbuild failed") - except CatalystError: - self.unbind() - raise CatalystError,"livecd-stage2 build aborting due to error." - -class livecd_stage3_target(generic_stage_target): - def __init__(self,spec,addlargs): - self.required_values=["boot/kernel","livecd/looptype","livecd/archscript","livecd/runscript"] - 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"] - if not os.path.exists(self.settings["livecd/runscript"]): - raise CatalystError, "Cannot locate specified livecd/runscript: "+self.settings["livecd/runscript"] - if not os.path.exists(self.settings["livecd/archscript"]): - raise CatalystError, "Cannot locate specified livecd/archscript: "+self.settings["livecd/archscript"] - + def unmerge(self): - if self.settings["target"]=="livecd-stage3" and self.settings.has_key("livecd/unmerge"): + 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"][:] @@ -489,26 +443,23 @@ class livecd_stage3_target(generic_stage_target): #before cleaning, unmerge stuff: cmd("/bin/bash "+self.settings["sharedir"]+"/targets/"+self.settings["target"]+"/unmerge.sh "+myunmerge,"unmerge script failed.") - def run_local(self): - pass - def setupfs(self): try: - cmd("env ARCH_RUNSCRIPT="+self.settings["livecd/archscript"]+" LOOPTYPE="+self.settings["livecd/looptype"]+" /bin/bash "+self.settings["livecd/runscript"]+" setupfs","setupfs runscript failed.") + cmd("/bin/bash "+self.settings["livecd/runscript"]+" cdfs","cdfs runscript failed.") except: self.unbind() raise def preclean(self): try: - cmd("env ARCH_RUNSCRIPT="+self.settings["livecd/archscript"]+" LOOPTYPE="+self.settings["livecd/looptype"]+" /bin/bash "+self.settings["livecd/runscript"]+" preclean","preclean runscript failed.") + cmd("/bin/bash "+self.settings["livecd/runscript"]+" preclean","preclean runscript failed.") except: self.unbind() raise def clean(self): try: - cmd("env ARCH_RUNSCRIPT="+self.settings["livecd/archscript"]+" LOOPTYPE="+self.settings["livecd/looptype"]+" /bin/bash "+self.settings["livecd/runscript"]+" clean","clean runscript failed.") + cmd("/bin/bash "+self.settings["livecd/runscript"]+" clean","clean runscript failed.") except: self.unbind() raise @@ -521,10 +472,34 @@ class livecd_stage3_target(generic_stage_target): print "creating livecd-stage3 cdroot" os.makedirs(self.settings["cdroot_path"]) - cmd("env ARCH_RUNSCRIPT="+self.settings["livecd/archscript"]+" LOOPTYPE="+self.settings["livecd/looptype"]+" /bin/bash "+self.settings["livecd/runscript"]+" setup_bootloader","setup_bootloader runscript failed.") - cmd("env ARCH_RUNSCRIPT="+self.settings["livecd/archscript"]+" LOOPTYPE="+self.settings["livecd/looptype"]+" /bin/bash "+self.settings["livecd/runscript"]+" loop","loop runscript failed.") + 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): + mynames=self.settings["boot/kernel"] + if type(mynames)==types.StringType: + mynames=[mynames] + args=[] + args.append(`len(mynames)`) + for x in mynames: + args.append(x) + args.append(self.settings["boot/kernel/"+x+"/sources"]) + if not os.path.exists(self.settings["boot/kernel/"+x+"/config"]): + self.unbind() + raise CatalystError, "Can't find kernel config: "+self.settings["boot/kernel/"+x+"/config"] + retval=os.system("cp "+self.settings["boot/kernel/"+x+"/config"]+" "+self.settings["chroot_path"]+"/var/tmp/"+x+".config") + if retval!=0: + self.unbind() + 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") + except CatalystError: + self.unbind() + raise CatalystError,"livecd-stage2 build aborting due to error." + +class livecd_stage3_target(generic_stage_target): + def __init__(self,spec,addlargs): def register(foo): foo.update({"stage1":stage1_target,"stage2":stage2_target,"stage3":stage3_target, "grp":grp_target,"livecd-stage1":livecd_stage1_target, -- 2.26.2