Fix update_seed use by not using nor building binary packages during the seed update.
[catalyst.git] / targets / stage1 / stage1-chroot.sh
old mode 100755 (executable)
new mode 100644 (file)
index ef4ffea..ed83f38
@@ -1,49 +1,62 @@
 #!/bin/bash
-# Copyright 1999-2004 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.21 2004/09/08 15:58:12 zhen Exp $
-               
-/usr/sbin/env-update
-source /etc/profile
-
-[ -f /tmp/envscript ] && source /tmp/envscript
-               
-if [ -n "${clst_CCACHE}" ]
-then
-       export clst_myfeatures="${clst_myfeatures} ccache"      
-       emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-               
-if [ -n "${clst_DISTCC}" ]
-then   
-       export clst_myfeatures="${clst_myfeatures} distcc"
-       export DISTCC_HOSTS="${clst_distcc_hosts}"
-
-       USE="-gtk -gnome" emerge --oneshot --nodeps -b -k distcc || exit 1
-       /usr/bin/distcc-config --install 2>&1 > /dev/null
-       /usr/bin/distccd 2>&1 > /dev/null
-fi
 
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg"
-fi
+source /tmp/chroot-functions.sh
 
-# setup our environment
-export FEATURES="${clst_myfeatures}"
-export ROOT=${1}
-install -d ${ROOT}
-               
-## START BUILD
+# We do this first, so we know our package list for --debug
 export clst_buildpkgs="$(/tmp/build.py)"
-STAGE1_USE="$(source /etc/make.profile/make.defaults ; echo ${STAGE1_USE})"
 
-USE="-* build ${STAGE1_USE}" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
+# Setup our environment
+BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
+[ -n "${clst_BINDIST}" ] && BOOTSTRAP_USE="${BOOTSTRAP_USE} bindist"
 
-if [ -n "${clst_VERBOSE}" ]
+FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
+
+## Sanity check profile
+if [ -z "${clst_buildpkgs}" ]
 then
-       USE="-* build" emerge ${clst_myemergeopts} -vp --noreplace ${clst_buildpkgs} || exit 1
-       sleep 15
+       echo "Your profile seems to be broken."
+       echo "Could not build a list of build packages."
+       echo "Double check your /etc/portage/make.profile link and the 'packages' files."
+       exit 1
 fi
 
-USE="-* build" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
+## Setup seed pkgmgr to ensure latest
+clst_root_path=/ setup_pkgmgr
+
+# Update stage3
+if [ -n "${clst_update_seed}" ]; then
+       if [ "${clst_update_seed}" == "yes" ]; then
+               echo "Updating seed stage..."
+               if [ -n "${clst_update_seed_command}" ]; then
+                       clst_root_path=/ run_merge "--buildpkg=n ${clst_update_seed_command}"
+               else
+                       clst_root_path=/ run_merge "--update --deep --newuse --complete-graph --rebuild-if-new-ver gcc"
+               fi
+       elif [ "${clst_update_seed}" != "no" ]; then
+               echo "Invalid setting for update_seed: ${clst_update_seed}"
+               exit 1
+       fi
+
+       # reset emerge options for the target
+       clst_update_seed=no setup_myemergeopts
+else
+       echo "Skipping seed stage update..."
+fi
+
+make_destpath /tmp/stage1root
+
+## START BUILD
+# First, we drop in a known-good baselayout
+[ -e /etc/portage/make.conf ] && \
+       echo 'USE="${USE} -build"' >> /etc/portage/make.conf
+run_merge "--oneshot --nodeps sys-apps/baselayout"
+
+sed -i '/USE="${USE} -build"/d' /etc/portage/make.conf
+
+# Now, we install our packages
+[ -e /etc/portage/make.conf ] && \
+       echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \
+       >> /etc/portage/make.conf
+run_merge "--oneshot ${clst_buildpkgs}"
+sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
+       /etc/portage/make.conf