From 3aa2bd74101352926264f6ee9a1d3e095a9ed39b Mon Sep 17 00:00:00 2001 From: Daniel Robbins Date: Thu, 30 Oct 2003 19:42:56 +0000 Subject: [PATCH] wacky doodle updates git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@35 d1e1f19c-881f-0410-ab34-b69fee027534 --- targets/stage1/build.sh | 6 +-- targets/stage1/stage1-chroot.sh | 57 +++++++++++++++++++++ targets/stage1/stage1.sh | 91 ++++++++++----------------------- targets/stage1/stage1strap.sh | 21 -------- 4 files changed, 87 insertions(+), 88 deletions(-) create mode 100755 targets/stage1/stage1-chroot.sh delete mode 100755 targets/stage1/stage1strap.sh diff --git a/targets/stage1/build.sh b/targets/stage1/build.sh index 0b3c5fe0..dd06e4d5 100755 --- a/targets/stage1/build.sh +++ b/targets/stage1/build.sh @@ -1,11 +1,11 @@ #!/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/stage1/Attic/build.sh,v 1.3 2003/10/15 05:22:53 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/build.sh,v 1.4 2003/10/30 19:42:56 drobbins Exp $ -for x in `cat /usr/portage/profiles/${REL_TYPE}-${MAINARCH}-${REL_VERSION}/packages.build` +for x in `cat /usr/portage/profiles/${clst_rel_type}-${clst_mainarch}-${clst_rel_version}/packages.build` do - myp=$(grep -E "${x}(-[^[:space:]]*)?[[:space:]]*$" /usr/portage/profiles/${REL_TYPE}-i${MAINARCH}-${REL_VERSION}/packages | grep -v '^#' | sed -e 's:^\*::' | cat ) + myp=$(grep -E "${x}(-[^[:space:]]*)?[[:space:]]*$" /usr/portage/profiles/${clst_rel_type}-${clst_mainarch}-${clst_rel_version}/packages | grep -v '^#' | sed -e 's:^\*::' | cat ) if [ "$myp" = "" ] then #if not in the system profile, include it anyway diff --git a/targets/stage1/stage1-chroot.sh b/targets/stage1/stage1-chroot.sh new file mode 100755 index 00000000..6d4449be --- /dev/null +++ b/targets/stage1/stage1-chroot.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +env-update +source /etc/profile +case $1 in + build) + export ROOT=${2} + install -d $ROOT + for x in $(/tmp/build.sh) + do + echo $x >> /tmp/build.log + USE="-* build" emerge --usepkg --buildpkg --noreplace $x || exit 1 + done + ;; + + clean) + export ROOT=${2} + keepers="sys-kernel/linux-headers sys-devel/binutils sys-devel/gcc sys-apps/baselayout sys-libs/glibc virtual/glibc virtual/kernel" + if [ ${clst_rel_type} = "hardened" ] + then + keepers="${keepers} sys-devel/hardened-gcc" + fi + # set everything to uid 999 (nouser) + cd ${ROOT} + 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" | `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 + + chroot ${ROOT} /bin/bash << EOF + #now, some finishing touches to initialize gcc-config.... + unset ROOT + if [ -e /usr/sbin/gcc-config ] + then + mythang=\$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* ) + gcc-config \${mythang}; env-update; source /etc/profile + fi +EOF + ;; +esac + diff --git a/targets/stage1/stage1.sh b/targets/stage1/stage1.sh index dea97d9e..85f6920d 100755 --- a/targets/stage1/stage1.sh +++ b/targets/stage1/stage1.sh @@ -1,67 +1,30 @@ -#!/bin/bash - -env-update -source /etc/profile +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.4 2003/10/30 19:42:56 drobbins Exp $ + case $1 in - build) - # now, we fix the default make.profile symlink to be in line with the current - #profile being used. - cd /etc - rm -f make.profile - - ln -sf /usr/portage/profiles/${REL_TYPE}-${MAINARCH}-${MAINVERSION} make.profile - export ROOT=${2} - install -d $ROOT - for x in $(/tmp/build.sh ${MAINARCH}-${MAINVERSION}) - do - echo $x >> /tmp/build.log - USE="-* build" emerge --usepkg --buildpkg --noreplace $x || exit 1 - done +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.sh ${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 build /tmp/stage1root + [ $? -ne 0 ] && exit 1 + ;; +clean) + $clst_CHROOT ${clst_chroot_path} /tmp/stage1-chroot.sh clean /tmp/stage1root + [ $? -ne 0 ] && exit 1 + echo + ;; +*) + exit 1 + ;; +exit 0 - clean) - export ROOT=${2} - keepers="sys-kernel/linux-headers sys-devel/binutils sys-devel/gcc sys-apps/baselayout sys-libs/glibc virtual/glibc virtual/kernel" - if [ ${REL_TYPE} = "hardened" ] - then - keepers="${keepers} sys-devel/hardened-gcc" - fi - # set everything to uid 999 (nouser) - cd ${ROOT} - 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" | `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 - - chroot ${ROOT} /bin/bash << EOF - #now, some finishing touches to initialize gcc-config.... - unset ROOT - if [ -e /usr/sbin/gcc-config ] - then - mythang=\$( cd /etc/env.d/gcc; ls ${CHOST}-* ) - gcc-config \${mythang}; env-update; source /etc/profile - fi - #fix up profile symlink in chroot - cd /etc - rm -f make.profile - ln -sf ../usr/portage/profiles/${REL_TYPE}-${MAINARCH}-${MAINVERSION} make.profile -EOF - ;; -esac - diff --git a/targets/stage1/stage1strap.sh b/targets/stage1/stage1strap.sh deleted file mode 100755 index 53f97ded..00000000 --- a/targets/stage1/stage1strap.sh +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 1999-2003 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1strap.sh,v 1.2 2003/10/15 05:22:53 zhen Exp $ - -cp ${SHAREDIR}/bin/stage1.sh ${CHROOTDIR}/tmp -cp ${SHAREDIR}/bin/build.sh ${CHROOTDIR}/tmp - -## We shouldn't need to export anything in catalyst, since the -## main program does that for us. - -#CHOST is for the gcc-config initialization step -#export MAINVERSION MAINARCH CHOST BUILDTYPE -#get our make.conf instide our new tree -#good idea because make.conf should be there. -#also necessary because the "stage1" script runs gcc-config, which -#uses portage, which requires /etc/make.conf to exist. - -makeconf ${CHROOTDIR}/tmp/stage1root -$CHROOT . /tmp/stage1.sh build /tmp/stage1root -[ $? -ne 0 ] && die "Stage 1 build failure" - -- 2.26.2