aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2020-12-18 19:22:09 -0500
committerMatt Turner <mattst88@gentoo.org>2020-12-19 14:25:14 -0500
commit9abe4ca574e11fe2c3810bac44789143399798a7 (patch)
treeaa65edc5e750d519ce61c8b51d06e6efaeb0a926
parenttargets: Pass separate arguments to run_merge() (diff)
downloadcatalyst-9abe4ca574e11fe2c3810bac44789143399798a7.tar.gz
catalyst-9abe4ca574e11fe2c3810bac44789143399798a7.tar.bz2
catalyst-9abe4ca574e11fe2c3810bac44789143399798a7.zip
targets: Remove make_destpath() function
It just read clst_root_path, exported it as ROOT, and ensured that a directory existed at $ROOT. Setting and resetting clst_* variables adds a lot of confusion, so just use ROOT directly. Signed-off-by: Matt Turner <mattst88@gentoo.org>
-rwxr-xr-xtargets/embedded/chroot.sh15
-rwxr-xr-xtargets/netboot/controller.sh2
-rwxr-xr-xtargets/netboot/pkg.sh2
-rwxr-xr-xtargets/stage1/chroot.sh12
-rwxr-xr-xtargets/stage1/controller.sh4
-rwxr-xr-xtargets/support/chroot-functions.sh32
6 files changed, 23 insertions, 44 deletions
diff --git a/targets/embedded/chroot.sh b/targets/embedded/chroot.sh
index 2fbba278..11068388 100755
--- a/targets/embedded/chroot.sh
+++ b/targets/embedded/chroot.sh
@@ -2,14 +2,11 @@
source /tmp/chroot-functions.sh
-# Setup the environment
-export DESTROOT="${clst_root_path}"
-export clst_root_path="/"
+echo "Installing dependencies..."
+ROOT=/ run_merge -o "${clst_embedded_packages}"
-echo "Installing dependencies into ${DESTROOT}..."
-run_merge -o "${clst_embedded_packages}"
+export ROOT="${clst_root_path}"
+mkdir -p "$ROOT"
-export clst_root_path="${DESTROOT}"
-export INSTALL_MASK="${clst_install_mask}"
-
-run_merge -1 -O "${clst_embedded_packages}"
+INSTALL_MASK="${clst_install_mask}" \
+ run_merge -1 -O "${clst_embedded_packages}"
diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh
index 9a6e14d2..cc946c2c 100755
--- a/targets/netboot/controller.sh
+++ b/targets/netboot/controller.sh
@@ -6,7 +6,7 @@ case ${1} in
build_packages)
echo ">>> Building packages ..."
shift
- clst_root_path="/" \
+ ROOT="/" \
clst_packages="$*" \
exec_in_chroot \
${clst_shdir}/${clst_target}/pkg.sh
diff --git a/targets/netboot/pkg.sh b/targets/netboot/pkg.sh
index 2ec27062..2ad9491c 100755
--- a/targets/netboot/pkg.sh
+++ b/targets/netboot/pkg.sh
@@ -10,4 +10,4 @@ show_debug
# START BUILD
-run_merge ${clst_packages}
+ROOT="$ROOT" run_merge ${clst_packages}
diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh
index 33d5c3c9..b733fc57 100755
--- a/targets/stage1/chroot.sh
+++ b/targets/stage1/chroot.sh
@@ -33,9 +33,9 @@ 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}"
+ ROOT=/ run_merge --buildpkg=n "${clst_update_seed_command}"
else
- clst_root_path=/ run_merge --update --deep --newuse --complete-graph --rebuild-if-new-ver gcc
+ ROOT=/ 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}"
@@ -50,7 +50,9 @@ fi
# Clear USE
[ -e ${clst_make_conf} ] && sed -i -e "/^USE=\"${BINDIST} ${USE}\"/d" ${clst_make_conf}
-make_destpath "${clst_root_path}"
+
+export ROOT="${clst_root_path}"
+mkdir -p "$ROOT"
## START BUILD
# First, we drop in a known-good baselayout
@@ -59,7 +61,7 @@ run_merge --oneshot --nodeps sys-apps/baselayout
sed -i "/USE=\"${USE} -build\"/d" ${clst_make_conf}
echo "$locales" > /etc/locale.gen
-for etc in /etc "${clst_root_path}"/etc; do
+for etc in /etc "$ROOT"/etc; do
echo "LANG=C.UTF8" > ${etc}/env.d/02locale
done
update_env_settings
@@ -84,7 +86,7 @@ run_merge --oneshot "${buildpkgs[@]}"
# not run locale-gen when ROOT is set. Since we've set LANG, we need to run
# locale-gen explicitly.
if [ -x "$(command -v locale-gen)" ]; then
- locale-gen --destdir "${clst_root_path}"/ || die "locale-gen failed"
+ locale-gen --destdir "$ROOT"/ || die "locale-gen failed"
fi
# Why are we removing these? Don't we need them for final make.conf?
diff --git a/targets/stage1/controller.sh b/targets/stage1/controller.sh
index f9dd4b9b..ab127114 100755
--- a/targets/stage1/controller.sh
+++ b/targets/stage1/controller.sh
@@ -10,8 +10,8 @@ case "$1" in
cp "${clst_shdir}/stage1/build.py" "${clst_chroot_path}/tmp"
# Setup "ROOT in chroot" dir
- install -d "${clst_chroot_path}/${clst_root_path}/etc"
- install -d "${clst_chroot_path}/${clst_root_path}${clst_port_conf}"
+ install -d "${clst_stage_path}/etc"
+ install -d "${clst_stage_path}/${clst_port_conf}"
# Setup make.conf and make.profile link in "ROOT in chroot":
copy_to_chroot "${clst_chroot_path}${clst_make_conf}" "${clst_root_path}${clst_port_conf}"
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh
index d125756f..2aec018e 100755
--- a/targets/support/chroot-functions.sh
+++ b/targets/support/chroot-functions.sh
@@ -60,7 +60,7 @@ setup_features() {
if [ -n "${clst_CCACHE}" ]
then
features+=(ccache)
- clst_root_path=/ run_merge --oneshot --noreplace dev-util/ccache
+ ROOT=/ run_merge --oneshot --noreplace dev-util/ccache
fi
if [ -n "${clst_DISTCC}" ]
@@ -75,9 +75,9 @@ setup_features() {
# reinstall if it isn't found.
if [ "$(getent passwd distcc | cut -d: -f1)" != "distcc" ]
then
- clst_root_path=/ run_merge --oneshot sys-devel/distcc
+ ROOT=/ run_merge --oneshot sys-devel/distcc
else
- clst_root_path=/ run_merge --oneshot --noreplace sys-devel/distcc
+ ROOT=/ run_merge --oneshot --noreplace sys-devel/distcc
fi
sed -i '/USE="${USE} -avahi -gtk -gnome"/d' ${clst_make_conf}
mkdir -p /etc/distcc
@@ -96,7 +96,7 @@ setup_features() {
if [ -n "${clst_ICECREAM}" ]
then
- clst_root_path=/ run_merge --oneshot --noreplace sys-devel/icecream
+ ROOT=/ run_merge --oneshot --noreplace sys-devel/icecream
# This sets up automatic cross-icecc-fu according to
# http://www.gentoo-wiki.info/HOWTO_Setup_An_ICECREAM_Compile_Cluster
@@ -193,7 +193,6 @@ cleanup_icecream() {
}
cleanup_stages() {
- make_destpath
if [ -n "${clst_DISTCC}" ]
then
cleanup_distcc
@@ -238,26 +237,7 @@ die() {
exit 1
}
-make_destpath() {
- # ROOT is / by default, so remove any ROOT= settings from make.conf
- sed -i '/ROOT=/d' ${clst_make_conf}
- export ROOT=/
- if [ "${1}" != "/" -a -n "${1}" ]
- then
- echo "ROOT=\"${1}\"" >> ${clst_make_conf}
- export ROOT=${1}
- fi
- if [ ! -d ${ROOT} ]
- then
- install -d ${ROOT}
- fi
-}
-
run_merge() {
- # Sets up the ROOT= parameter
- # with no options ROOT=/
- make_destpath ${clst_root_path}
-
export EMERGE_WARNING_DELAY=0
export CLEAN_DELAY=0
[[ $CONFIG_PROTECT != "-*"* ]] && export CONFIG_PROTECT="-*"
@@ -265,12 +245,12 @@ run_merge() {
if [ -n "${clst_VERBOSE}" ]
then
echo "ROOT=${ROOT} emerge ${emerge_opts[@]} -pt $@" || exit 1
- emerge ${emerge_opts[@]} -pt $@ || exit 3
+ ROOT="$ROOT" emerge ${emerge_opts[@]} -pt $@ || exit 3
fi
echo "emerge ${emerge_opts[@]} $@" || exit 1
- emerge ${emerge_opts[@]} $@ || exit 1
+ ROOT="$ROOT" emerge ${emerge_opts[@]} $@ || exit 1
}
show_debug() {