chmod +x all sh scripts so they can run from the git checkout
[catalyst.git] / targets / support / chroot-functions.sh
old mode 100644 (file)
new mode 100755 (executable)
index 7e82e32..5c30537
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+# Set the profile
+eselect profile set ${clst_target_profile}
+
 # Trap these signals and kill ourselves if recieved
 # Force ourselves to die if any of these signals are recieved
 # most likely our controlling terminal is gone
@@ -61,30 +64,30 @@ get_libdir() {
 
 setup_myfeatures(){
        setup_myemergeopts
-       export FEATURES="-news"
+       export FEATURES="-news clean-logs"
        if [ -n "${clst_CCACHE}" ]
        then
                export clst_myfeatures="${clst_myfeatures} ccache"
-               clst_root_path=/ run_merge --oneshot --nodeps --noreplace dev-util/ccache || exit 1
+               clst_root_path=/ run_merge --oneshot --noreplace dev-util/ccache || exit 1
        fi
 
        if [ -n "${clst_DISTCC}" ]
        then
                export clst_myfeatures="${clst_myfeatures} distcc"
                export DISTCC_HOSTS="${clst_distcc_hosts}"
-               [ -e /etc/make.conf ] && \
-                       echo 'USE="${USE} -avahi -gtk -gnome"' >> /etc/make.conf
+               [ -e /etc/portage/make.conf ] && \
+                       echo 'USE="${USE} -avahi -gtk -gnome"' >> /etc/portage/make.conf
                # We install distcc to / on stage1, then use --noreplace, so we need to
                # have some way to check if we need to reinstall distcc without being
                # able to rely on USE, so we check for the distcc user and force a
                # reinstall if it isn't found.
                if [ "$(getent passwd distcc | cut -d: -f1)" != "distcc" ]
                then
-                       clst_root_path=/ run_merge --oneshot --nodeps sys-devel/distcc || exit 1
+                       clst_root_path=/ run_merge --oneshot sys-devel/distcc || exit 1
                else
-                       clst_root_path=/ run_merge --oneshot --nodeps --noreplace sys-devel/distcc || exit 1
+                       clst_root_path=/ run_merge --oneshot --noreplace sys-devel/distcc || exit 1
                fi
-               sed -i '/USE="${USE} -avahi -gtk -gnome"/d' /etc/make.conf
+               sed -i '/USE="${USE} -avahi -gtk -gnome"/d' /etc/portage/make.conf
                mkdir -p /etc/distcc
                echo "${clst_distcc_hosts}" > /etc/distcc/hosts
 
@@ -101,7 +104,7 @@ setup_myfeatures(){
 
        if [ -n "${clst_ICECREAM}" ]
        then
-               clst_root_path=/ run_merge --oneshot --nodeps --noreplace sys-devel/icecream || exit 1
+               clst_root_path=/ run_merge --oneshot --noreplace sys-devel/icecream || exit 1
 
                # This sets up automatic cross-icecc-fu according to
                # http://gentoo-wiki.com/HOWTO_Setup_An_ICECREAM_Compile_Cluster#Icecream_and_cross-compiling
@@ -130,7 +133,8 @@ setup_myemergeopts(){
        then
                export bootstrap_opts="${bootstrap_opts} -f"
                export clst_myemergeopts="${clst_myemergeopts} -f"
-       elif [ -n "${clst_PKGCACHE}" ]
+       # if we have PKGCACHE, and either update_seed is empty or 'no', make and use binpkgs
+       elif [ -n "${clst_PKGCACHE}" ] && [ -z "${clst_update_seed}" -o "${clst_update_seed}" = "no" ]
        then
                export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg --newuse"
                export bootstrap_opts="${bootstrap_opts} -r"
@@ -140,35 +144,35 @@ setup_myemergeopts(){
 setup_binutils(){
        if [ -x /usr/bin/binutils-config ]
        then
-               mythang=$( cd /etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
-               if [ -z "${mythang}" ]
+               my_binutils=$( cd /etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
+               if [ -z "${my_binutils}" ]
                then
-                       mythang=1
+                       my_binutils=1
                fi
-               binutils-config ${mythang}; update_env_settings
+               binutils-config ${my_binutils}; update_env_settings
        fi
 }
 
 setup_gcc(){
        if [ -x /usr/bin/gcc-config ]
        then
-               mythang=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
-               if [ -z "${mythang}" ]
+               my_gcc=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
+               if [ -z "${my_gcc}" ]
                then
-                       mythang=1
+                       my_gcc=1
                fi
-               gcc-config ${mythang}; update_env_settings
+               gcc-config ${my_gcc}; update_env_settings
        fi
 }
 
 setup_pkgmgr(){
        # We need to merge our package manager with USE="build" set in case it is
-       # portage to avoid frying our /etc/make.conf file.  Otherwise, we could
-       # just let emerge system could merge it.
+       # portage to avoid frying our /etc/portage/make.conf file.  Otherwise, we could
+       # just let emerge @system could merge it.
        # Use --update or portage won't reinstall the same version.
-       [ -e /etc/make.conf ] && echo 'USE="${USE} build"' >> /etc/make.conf
+       [ -e /etc/portage/make.conf ] && echo 'USE="${USE} build"' >> /etc/portage/make.conf
        run_merge --oneshot --nodeps --update sys-apps/portage
-       sed -i '/USE="${USE} build"/d' /etc/make.conf
+       sed -i '/USE="${USE} build"/d' /etc/portage/make.conf
 }
 
 cleanup_distcc() {
@@ -234,11 +238,11 @@ die() {
 
 make_destpath() {
        # ROOT is / by default, so remove any ROOT= settings from make.conf
-       sed -i '/ROOT=/d' /etc/make.conf
+       sed -i '/ROOT=/d' /etc/portage/make.conf
        export ROOT=/
-       if [ "${1}" != "/" -a -n "${1}" ] 
+       if [ "${1}" != "/" -a -n "${1}" ]
        then
-               echo "ROOT=\"${1}\"" >> /etc/make.conf
+               echo "ROOT=\"${1}\"" >> /etc/portage/make.conf
                export ROOT=${1}
        fi
        if [ ! -d ${ROOT} ]
@@ -251,8 +255,8 @@ run_merge() {
        # Sets up the ROOT= parameter
        # with no options ROOT=/
        make_destpath ${clst_root_path}
-       
-       export EMERGE_WARNING_DELAY=0   
+
+       export EMERGE_WARNING_DELAY=0
        export CLEAN_DELAY=0
        export EBEEP_IGNORE=0
        export EPAUSE_IGNORE=0
@@ -283,7 +287,7 @@ show_debug() {
                echo "DEBUG:"
                echo "Profile/target info:"
                echo "Profile inheritance:"
-               python -c 'import portage; print portage.settings.profiles'
+               python -c 'import portage; print(portage.settings.profiles)'
                echo
                # TODO: make this work on non-portage
                emerge --info
@@ -349,7 +353,7 @@ function copy_symlink() {
        STACK=${2}
        [ "${STACK}" = "" ] && STACK=16 || STACK=$((${STACK} - 1 ))
 
-       if [ ${STACK} -le 0 ] 
+       if [ ${STACK} -le 0 ]
        then
                echo "WARNING : ${TARGET} : too many levels of symbolic links !"
                return
@@ -359,7 +363,7 @@ function copy_symlink() {
                mkdir -p ${clst_root_path}/`dirname ${1}`
        [ ! -e ${clst_root_path}/${1} ] && \
                cp -vfdp ${1} ${clst_root_path}/${1}
-       
+
        if [[ -n $(type -p realpath) ]]; then
                TARGET=`realpath ${1}`
        else
@@ -412,4 +416,3 @@ Icon=text-editor" > /usr/share/applications/gentoo-handbook.desktop
 
 # We do this everywhere, so why not put it in this script
 run_default_funcs
-