1 |
Signed-off-by: Matt Turner <mattst88@g.o> |
2 |
--- |
3 |
targets/stage2/chroot.sh | 2 +- |
4 |
targets/support/bootloader-setup.sh | 38 ++++++++++++++------------- |
5 |
targets/support/chroot-functions.sh | 40 +++++++++++++++++------------ |
6 |
targets/support/kmerge.sh | 14 +++++----- |
7 |
4 files changed, 51 insertions(+), 43 deletions(-) |
8 |
|
9 |
diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh |
10 |
index 0cbaeb1d..4f1019f2 100755 |
11 |
--- a/targets/stage2/chroot.sh |
12 |
+++ b/targets/stage2/chroot.sh |
13 |
@@ -9,7 +9,7 @@ export CONFIG_PROTECT="-* /etc/locale.gen" |
14 |
echo "$locales" > /etc/locale.gen |
15 |
|
16 |
## START BUILD |
17 |
-${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1 |
18 |
+${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts[@]} || exit 1 |
19 |
|
20 |
# Replace modified /etc/locale.gen with default |
21 |
etc-update --automode -5 |
22 |
diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh |
23 |
index d3a6b2dc..e3d8037c 100755 |
24 |
--- a/targets/support/bootloader-setup.sh |
25 |
+++ b/targets/support/bootloader-setup.sh |
26 |
@@ -20,27 +20,29 @@ fi |
27 |
|
28 |
extract_kernels $1/boot |
29 |
|
30 |
+cmdline_opts=() |
31 |
+ |
32 |
# Add any additional options |
33 |
if [ -n "${clst_livecd_bootargs}" ] |
34 |
then |
35 |
for x in ${clst_livecd_bootargs} |
36 |
do |
37 |
- cmdline_opts="${cmdline_opts} ${x}" |
38 |
+ cmdline_opts+=(${x}) |
39 |
done |
40 |
fi |
41 |
|
42 |
case ${clst_fstype} in |
43 |
squashfs) |
44 |
- cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs" |
45 |
+ cmdline_opts+=(looptype=squashfs loop=/image.squashfs) |
46 |
;; |
47 |
jffs2) |
48 |
- cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2" |
49 |
+ cmdline_opts+=(looptype=jffs2 loop=/image.jffs2) |
50 |
;; |
51 |
esac |
52 |
|
53 |
|
54 |
-default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot" |
55 |
-[ -n "${clst_splash_theme}" ] && default_append_line="${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" |
56 |
+default_append_line=(root=/dev/ram0 init=/linuxrc ${cmdline_opts[@]} ${custom_kopts} cdroot) |
57 |
+[ -n "${clst_splash_theme}" ] && default_append_line+=(splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet) |
58 |
|
59 |
case ${clst_hostarch} in |
60 |
alpha) |
61 |
@@ -52,16 +54,16 @@ case ${clst_hostarch} in |
62 |
do |
63 |
echo -n "${bctr}:/boot/${x} " >> ${acfg} |
64 |
echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg} |
65 |
- echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg} |
66 |
+ echo "init=/linuxrc ${cmdline_opts[@]} cdroot" >> ${acfg} |
67 |
((bctr=${bctr}+1)) |
68 |
done |
69 |
# Pass 2 is for serial |
70 |
- cmdline_opts="${cmdline_opts} console=ttyS0" |
71 |
+ cmdline_opts+=(console=ttyS0) |
72 |
for x in ${clst_boot_kernel} |
73 |
do |
74 |
echo -n "${bctr}:/boot/${x} " >> ${acfg} |
75 |
echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg} |
76 |
- echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg} |
77 |
+ echo "init=/linuxrc ${cmdline_opts[@]} cdroot" >> ${acfg} |
78 |
((bctr=${bctr}+1)) |
79 |
done |
80 |
;; |
81 |
@@ -81,14 +83,14 @@ case ${clst_hostarch} in |
82 |
|
83 |
for x in ${clst_boot_kernel} |
84 |
do |
85 |
- eval kopts=\$clst_boot_kernel_${x}_kernelopts |
86 |
- my_kopts="${my_kopts} ${kopts}" |
87 |
+ eval kopt=\$clst_boot_kernel_${x}_kernelopts |
88 |
+ kopts+=(${kopt}) |
89 |
done |
90 |
|
91 |
# copy the bootloader for the final image |
92 |
cp /usr/share/palo/iplboot $1/boot/ |
93 |
|
94 |
- echo "--commandline=0/${boot_kernel_common_name} initrd=${first}.igz ${default_append_line} ${my_kopts}" >> ${icfg} |
95 |
+ echo "--commandline=0/${boot_kernel_common_name} initrd=${first}.igz ${default_append_line[@]} ${kopts[@]}" >> ${icfg} |
96 |
echo "--bootloader=boot/iplboot" >> ${icfg} |
97 |
echo "--ramdisk=boot/${first}.igz" >> ${icfg} |
98 |
for x in ${clst_boot_kernel} |
99 |
@@ -134,25 +136,25 @@ case ${clst_hostarch} in |
100 |
do |
101 |
echo "label ${x}-${y}" >> ${icfg} |
102 |
echo " kernel /boot/${x}" >> ${icfg} |
103 |
- echo " append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz vga=791" >> ${icfg} |
104 |
+ echo " append ${default_append_line[@]} softlevel=${y} initrd=/boot/${x}.igz vga=791" >> ${icfg} |
105 |
|
106 |
echo >> ${icfg} |
107 |
echo " ${x}" >> ${kmsg} |
108 |
echo "label ${x}-${y}-nofb" >> ${icfg} |
109 |
echo " kernel /boot/${x}" >> ${icfg} |
110 |
- echo " append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz" >> ${icfg} |
111 |
+ echo " append ${default_append_line[@]} softlevel=${y} initrd=/boot/${x}.igz" >> ${icfg} |
112 |
echo >> ${icfg} |
113 |
echo " ${x}-nofb" >> ${kmsg} |
114 |
done |
115 |
else |
116 |
echo "label ${x}" >> ${icfg} |
117 |
echo " kernel /boot/${x}" >> ${icfg} |
118 |
- echo " append ${default_append_line} initrd=/boot/${x}.igz vga=791" >> ${icfg} |
119 |
+ echo " append ${default_append_line[@]} initrd=/boot/${x}.igz vga=791" >> ${icfg} |
120 |
echo >> ${icfg} |
121 |
echo " ${x}" >> ${kmsg} |
122 |
echo "label ${x}-nofb" >> ${icfg} |
123 |
echo " kernel /boot/${x}" >> ${icfg} |
124 |
- echo " append ${default_append_line} initrd=/boot/${x}.igz" >> ${icfg} |
125 |
+ echo " append ${default_append_line[@]} initrd=/boot/${x}.igz" >> ${icfg} |
126 |
echo >> ${icfg} |
127 |
echo " ${x}-nofb" >> ${kmsg} |
128 |
fi |
129 |
@@ -186,12 +188,12 @@ case ${clst_hostarch} in |
130 |
eval custom_kopts=\$${x}_kernelopts |
131 |
|
132 |
echo "menuentry 'Boot LiveCD (kernel: ${x})' --class gnu-linux --class os {" >> ${iacfg} |
133 |
- echo " linux ${kern_subdir}/${x} ${default_append_line}" >> ${iacfg} |
134 |
+ echo " linux ${kern_subdir}/${x} ${default_append_line[@]}" >> ${iacfg} |
135 |
echo " initrd ${kern_subdir}/${x}.igz" >> ${iacfg} |
136 |
echo "}" >> ${iacfg} |
137 |
echo "" >> ${iacfg} |
138 |
echo "menuentry 'Boot LiveCD (kernel: ${x}) (cached)' --class gnu-linux --class os {" >> ${iacfg} |
139 |
- echo " linux ${kern_subdir}/${x} ${default_append_line} docache" >> ${iacfg} |
140 |
+ echo " linux ${kern_subdir}/${x} ${default_append_line[@]} docache" >> ${iacfg} |
141 |
echo " initrd ${kern_subdir}/${x}.igz" >> ${iacfg} |
142 |
echo "}" >> ${iacfg} |
143 |
if [ -n "${clst_kernel_console}" ] |
144 |
@@ -200,7 +202,7 @@ case ${clst_hostarch} in |
145 |
for y in ${clst_kernel_console} |
146 |
do |
147 |
echo "menuentry 'Boot LiveCD (kernel: ${x} console=${y})' --class gnu-linux --class os {" >> ${iacfg} |
148 |
- echo " linux ${kern_subdir}/${x} ${default_append_line} console=${y}" >> ${iacfg} |
149 |
+ echo " linux ${kern_subdir}/${x} ${default_append_line[@]} console=${y}" >> ${iacfg} |
150 |
echo " initrd ${kern_subdir}/${x}.igz" >> ${iacfg} |
151 |
echo "}" >> ${iacfg} |
152 |
echo "" >> ${iacfg} |
153 |
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh |
154 |
index a4074d91..b7969607 100755 |
155 |
--- a/targets/support/chroot-functions.sh |
156 |
+++ b/targets/support/chroot-functions.sh |
157 |
@@ -78,17 +78,17 @@ get_libdir() { |
158 |
|
159 |
setup_features() { |
160 |
setup_emerge_opts |
161 |
- local features="-news binpkg-multi-instance clean-logs parallel-install" |
162 |
- export FEATURES="${features}" |
163 |
+ local features=(-news binpkg-multi-instance clean-logs parallel-install) |
164 |
+ export FEATURES="${features[@]}" |
165 |
if [ -n "${clst_CCACHE}" ] |
166 |
then |
167 |
- features="${features} ccache" |
168 |
+ features+=(ccache) |
169 |
clst_root_path=/ run_merge --oneshot --noreplace dev-util/ccache || exit 1 |
170 |
fi |
171 |
|
172 |
if [ -n "${clst_DISTCC}" ] |
173 |
then |
174 |
- features="${features} distcc" |
175 |
+ features+=(distcc) |
176 |
export DISTCC_HOSTS="${clst_distcc_hosts}" |
177 |
[ -e ${clst_make_conf} ] && \ |
178 |
echo 'USE="${USE} -avahi -gtk -gnome"' >> ${clst_make_conf} |
179 |
@@ -133,28 +133,34 @@ setup_features() { |
180 |
export PATH="/usr/lib/icecc/bin:${PATH}" |
181 |
export PREROOTPATH="/usr/lib/icecc/bin" |
182 |
fi |
183 |
- export FEATURES="${features}" |
184 |
+ export FEATURES="${features[@]}" |
185 |
} |
186 |
|
187 |
setup_emerge_opts() { |
188 |
+ emerge_opts=() |
189 |
+ bootstrap_opts=() |
190 |
+ |
191 |
if [[ "${clst_VERBOSE}" == "true" ]] |
192 |
then |
193 |
- emerge_opts="--verbose" |
194 |
- bootstrap_opts="${bootstrap_opts} -v" |
195 |
+ emerge_opts+=(--verbose) |
196 |
+ bootstrap_opts+=(-v) |
197 |
else |
198 |
- emerge_opts="--quiet" |
199 |
- bootstrap_opts="${bootstrap_opts} -q" |
200 |
+ emerge_opts+=(--quiet) |
201 |
+ bootstrap_opts+=(-q) |
202 |
fi |
203 |
if [ -n "${clst_FETCH}" ] |
204 |
then |
205 |
- export bootstrap_opts="${bootstrap_opts} -f" |
206 |
- export emerge_opts="${emerge_opts} -f" |
207 |
+ emerge_opts+=(--fetchonly) |
208 |
+ bootstrap_opts+=(-f) |
209 |
# if we have PKGCACHE, and either update_seed is empty or 'no', make and use binpkgs |
210 |
elif [ -n "${clst_PKGCACHE}" ] && [ -z "${clst_update_seed}" -o "${clst_update_seed}" = "no" ] |
211 |
then |
212 |
- export emerge_opts="${emerge_opts} --usepkg --buildpkg --binpkg-respect-use=y --newuse" |
213 |
- export bootstrap_opts="${bootstrap_opts} -r" |
214 |
+ emerge_opts+=(--usepkg --buildpkg --binpkg-respect-use=y --newuse) |
215 |
+ bootstrap_opts+=(-r) |
216 |
fi |
217 |
+ |
218 |
+ export emerge_opts |
219 |
+ export bootstrap_opts |
220 |
} |
221 |
|
222 |
setup_binutils(){ |
223 |
@@ -274,13 +280,13 @@ run_merge() { |
224 |
|
225 |
if [[ "${clst_VERBOSE}" == "true" ]] |
226 |
then |
227 |
- echo "ROOT=${ROOT} emerge ${emerge_opts} -pt $@" || exit 1 |
228 |
- emerge ${emerge_opts} -pt $@ || exit 3 |
229 |
+ echo "ROOT=${ROOT} emerge ${emerge_opts[@]} -pt $@" || exit 1 |
230 |
+ emerge ${emerge_opts[@]} -pt $@ || exit 3 |
231 |
fi |
232 |
|
233 |
- echo "emerge ${emerge_opts} $@" || exit 1 |
234 |
+ echo "emerge ${emerge_opts[@]} $@" || exit 1 |
235 |
|
236 |
- emerge ${emerge_opts} $@ || exit 1 |
237 |
+ emerge ${emerge_opts[@]} $@ || exit 1 |
238 |
} |
239 |
|
240 |
show_debug() { |
241 |
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh |
242 |
index 8a15fc04..23489d8e 100755 |
243 |
--- a/targets/support/kmerge.sh |
244 |
+++ b/targets/support/kmerge.sh |
245 |
@@ -104,22 +104,22 @@ genkernel_compile(){ |
246 |
# callback is put here to avoid escaping issues |
247 |
if [[ "${clst_VERBOSE}" == "true" ]] |
248 |
then |
249 |
- gk_callback_opts="-vN" |
250 |
+ gk_callback_opts=(-vN) |
251 |
else |
252 |
- gk_callback_opts="-qN" |
253 |
+ gk_callback_opts=(-qN) |
254 |
fi |
255 |
PKGDIR=${PKGDIR} |
256 |
if [ -n "${clst_KERNCACHE}" ] |
257 |
then |
258 |
- gk_callback_opts="${gk_callback_opts} -kb" |
259 |
+ gk_callback_opts+=(-kb) |
260 |
fi |
261 |
if [ -n "${clst_FETCH}" ] |
262 |
then |
263 |
- gk_callback_opts="${gk_callback_opts} -f" |
264 |
+ gk_callback_opts+=(-f) |
265 |
fi |
266 |
if [ "${clst_kernel_merge}" != "" ] |
267 |
then |
268 |
- genkernel --callback="emerge ${gk_callback_opts} ${clst_kernel_merge}" \ |
269 |
+ genkernel --callback="emerge ${gk_callback_opts[@]} ${clst_kernel_merge}" \ |
270 |
"${GK_ARGS[@]}" || exit 1 |
271 |
else |
272 |
genkernel "${GK_ARGS[@]}" || exit 1 |
273 |
@@ -212,7 +212,7 @@ then |
274 |
|
275 |
# install dependencies of kernel sources ahead of time in case |
276 |
# package.provided generated below causes them not to be (re)installed |
277 |
- PKGDIR=${PKGDIR} emerge_opts="--quiet --usepkg --buildpkg --binpkg-respect-use=y --update --newuse --onlydeps" run_merge "${clst_ksource}" || exit 1 |
278 |
+ PKGDIR=${PKGDIR} emerge_opts=(--quiet --usepkg --buildpkg --binpkg-respect-use=y --update --newuse --onlydeps) run_merge "${clst_ksource}" || exit 1 |
279 |
|
280 |
# Create the kerncache directory if it doesn't exists |
281 |
mkdir -p /tmp/kerncache/${clst_kname} |
282 |
@@ -236,7 +236,7 @@ then |
283 |
|
284 |
[ -L /usr/src/linux ] && rm -f /usr/src/linux |
285 |
|
286 |
- PKGDIR=${PKGDIR} emerge_opts="--quiet --update --newuse" run_merge "${clst_ksource}" || exit 1 |
287 |
+ PKGDIR=${PKGDIR} emerge_opts=(--quiet --update --newuse) run_merge "${clst_ksource}" || exit 1 |
288 |
|
289 |
SOURCESDIR="/tmp/kerncache/${clst_kname}/sources" |
290 |
if [ -L /usr/src/linux ] |
291 |
-- |
292 |
2.26.2 |