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 33bc0e6..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.18 2004/07/12 14:25:16 zhen Exp $
-               
-/usr/sbin/env-update
-source /etc/profile
-
-[ -f /tmp/envscript ] && source /tmp/envscript
-               
-if [ -n "${clst_CCACHE}" ]
+
+source /tmp/chroot-functions.sh
+
+# We do this first, so we know our package list for --debug
+export clst_buildpkgs="$(/tmp/build.py)"
+
+# Setup our environment
+BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
+[ -n "${clst_BINDIST}" ] && BOOTSTRAP_USE="${BOOTSTRAP_USE} bindist"
+
+FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
+
+## Sanity check profile
+if [ -z "${clst_buildpkgs}" ]
 then
-       export clst_myfeatures="${clst_myfeatures} ccache"      
-       emerge -b -k --oneshot --nodeps 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 -b -k --oneshot --nodeps distcc || exit 1
-       /usr/bin/distcc-config --install 2>&1 > /dev/null
-       /usr/bin/distccd 2>&1 > /dev/null
+       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
 
-if [ -n "${clst_PKGCACHE}" ]
-then
-       export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg"
+## 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
 
-# setup our environment
-export FEATURES="${clst_myfeatures}"
-export ROOT=${1}
-install -d ${ROOT}
-               
+make_destpath /tmp/stage1root
+
 ## START BUILD
-for x in $(/tmp/build.sh)
-do
-       #echo $x >> /tmp/build.log
-       export clst_buildpkgs="${clst_buildpkgs} ${x}"
-done
+# 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"
 
-if [ -n "${clst_DEBUG}" ]
-then
-       USE="-* build" emerge ${clst_myemergeopts} -vp --noreplace ${clst_buildpkgs} || exit 1
-fi
+sed -i '/USE="${USE} -build"/d' /etc/portage/make.conf
 
-USE="-* build" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
+# 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