Fix update_seed use by not using nor building binary packages during the seed update.
[catalyst.git] / targets / stage1 / stage1-chroot.sh
1 #!/bin/bash
2
3 source /tmp/chroot-functions.sh
4
5 # We do this first, so we know our package list for --debug
6 export clst_buildpkgs="$(/tmp/build.py)"
7
8 # Setup our environment
9 BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
10 [ -n "${clst_BINDIST}" ] && BOOTSTRAP_USE="${BOOTSTRAP_USE} bindist"
11
12 FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
13
14 ## Sanity check profile
15 if [ -z "${clst_buildpkgs}" ]
16 then
17         echo "Your profile seems to be broken."
18         echo "Could not build a list of build packages."
19         echo "Double check your /etc/portage/make.profile link and the 'packages' files."
20         exit 1
21 fi
22
23 ## Setup seed pkgmgr to ensure latest
24 clst_root_path=/ setup_pkgmgr
25
26 # Update stage3
27 if [ -n "${clst_update_seed}" ]; then
28         if [ "${clst_update_seed}" == "yes" ]; then
29                 echo "Updating seed stage..."
30                 if [ -n "${clst_update_seed_command}" ]; then
31                         clst_root_path=/ run_merge "--buildpkg=n ${clst_update_seed_command}"
32                 else
33                         clst_root_path=/ run_merge "--update --deep --newuse --complete-graph --rebuild-if-new-ver gcc"
34                 fi
35         elif [ "${clst_update_seed}" != "no" ]; then
36                 echo "Invalid setting for update_seed: ${clst_update_seed}"
37                 exit 1
38         fi
39
40         # reset emerge options for the target
41         clst_update_seed=no setup_myemergeopts
42 else
43         echo "Skipping seed stage update..."
44 fi
45
46 make_destpath /tmp/stage1root
47
48 ## START BUILD
49 # First, we drop in a known-good baselayout
50 [ -e /etc/portage/make.conf ] && \
51         echo 'USE="${USE} -build"' >> /etc/portage/make.conf
52 run_merge "--oneshot --nodeps sys-apps/baselayout"
53
54 sed -i '/USE="${USE} -build"/d' /etc/portage/make.conf
55
56 # Now, we install our packages
57 [ -e /etc/portage/make.conf ] && \
58         echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \
59         >> /etc/portage/make.conf
60 run_merge "--oneshot ${clst_buildpkgs}"
61 sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
62         /etc/portage/make.conf