1 |
It just read clst_root_path, exported it as ROOT, and ensured that a |
2 |
directory existed at $ROOT. Setting and resetting clst_* variables adds |
3 |
a lot of confusion, so just use ROOT directly. |
4 |
|
5 |
Signed-off-by: Matt Turner <mattst88@g.o> |
6 |
--- |
7 |
targets/embedded/chroot.sh | 15 ++++++-------- |
8 |
targets/netboot/controller.sh | 2 +- |
9 |
targets/netboot/pkg.sh | 2 +- |
10 |
targets/stage1/chroot.sh | 12 ++++++----- |
11 |
targets/stage1/controller.sh | 4 ++-- |
12 |
targets/support/chroot-functions.sh | 32 ++++++----------------------- |
13 |
6 files changed, 23 insertions(+), 44 deletions(-) |
14 |
|
15 |
diff --git a/targets/embedded/chroot.sh b/targets/embedded/chroot.sh |
16 |
index 2fbba278..11068388 100755 |
17 |
--- a/targets/embedded/chroot.sh |
18 |
+++ b/targets/embedded/chroot.sh |
19 |
@@ -2,14 +2,11 @@ |
20 |
|
21 |
source /tmp/chroot-functions.sh |
22 |
|
23 |
-# Setup the environment |
24 |
-export DESTROOT="${clst_root_path}" |
25 |
-export clst_root_path="/" |
26 |
+echo "Installing dependencies..." |
27 |
+ROOT=/ run_merge -o "${clst_embedded_packages}" |
28 |
|
29 |
-echo "Installing dependencies into ${DESTROOT}..." |
30 |
-run_merge -o "${clst_embedded_packages}" |
31 |
+export ROOT="${clst_root_path}" |
32 |
+mkdir -p "$ROOT" |
33 |
|
34 |
-export clst_root_path="${DESTROOT}" |
35 |
-export INSTALL_MASK="${clst_install_mask}" |
36 |
- |
37 |
-run_merge -1 -O "${clst_embedded_packages}" |
38 |
+INSTALL_MASK="${clst_install_mask}" \ |
39 |
+ run_merge -1 -O "${clst_embedded_packages}" |
40 |
diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh |
41 |
index 9a6e14d2..cc946c2c 100755 |
42 |
--- a/targets/netboot/controller.sh |
43 |
+++ b/targets/netboot/controller.sh |
44 |
@@ -6,7 +6,7 @@ case ${1} in |
45 |
build_packages) |
46 |
echo ">>> Building packages ..." |
47 |
shift |
48 |
- clst_root_path="/" \ |
49 |
+ ROOT="/" \ |
50 |
clst_packages="$*" \ |
51 |
exec_in_chroot \ |
52 |
${clst_shdir}/${clst_target}/pkg.sh |
53 |
diff --git a/targets/netboot/pkg.sh b/targets/netboot/pkg.sh |
54 |
index 2ec27062..2ad9491c 100755 |
55 |
--- a/targets/netboot/pkg.sh |
56 |
+++ b/targets/netboot/pkg.sh |
57 |
@@ -10,4 +10,4 @@ show_debug |
58 |
|
59 |
# START BUILD |
60 |
|
61 |
-run_merge ${clst_packages} |
62 |
+ROOT="$ROOT" run_merge ${clst_packages} |
63 |
diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh |
64 |
index 33d5c3c9..b733fc57 100755 |
65 |
--- a/targets/stage1/chroot.sh |
66 |
+++ b/targets/stage1/chroot.sh |
67 |
@@ -33,9 +33,9 @@ if [ -n "${clst_update_seed}" ]; then |
68 |
if [ "${clst_update_seed}" == "yes" ]; then |
69 |
echo "Updating seed stage..." |
70 |
if [ -n "${clst_update_seed_command}" ]; then |
71 |
- clst_root_path=/ run_merge --buildpkg=n "${clst_update_seed_command}" |
72 |
+ ROOT=/ run_merge --buildpkg=n "${clst_update_seed_command}" |
73 |
else |
74 |
- clst_root_path=/ run_merge --update --deep --newuse --complete-graph --rebuild-if-new-ver gcc |
75 |
+ ROOT=/ run_merge --update --deep --newuse --complete-graph --rebuild-if-new-ver gcc |
76 |
fi |
77 |
elif [ "${clst_update_seed}" != "no" ]; then |
78 |
echo "Invalid setting for update_seed: ${clst_update_seed}" |
79 |
@@ -50,7 +50,9 @@ fi |
80 |
|
81 |
# Clear USE |
82 |
[ -e ${clst_make_conf} ] && sed -i -e "/^USE=\"${BINDIST} ${USE}\"/d" ${clst_make_conf} |
83 |
-make_destpath "${clst_root_path}" |
84 |
+ |
85 |
+export ROOT="${clst_root_path}" |
86 |
+mkdir -p "$ROOT" |
87 |
|
88 |
## START BUILD |
89 |
# First, we drop in a known-good baselayout |
90 |
@@ -59,7 +61,7 @@ run_merge --oneshot --nodeps sys-apps/baselayout |
91 |
sed -i "/USE=\"${USE} -build\"/d" ${clst_make_conf} |
92 |
|
93 |
echo "$locales" > /etc/locale.gen |
94 |
-for etc in /etc "${clst_root_path}"/etc; do |
95 |
+for etc in /etc "$ROOT"/etc; do |
96 |
echo "LANG=C.UTF8" > ${etc}/env.d/02locale |
97 |
done |
98 |
update_env_settings |
99 |
@@ -84,7 +86,7 @@ run_merge --oneshot "${buildpkgs[@]}" |
100 |
# not run locale-gen when ROOT is set. Since we've set LANG, we need to run |
101 |
# locale-gen explicitly. |
102 |
if [ -x "$(command -v locale-gen)" ]; then |
103 |
- locale-gen --destdir "${clst_root_path}"/ || die "locale-gen failed" |
104 |
+ locale-gen --destdir "$ROOT"/ || die "locale-gen failed" |
105 |
fi |
106 |
|
107 |
# Why are we removing these? Don't we need them for final make.conf? |
108 |
diff --git a/targets/stage1/controller.sh b/targets/stage1/controller.sh |
109 |
index f9dd4b9b..ab127114 100755 |
110 |
--- a/targets/stage1/controller.sh |
111 |
+++ b/targets/stage1/controller.sh |
112 |
@@ -10,8 +10,8 @@ case "$1" in |
113 |
cp "${clst_shdir}/stage1/build.py" "${clst_chroot_path}/tmp" |
114 |
|
115 |
# Setup "ROOT in chroot" dir |
116 |
- install -d "${clst_chroot_path}/${clst_root_path}/etc" |
117 |
- install -d "${clst_chroot_path}/${clst_root_path}${clst_port_conf}" |
118 |
+ install -d "${clst_stage_path}/etc" |
119 |
+ install -d "${clst_stage_path}/${clst_port_conf}" |
120 |
|
121 |
# Setup make.conf and make.profile link in "ROOT in chroot": |
122 |
copy_to_chroot "${clst_chroot_path}${clst_make_conf}" "${clst_root_path}${clst_port_conf}" |
123 |
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh |
124 |
index d125756f..2aec018e 100755 |
125 |
--- a/targets/support/chroot-functions.sh |
126 |
+++ b/targets/support/chroot-functions.sh |
127 |
@@ -60,7 +60,7 @@ setup_features() { |
128 |
if [ -n "${clst_CCACHE}" ] |
129 |
then |
130 |
features+=(ccache) |
131 |
- clst_root_path=/ run_merge --oneshot --noreplace dev-util/ccache |
132 |
+ ROOT=/ run_merge --oneshot --noreplace dev-util/ccache |
133 |
fi |
134 |
|
135 |
if [ -n "${clst_DISTCC}" ] |
136 |
@@ -75,9 +75,9 @@ setup_features() { |
137 |
# reinstall if it isn't found. |
138 |
if [ "$(getent passwd distcc | cut -d: -f1)" != "distcc" ] |
139 |
then |
140 |
- clst_root_path=/ run_merge --oneshot sys-devel/distcc |
141 |
+ ROOT=/ run_merge --oneshot sys-devel/distcc |
142 |
else |
143 |
- clst_root_path=/ run_merge --oneshot --noreplace sys-devel/distcc |
144 |
+ ROOT=/ run_merge --oneshot --noreplace sys-devel/distcc |
145 |
fi |
146 |
sed -i '/USE="${USE} -avahi -gtk -gnome"/d' ${clst_make_conf} |
147 |
mkdir -p /etc/distcc |
148 |
@@ -96,7 +96,7 @@ setup_features() { |
149 |
|
150 |
if [ -n "${clst_ICECREAM}" ] |
151 |
then |
152 |
- clst_root_path=/ run_merge --oneshot --noreplace sys-devel/icecream |
153 |
+ ROOT=/ run_merge --oneshot --noreplace sys-devel/icecream |
154 |
|
155 |
# This sets up automatic cross-icecc-fu according to |
156 |
# http://www.gentoo-wiki.info/HOWTO_Setup_An_ICECREAM_Compile_Cluster |
157 |
@@ -193,7 +193,6 @@ cleanup_icecream() { |
158 |
} |
159 |
|
160 |
cleanup_stages() { |
161 |
- make_destpath |
162 |
if [ -n "${clst_DISTCC}" ] |
163 |
then |
164 |
cleanup_distcc |
165 |
@@ -238,26 +237,7 @@ die() { |
166 |
exit 1 |
167 |
} |
168 |
|
169 |
-make_destpath() { |
170 |
- # ROOT is / by default, so remove any ROOT= settings from make.conf |
171 |
- sed -i '/ROOT=/d' ${clst_make_conf} |
172 |
- export ROOT=/ |
173 |
- if [ "${1}" != "/" -a -n "${1}" ] |
174 |
- then |
175 |
- echo "ROOT=\"${1}\"" >> ${clst_make_conf} |
176 |
- export ROOT=${1} |
177 |
- fi |
178 |
- if [ ! -d ${ROOT} ] |
179 |
- then |
180 |
- install -d ${ROOT} |
181 |
- fi |
182 |
-} |
183 |
- |
184 |
run_merge() { |
185 |
- # Sets up the ROOT= parameter |
186 |
- # with no options ROOT=/ |
187 |
- make_destpath ${clst_root_path} |
188 |
- |
189 |
export EMERGE_WARNING_DELAY=0 |
190 |
export CLEAN_DELAY=0 |
191 |
[[ $CONFIG_PROTECT != "-*"* ]] && export CONFIG_PROTECT="-*" |
192 |
@@ -265,12 +245,12 @@ run_merge() { |
193 |
if [ -n "${clst_VERBOSE}" ] |
194 |
then |
195 |
echo "ROOT=${ROOT} emerge ${emerge_opts[@]} -pt $@" || exit 1 |
196 |
- emerge ${emerge_opts[@]} -pt $@ || exit 3 |
197 |
+ ROOT="$ROOT" emerge ${emerge_opts[@]} -pt $@ || exit 3 |
198 |
fi |
199 |
|
200 |
echo "emerge ${emerge_opts[@]} $@" || exit 1 |
201 |
|
202 |
- emerge ${emerge_opts[@]} $@ || exit 1 |
203 |
+ ROOT="$ROOT" emerge ${emerge_opts[@]} $@ || exit 1 |
204 |
} |
205 |
|
206 |
show_debug() { |
207 |
-- |
208 |
2.26.2 |