1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # $Id$
|
---|
4 |
|
---|
5 | set +e
|
---|
6 |
|
---|
7 | # VT100 colors
|
---|
8 | declare -r BLACK=$'\e[1;30m'
|
---|
9 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
10 |
|
---|
11 | declare -r RED=$'\e[31m'
|
---|
12 | declare -r GREEN=$'\e[32m'
|
---|
13 | declare -r YELLOW=$'\e[33m'
|
---|
14 | declare -r BLUE=$'\e[34m'
|
---|
15 | declare -r MAGENTA=$'\e[35m'
|
---|
16 | declare -r CYAN=$'\e[36m'
|
---|
17 | declare -r WHITE=$'\e[37m'
|
---|
18 |
|
---|
19 | declare -r OFF=$'\e[0m'
|
---|
20 | declare -r BOLD=$'\e[1m'
|
---|
21 | declare -r REVERSE=$'\e[7m'
|
---|
22 | declare -r HIDDEN=$'\e[8m'
|
---|
23 |
|
---|
24 | declare -r tab_=$'\t'
|
---|
25 | declare -r nl_=$'\n'
|
---|
26 |
|
---|
27 | declare -r DD_BORDER="${BOLD}${WHITE}==============================================================================${OFF}"
|
---|
28 | declare -r SD_BORDER="${BOLD}${WHITE}------------------------------------------------------------------------------${OFF}"
|
---|
29 | declare -r STAR_BORDER="${BOLD}${WHITE}******************************************************************************${OFF}"
|
---|
30 |
|
---|
31 | # bold yellow > < pair
|
---|
32 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
33 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
34 |
|
---|
35 |
|
---|
36 | usage() {
|
---|
37 | 'clear'
|
---|
38 | cat <<- -EOF-
|
---|
39 | ${DD_BORDER}
|
---|
40 | ${BOLD}
|
---|
41 | Usage: $0 ${BOLD}[OPTION]
|
---|
42 |
|
---|
43 | Options:
|
---|
44 | ${BOLD} -h, --help${OFF}
|
---|
45 | print this help, then exit
|
---|
46 | ${BOLD} -V, --version${OFF}
|
---|
47 | print version information, then exit
|
---|
48 | ${BOLD} -D --directory DIR${OFF}
|
---|
49 | use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs produces will be
|
---|
50 | in the directory DIR/jhalfs.
|
---|
51 | ${BOLD} -R --rebuild${OFF}
|
---|
52 | clean the build directory before to perfom any other task. The directory
|
---|
53 | is cleaned only if it was populated by a previous jhalfs run.
|
---|
54 | ${BOLD} -G, --get-packages${OFF}
|
---|
55 | download the packages and patches. This assumes that the server declared in the
|
---|
56 | conf file has the proper packages and patches for the book version being processed.
|
---|
57 | ${BOLD} -T, --testsuites N ${OFF}
|
---|
58 | Run test suites [0-3]
|
---|
59 | 0 = none
|
---|
60 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
61 | 2 = all chapter06 testsuites
|
---|
62 | 3 = all chapter05 and chapter06 testsuites
|
---|
63 | ${BOLD} -W, --working-copy DIR${OFF}
|
---|
64 | use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book
|
---|
65 | ${BOLD} -B, --book VER${OFF}
|
---|
66 | checkout VER version of the LFS book. Supported versions at this time are:
|
---|
67 | dev* | trunk | SVN aliases for Development {C,H,B}LFS
|
---|
68 | alpha* aliases for the LFS alphabetical branch
|
---|
69 | udev* aliases for the LFS udev_update branch
|
---|
70 | ${BOLD} -F, --fstab FILE${OFF}
|
---|
71 | use FILE as the /etc/fstab file for the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} system. If not specified,
|
---|
72 | a default /etc/fstab file with dummy values is created.
|
---|
73 | ${BOLD} -K, --kernel-config FILE${OFF}
|
---|
74 | use the kernel configuration file specified in FILE to build the kernel.
|
---|
75 | if the file is not found, or if not specified, the kernel build is skipped.
|
---|
76 | ${BOLD} -M, --run-make${OFF}
|
---|
77 | run make on the generated Makefile
|
---|
78 | -EOF-
|
---|
79 |
|
---|
80 | [[ ${PROGNAME} = "clfs" ]] &&
|
---|
81 | cat <<- -EOF-
|
---|
82 | ${BOLD} -A, --arch ARCH ${OFF}
|
---|
83 | Select the TARGET architecture, valid selections are:
|
---|
84 | 32bit builds
|
---|
85 | x86, i486, i586, ppc, mips, mipsel, sparc, sparcv8
|
---|
86 | 64bit builds
|
---|
87 | x86_64-64, mips64-64, mipsel64-64, sparc64-64, alpha
|
---|
88 | 64bit multi-lib
|
---|
89 | x86_64, mips64, mipsel64, sparc64, ppc64
|
---|
90 | ${BOLD} --method BUILDMETHOD ${OFF}
|
---|
91 | Select the build method, chroot or boot
|
---|
92 | ${BOLD} --boot_config FILE ${OFF}
|
---|
93 | The configuration file for the bootstrap kernel if method=boot
|
---|
94 | -EOF-
|
---|
95 |
|
---|
96 | [[ ${PROGNAME} = "hlfs" ]] &&
|
---|
97 | cat <<- -EOF-
|
---|
98 | ${BOLD} --model STYLE ${OFF}
|
---|
99 | Select the library model for the HLFS system
|
---|
100 | Valid choices are: glibc or uclibc
|
---|
101 | -EOF-
|
---|
102 | cat <<- -EOF-
|
---|
103 | ${DD_BORDER}
|
---|
104 | -EOF-
|
---|
105 | exit
|
---|
106 | }
|
---|
107 |
|
---|
108 | usage2() {
|
---|
109 | 'clear'
|
---|
110 | cat <<- -EOF-
|
---|
111 | ${DD_BORDER}
|
---|
112 | ${BOLD}
|
---|
113 | Usage: $0 ${BOLD}[OPTION]
|
---|
114 |
|
---|
115 | Options:
|
---|
116 | ${BOLD} -h, --help${OFF}
|
---|
117 | print this help, then exit
|
---|
118 | ${BOLD} -V, --version${OFF}
|
---|
119 | print version number, then exit
|
---|
120 | ${BOLD} -d --directory DIR${OFF}
|
---|
121 | use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs produces will be
|
---|
122 | in the directory DIR/jhalfs.
|
---|
123 | ${BOLD} --rebuild${OFF}
|
---|
124 | clean the build directory before to perfom any other task. The directory
|
---|
125 | is cleaned only if it was populated by a previous jhalfs run.
|
---|
126 | ${BOLD} -P, --get-packages${OFF}
|
---|
127 | download the packages and patches. This assumes that the server declared in the
|
---|
128 | jhahlfs.conf file has the proper packages and patches for the book version being
|
---|
129 | processed.
|
---|
130 | ${BOLD} -D, --download-client CLIENT
|
---|
131 | use CLIENT as the program for retrieving packages (use in conjunction with -P)
|
---|
132 | ${BOLD} -W, --working-copy DIR${OFF}
|
---|
133 | use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book
|
---|
134 | ${BOLD} -L, --LFS-version VER${OFF}
|
---|
135 | checkout VER version of the HLFS book. Supported versions at this time are:
|
---|
136 | dev* | trunk | SVN aliases for Development {C,H,B}LFS
|
---|
137 | alpha* aliases for the LFS alphabetical branch
|
---|
138 | udev* aliases for the LFS udev_update branch
|
---|
139 | ${BOLD} --fstab FILE${OFF}
|
---|
140 | use FILE as the /etc/fstab file for the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} system. If not specified,
|
---|
141 | a default /etc/fstab file with dummy values is created.
|
---|
142 | ${BOLD} -C, --kernel-config FILE${OFF}
|
---|
143 | use the kernel configuration file specified in FILE to build the kernel.
|
---|
144 | if the file is not found, or if not specified, the kernel build is skipped.
|
---|
145 | ${BOLD} -M, --run-make${OFF}
|
---|
146 | run make on the generated Makefile
|
---|
147 | ${DD_BORDER}
|
---|
148 | -EOF-
|
---|
149 | exit
|
---|
150 | }
|
---|
151 |
|
---|
152 |
|
---|
153 | blfs_usage() {
|
---|
154 | 'clear'
|
---|
155 | cat <<- -EOF-
|
---|
156 | ${DD_BORDER}
|
---|
157 | ${BOLD}
|
---|
158 | Usage: $0 ${BOLD}[OPTION]
|
---|
159 |
|
---|
160 | Options:
|
---|
161 | ${BOLD} -h, --help${OFF}
|
---|
162 | print this help, then exit
|
---|
163 | ${BOLD} -V, --version${OFF}
|
---|
164 | print version number, then exit
|
---|
165 | ${BOLD} -B, --BLFS-version VER${OFF}
|
---|
166 | checkout VER version of the BLFS book.
|
---|
167 | If not set, the development version is used.
|
---|
168 |
|
---|
169 | Supported versions at this time are:
|
---|
170 | dev* | trunk | SVN aliases for Development BLFS
|
---|
171 | ${BOLD} -W, --working-copy DIR${OFF}
|
---|
172 | use the local working copy placed in DIR as the BLFS book
|
---|
173 | ${BOLD} -D, --dependencies TYPE${OFF}
|
---|
174 | add dependencies of type TYPE to the build tree.
|
---|
175 | If not set, both required a recommended are used.
|
---|
176 |
|
---|
177 | Possible values are:
|
---|
178 | required only required dependecies are used
|
---|
179 | recommended both required a recommended dependencies are used
|
---|
180 | optional all dependencies are used
|
---|
181 | ${BOLD} -S, --server SERVER${OFF}
|
---|
182 | set the FTP/HTTP server used as fallback to download the packages.
|
---|
183 | If not specified, the one set in jhablfs.conf is used.
|
---|
184 | ${BOLD} -T, --testsuites${OFF}
|
---|
185 | add support to run the optional testsuites
|
---|
186 | ${DD_BORDER}
|
---|
187 | -EOF-
|
---|
188 | exit
|
---|
189 | }
|
---|
190 |
|
---|
191 | version="
|
---|
192 | ${BOLD}\"${PROGNAME}\"${OFF} script module (development) \$Date$
|
---|
193 |
|
---|
194 | Written by Jeremy Huntwork,
|
---|
195 | Manuel Caneles Esparcia,
|
---|
196 | George Boudreau
|
---|
197 |
|
---|
198 | This program is published under the ${BOLD}Gnu General Public License, Version 2.${OFF}
|
---|
199 | "
|
---|
200 |
|
---|
201 |
|
---|
202 | no_empty_builddir() {
|
---|
203 | 'clear'
|
---|
204 | cat <<- -EOF-
|
---|
205 | ${DD_BORDER}
|
---|
206 |
|
---|
207 | ${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
|
---|
208 | Looks like the \$BUILDDIR directory contains subdirectories
|
---|
209 | from a previous HLFS build.
|
---|
210 |
|
---|
211 | Please format the partition mounted on \$BUILDDIR or set
|
---|
212 | a different build directory before running jhahlfs.
|
---|
213 | ${OFF}
|
---|
214 | ${DD_BORDER}
|
---|
215 | -EOF-
|
---|
216 | exit
|
---|
217 | }
|
---|
218 |
|
---|
219 |
|
---|
220 | help="${nl_}Try '$0 --help' for more information."
|
---|
221 |
|
---|
222 |
|
---|
223 | exit_missing_arg="\
|
---|
224 | echo \"Option '\$1' requires an argument\" >&2
|
---|
225 | echo \"\$help\" >&2
|
---|
226 | exit 1"
|
---|
227 |
|
---|
228 | no_dl_client="\
|
---|
229 | echo \"Could not find a way to download the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} sources.\" >&2
|
---|
230 | echo \"Attempting to continue.\" >&2"
|
---|
231 |
|
---|
232 | HEADER="# This file is automatically generated by jhalfs
|
---|
233 | # DO NOT EDIT THIS FILE MANUALLY
|
---|
234 | #
|
---|
235 | # Generated on `date \"+%F %X %Z\"`"
|
---|
236 |
|
---|
237 |
|
---|
238 |
|
---|
239 |
|
---|
240 |
|
---|
241 | #----------------------------------#
|
---|
242 | wrt_target() { #
|
---|
243 | #----------------------------------#
|
---|
244 | local i=$1
|
---|
245 | local PREV=$2
|
---|
246 | (
|
---|
247 | cat << EOF
|
---|
248 |
|
---|
249 | $i: $PREV
|
---|
250 | @\$(call echo_message, Building)
|
---|
251 | EOF
|
---|
252 | ) >> $MKFILE.tmp
|
---|
253 | }
|
---|
254 |
|
---|
255 |
|
---|
256 | #----------------------------------#
|
---|
257 | wrt_unpack() { #
|
---|
258 | #----------------------------------#
|
---|
259 | local FILE=$1
|
---|
260 | (
|
---|
261 | cat << EOF
|
---|
262 | @\$(call unpack,$FILE)
|
---|
263 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
264 | echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
---|
265 | chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
---|
266 | EOF
|
---|
267 | ) >> $MKFILE.tmp
|
---|
268 | }
|
---|
269 |
|
---|
270 |
|
---|
271 | #----------------------------------#
|
---|
272 | wrt_unpack2() { #
|
---|
273 | #----------------------------------#
|
---|
274 | local FILE=$1
|
---|
275 | (
|
---|
276 | cat << EOF
|
---|
277 | @\$(call unpack2,$FILE)
|
---|
278 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
279 | echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
|
---|
280 | EOF
|
---|
281 | ) >> $MKFILE.tmp
|
---|
282 | }
|
---|
283 |
|
---|
284 |
|
---|
285 | #=============================#
|
---|
286 | wrt_unpack3() { # Unpack and set 'ROOT' var
|
---|
287 | #=============================#
|
---|
288 | local FILE=$1
|
---|
289 | (
|
---|
290 | cat << EOF
|
---|
291 | @\$(call unpack3,$FILE)
|
---|
292 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
293 | echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
|
---|
294 | EOF
|
---|
295 | ) >> $MKFILE.tmp
|
---|
296 | }
|
---|
297 |
|
---|
298 |
|
---|
299 |
|
---|
300 | #----------------------------------#
|
---|
301 | wrt_target_vars() { # Target vars for hlfs (cross-build method)
|
---|
302 | #----------------------------------#
|
---|
303 | (
|
---|
304 | cat << EOF
|
---|
305 | @echo "export target=$(uname -m)-${TARGET}" >> envars && \\
|
---|
306 | echo "export ldso=/lib/${LOADER}" >> envars
|
---|
307 | EOF
|
---|
308 | ) >> $MKFILE.tmp
|
---|
309 |
|
---|
310 | }
|
---|
311 |
|
---|
312 |
|
---|
313 | #----------------------------------#
|
---|
314 | wrt_run_as_su() { #
|
---|
315 | #----------------------------------#
|
---|
316 | local this_script=$1
|
---|
317 | local file=$2
|
---|
318 | (
|
---|
319 | cat << EOF
|
---|
320 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$this_script && \\
|
---|
321 | su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 && \\
|
---|
322 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$this_script
|
---|
323 | EOF
|
---|
324 | ) >> $MKFILE.tmp
|
---|
325 | }
|
---|
326 |
|
---|
327 |
|
---|
328 | #==================================#
|
---|
329 | wrt_run_as_lfs() { # header to log file, execute script, footer to log file
|
---|
330 | #==================================#
|
---|
331 | local this_script=$1
|
---|
332 | local file=$2
|
---|
333 | (
|
---|
334 | cat << EOF
|
---|
335 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$this_script && \\
|
---|
336 | su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 && \\
|
---|
337 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$this_script
|
---|
338 | EOF
|
---|
339 | ) >> $MKFILE.tmp
|
---|
340 | }
|
---|
341 |
|
---|
342 |
|
---|
343 | #----------------------------------#
|
---|
344 | wrt_run_as_root() { #
|
---|
345 | #----------------------------------#
|
---|
346 | local this_script=$1
|
---|
347 | local file=$2
|
---|
348 | (
|
---|
349 | cat << EOF
|
---|
350 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$this_script && \\
|
---|
351 | export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
|
---|
352 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$this_script
|
---|
353 | EOF
|
---|
354 | ) >> $MKFILE.tmp
|
---|
355 | }
|
---|
356 |
|
---|
357 |
|
---|
358 | #=============================#
|
---|
359 | wrt_run_as_root2() { # Some scripts must be run as root..
|
---|
360 | #=============================#
|
---|
361 | local this_script=$1
|
---|
362 | local file=$2
|
---|
363 | (
|
---|
364 | cat << EOF
|
---|
365 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \`\n" >logs/$this_script && \\
|
---|
366 | source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
|
---|
367 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \`\n" >>logs/$this_script
|
---|
368 | EOF
|
---|
369 | ) >> $MKFILE.tmp
|
---|
370 | }
|
---|
371 |
|
---|
372 |
|
---|
373 | #----------------------------------#
|
---|
374 | wrt_remove_build_dirs() { #
|
---|
375 | #----------------------------------#
|
---|
376 | local name=$1
|
---|
377 | (
|
---|
378 | cat << EOF
|
---|
379 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
380 | rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
---|
381 | if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
|
---|
382 | rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
|
---|
383 | fi;
|
---|
384 | EOF
|
---|
385 | ) >> $MKFILE.tmp
|
---|
386 | }
|
---|
387 |
|
---|
388 |
|
---|
389 | #----------------------------------#
|
---|
390 | wrt_remove_build_dirs2() { #
|
---|
391 | #----------------------------------#
|
---|
392 | local name=$1
|
---|
393 | (
|
---|
394 | cat << EOF
|
---|
395 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
396 | rm -r \$(SRC)/\$\$ROOT && \\
|
---|
397 | if [ -e \$(SRC)/$name-build ]; then \\
|
---|
398 | rm -r \$(SRC)/$name-build; \\
|
---|
399 | fi;
|
---|
400 | EOF
|
---|
401 | ) >> $MKFILE.tmp
|
---|
402 | }
|
---|
403 |
|
---|
404 |
|
---|
405 |
|
---|
406 | #----------------------------------#
|
---|
407 | wrt_run_as_chroot1() { #
|
---|
408 | #----------------------------------#
|
---|
409 | local this_script=$1
|
---|
410 | local file=$2
|
---|
411 | (
|
---|
412 | cat << EOF
|
---|
413 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/${this_script} && \\
|
---|
414 | \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' && \\
|
---|
415 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/${this_script}
|
---|
416 | EOF
|
---|
417 | ) >> $MKFILE.tmp
|
---|
418 | }
|
---|
419 |
|
---|
420 |
|
---|
421 | #----------------------------------#
|
---|
422 | wrt_run_as_chroot2() { #
|
---|
423 | #----------------------------------#
|
---|
424 | local this_script=$1
|
---|
425 | local file=$2
|
---|
426 | (
|
---|
427 | cat << EOF
|
---|
428 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/${this_script} && \\
|
---|
429 | \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' && \\
|
---|
430 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/${this_script}
|
---|
431 | EOF
|
---|
432 | ) >> $MKFILE.tmp
|
---|
433 | }
|
---|
434 |
|
---|
435 |
|
---|
436 | #----------------------------------#
|
---|
437 | wrt_copy_fstab() { #
|
---|
438 | #----------------------------------#
|
---|
439 | local i=$1
|
---|
440 | (
|
---|
441 | cat << EOF
|
---|
442 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$i && \\
|
---|
443 | cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1 && \\
|
---|
444 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$i
|
---|
445 | EOF
|
---|
446 | ) >> $MKFILE.tmp
|
---|
447 | }
|
---|
448 |
|
---|
449 | #----------------------------------#
|
---|
450 | wrt_copy_fstab2() { #
|
---|
451 | #----------------------------------#
|
---|
452 | local i=$1
|
---|
453 | (
|
---|
454 | cat << EOF
|
---|
455 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \`\n" >logs/$i && \\
|
---|
456 | cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1 && \\
|
---|
457 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \`\n" >>logs/$i
|
---|
458 | EOF
|
---|
459 | ) >> $MKFILE.tmp
|
---|
460 | }
|
---|
461 |
|
---|
462 |
|
---|
463 | #----------------------------------#
|
---|
464 | wrt_export_pkgdir() { #
|
---|
465 | #----------------------------------#
|
---|
466 | (
|
---|
467 | cat << EOF
|
---|
468 | @echo "export PKGDIR=\$(SRC)/binutils-build" > envars
|
---|
469 | EOF
|
---|
470 | ) >> $MKFILE.tmp
|
---|
471 | }
|
---|
472 |
|
---|
473 |
|
---|
474 | #----------------------------#
|
---|
475 | run_make() {
|
---|
476 | #----------------------------#
|
---|
477 | # Test if make must be run.
|
---|
478 | if [ "$RUNMAKE" = "1" ] ; then
|
---|
479 | # Test to make sure we're running the build as root
|
---|
480 | if [ "$UID" != "0" ] ; then
|
---|
481 | echo "You must be logged in as root to successfully build LFS."
|
---|
482 | exit 1
|
---|
483 | fi
|
---|
484 | # Build the system
|
---|
485 | if [ -e $MKFILE ] ; then
|
---|
486 | echo -ne "Building the LFS system...\n"
|
---|
487 | cd $JHALFSDIR && make -f ${PROGNAME}-Makefile
|
---|
488 | echo -ne "done\n"
|
---|
489 | fi
|
---|
490 | fi
|
---|
491 | }
|
---|
492 |
|
---|
493 |
|
---|
494 | #----------------------------#
|
---|
495 | clean_builddir() {
|
---|
496 | #----------------------------#
|
---|
497 | # Test if the clean must be done.
|
---|
498 | if [ "$CLEAN" = "1" ] ; then
|
---|
499 | # Test to make sure we're running the clean as root
|
---|
500 | if [ "$UID" != "0" ] ; then
|
---|
501 | echo "You must be logged in as root to clean the build directory."
|
---|
502 | exit 1
|
---|
503 | fi
|
---|
504 | # Test to make sure that the build directory was populated by jhalfs
|
---|
505 | if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
---|
506 | echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
|
---|
507 | exit 1
|
---|
508 | else
|
---|
509 | # Clean the build directory
|
---|
510 | echo -ne "Cleaning $BUILDDIR...\n"
|
---|
511 | rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,usr,var}
|
---|
512 | echo -ne "Cleaning $JHALFSDIR...\n"
|
---|
513 | rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,commands,logs,Makefile,dump-lfs-scripts.xsl,functions,packages,patches}
|
---|
514 | echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
|
---|
515 | rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
|
---|
516 | echo -ne "done\n"
|
---|
517 | fi
|
---|
518 | fi
|
---|
519 | }
|
---|
520 |
|
---|
521 | #----------------------------#
|
---|
522 | get_book() {
|
---|
523 | #----------------------------#
|
---|
524 | cd $JHALFSDIR
|
---|
525 |
|
---|
526 | if [ -z $WC ] ; then
|
---|
527 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
528 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
529 | exit 1"
|
---|
530 | echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
---|
531 |
|
---|
532 | case $PROGNAME in
|
---|
533 | lfs) svn_root="LFS" ;;
|
---|
534 | hlfs) svn_root="HLFS" ;;
|
---|
535 | clfs) svn_root="cross-lfs" ;;
|
---|
536 | blfs) svn_root="BLFS" ;;
|
---|
537 | *) echo "BOOK not defined in function <get_book>"
|
---|
538 | exit 1 ;;
|
---|
539 | esac
|
---|
540 | # Grab a fresh LFS book if it's missing, otherwise, update it from the
|
---|
541 | # repo. If we've already extracted the commands, move on to getting the
|
---|
542 | # sources.
|
---|
543 | if [ -d ${PROGNAME}-$LFSVRS ] ; then
|
---|
544 | cd ${PROGNAME}-$LFSVRS
|
---|
545 | if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/commands && \
|
---|
546 | test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
|
---|
547 | echo -ne "done\n"
|
---|
548 | # Set the canonical book version
|
---|
549 | cd $JHALFSDIR
|
---|
550 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
551 | get_sources
|
---|
552 | else
|
---|
553 | echo -ne "done\n"
|
---|
554 | # Set the canonical book version
|
---|
555 | cd $JHALFSDIR
|
---|
556 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
557 | extract_commands
|
---|
558 | fi
|
---|
559 | else
|
---|
560 | case $LFSVRS in
|
---|
561 | development)
|
---|
562 | svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
|
---|
563 | alphabetical)
|
---|
564 | svn co $SVN/${svn_root}/branches/$LFSVRS/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
|
---|
565 | udev_update)
|
---|
566 | svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
|
---|
567 | esac
|
---|
568 | echo -ne "done\n"
|
---|
569 | # Set the canonical book version
|
---|
570 | cd $JHALFSDIR
|
---|
571 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
572 | extract_commands
|
---|
573 | fi
|
---|
574 | else
|
---|
575 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
576 | # Set the canonical book version
|
---|
577 | cd $JHALFSDIR
|
---|
578 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
579 | extract_commands
|
---|
580 | fi
|
---|
581 | }
|
---|
582 |
|
---|
583 |
|
---|
584 | #----------------------------#
|
---|
585 | build_patches_file() { # Supply a suitably formated list of patches.
|
---|
586 | #----------------------------#
|
---|
587 | local saveIFS=$IFS
|
---|
588 | local IFS
|
---|
589 |
|
---|
590 | rm -f patches
|
---|
591 |
|
---|
592 | LOC_add_patches_entry() {
|
---|
593 | for f in `grep "/$1-" patcheslist_.wget`; do
|
---|
594 | basename $f | sed "s|${2}|\&${1}-version;|" >> patches
|
---|
595 | done
|
---|
596 | }
|
---|
597 |
|
---|
598 | case ${PROGNAME} in
|
---|
599 | hlfs)
|
---|
600 | echo -n "Creating the ${L_arrow}${BOLD}HLFS${R_arrow} specific patcheslist_.wget file"
|
---|
601 | xsltproc --nonet \
|
---|
602 | --xinclude \
|
---|
603 | --stringparam model $MODEL \
|
---|
604 | -o patcheslist_.wget \
|
---|
605 | patcheslist.xsl \
|
---|
606 | $BOOK/chapter04/patches.xml
|
---|
607 | #> /dev/null 2>&1
|
---|
608 |
|
---|
609 | # .... U G L Y .... what to do with the grsecurity patch to the kernel..
|
---|
610 | for f in `grep "/grsecurity-" patcheslist_.wget`; do
|
---|
611 | basename $f >> patches
|
---|
612 | done
|
---|
613 | ;;
|
---|
614 |
|
---|
615 | clfs) # Pull out a list of arch specific patches
|
---|
616 | echo -n "Creating CLFS ${L_arrow}${BOLD}$ARCH${R_arrow} specific patcheslist_.wget file"
|
---|
617 | xsltproc -xinclude \
|
---|
618 | -o patcheslist_.wget \
|
---|
619 | patcheslist.xsl \
|
---|
620 | $BOOK/materials/${ARCH}-chapter.xml
|
---|
621 | ;;
|
---|
622 | *) return
|
---|
623 | esac
|
---|
624 |
|
---|
625 |
|
---|
626 | IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
|
---|
627 | for f in `cat packages`; do
|
---|
628 | IFS=$saveIFS # Restore the system defaults
|
---|
629 | LOC_add_patches_entry \
|
---|
630 | `echo $f | sed -e 's/-version//' \
|
---|
631 | -e 's/-file.*//' \
|
---|
632 | -e 's/"//g' \
|
---|
633 | -e 's/uclibc/uClibc/'`
|
---|
634 | done
|
---|
635 |
|
---|
636 | echo " ...OK"
|
---|
637 | }
|
---|
638 |
|
---|
639 |
|
---|
640 | #----------------------------#
|
---|
641 | extract_commands() { #
|
---|
642 | #----------------------------#
|
---|
643 | local saveIFS=$IFS
|
---|
644 |
|
---|
645 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
646 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
647 | exit 1"
|
---|
648 |
|
---|
649 | cd $JHALFSDIR
|
---|
650 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
651 |
|
---|
652 | # Start clean
|
---|
653 | if [ -d commands ]; then
|
---|
654 | rm -rf commands
|
---|
655 | mkdir -v commands
|
---|
656 | fi
|
---|
657 | echo -n "Extracting commands for"
|
---|
658 |
|
---|
659 | # Dump the commands in shell script form from the HLFS book.
|
---|
660 | case ${PROGNAME} in
|
---|
661 | clfs)
|
---|
662 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
---|
663 | xsltproc --nonet \
|
---|
664 | --xinclude \
|
---|
665 | --stringparam method $METHOD \
|
---|
666 | --stringparam testsuite $TEST \
|
---|
667 | --stringparam vim-lang $VIMLANG \
|
---|
668 | --stringparam timezone $TIMEZONE \
|
---|
669 | --stringparam page $PAGE \
|
---|
670 | --stringparam lang $LANG \
|
---|
671 | --stringparam keymap $KEYMAP \
|
---|
672 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
673 | ;;
|
---|
674 | hlfs)
|
---|
675 | echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS architecture"
|
---|
676 | xsltproc --nonet \
|
---|
677 | --xinclude \
|
---|
678 | --stringparam model $MODEL \
|
---|
679 | --stringparam testsuite $TEST \
|
---|
680 | --stringparam timezone $TIMEZONE \
|
---|
681 | --stringparam page $PAGE \
|
---|
682 | --stringparam lang $LANG \
|
---|
683 | --stringparam lc_all $LC_ALL \
|
---|
684 | --stringparam keymap $KEYMAP \
|
---|
685 | --stringparam grsecurity_host $GRSECURITY_HOST \
|
---|
686 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
687 | ;;
|
---|
688 | lfs)
|
---|
689 | echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
|
---|
690 | xsltproc --nonet \
|
---|
691 | --xinclude \
|
---|
692 | --stringparam testsuite $TEST \
|
---|
693 | --stringparam vim-lang $VIMLANG \
|
---|
694 | --stringparam timezone $TIMEZONE \
|
---|
695 | --stringparam page $PAGE \
|
---|
696 | --stringparam lang $LANG \
|
---|
697 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
698 | ;;
|
---|
699 | blfs)
|
---|
700 | echo -n " ${L_arrow}${BOLD}BLFS${R_arrow} build"
|
---|
701 | xsltproc --nonet \
|
---|
702 | --xinclude \
|
---|
703 | --stringparam testsuite $TEST \
|
---|
704 | --stringparam server $SERVER \
|
---|
705 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
706 | ;;
|
---|
707 | *) exit 1
|
---|
708 | esac
|
---|
709 |
|
---|
710 | echo " ...OK"
|
---|
711 |
|
---|
712 | # Make the scripts executable.
|
---|
713 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
714 |
|
---|
715 | # Grab the patches and package names.
|
---|
716 | for i in patches packages ; do
|
---|
717 | rm -f $i
|
---|
718 | done
|
---|
719 | #
|
---|
720 | case "${PROGNAME}" in
|
---|
721 | clfs)
|
---|
722 | ################################
|
---|
723 | # A LOCAL function
|
---|
724 | # xx_.wget contains arch specific files but in URL format
|
---|
725 | # Build a file with only arch specific files.. small ugly..
|
---|
726 | LOC_add_packages_entry() {
|
---|
727 | local fileMATCH aFILE
|
---|
728 |
|
---|
729 | # Deal with a non-standard format
|
---|
730 | if [[ "$1" = "clfs-bootscripts" ]]; then
|
---|
731 | set -- "bootscripts-cross-lfs" $2
|
---|
732 | fi
|
---|
733 | fileMATCH="/$1"
|
---|
734 |
|
---|
735 | # format.. Filename-Version or FilenameVersion
|
---|
736 | for aFILE in `grep ${fileMATCH}-*[[:digit:]] packageslist_.wget`; do
|
---|
737 | # Block vim-x.x-lang file, will add it later based on config flag
|
---|
738 | if [[ ! "${aFILE}" =~ "vim-$2-lang" ]]; then
|
---|
739 | echo "$1-version \"$2\"" >> packages
|
---|
740 | fi
|
---|
741 | done
|
---|
742 | }
|
---|
743 | #################################
|
---|
744 |
|
---|
745 | # We only want a list arch specific files..
|
---|
746 | # Unfortunately this script produces URL's which must be converted to a std format
|
---|
747 | echo -n "Creating CLFS ${L_arrow}${BOLD}${ARCH}${R_arrow} specific packageslist_.wget file"
|
---|
748 | xsltproc -xinclude \
|
---|
749 | -o packageslist_.wget \
|
---|
750 | packageslist.xsl \
|
---|
751 | $BOOK/materials/${ARCH}-chapter.xml
|
---|
752 |
|
---|
753 | # This has the correct format but contains packages from every book
|
---|
754 | grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
|
---|
755 | -e 's@">@"@' \
|
---|
756 | -e '/generic/d' > packages.tmp
|
---|
757 | # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
|
---|
758 | # separates each iteration by lines.
|
---|
759 | # Modify the 'internal field separator' to break on 'LF' only
|
---|
760 | IFS=$'\x0A'
|
---|
761 | for f in `cat packages.tmp`; do
|
---|
762 | IFS=$saveIFS # Restore the system defaults
|
---|
763 | LOC_add_packages_entry \
|
---|
764 | `echo $f | sed -e 's/-version//' \
|
---|
765 | -e 's/-file.*//' \
|
---|
766 | -e 's/"//g'`
|
---|
767 | done
|
---|
768 | echo " ...OK"
|
---|
769 | ;;
|
---|
770 |
|
---|
771 | hlfs)
|
---|
772 | echo -n "Creating <${PROGNAME}> specific packageslist_.wget file"
|
---|
773 | grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' \
|
---|
774 | -e 's@">@"@' \
|
---|
775 | -e '/generic/d' >> packages
|
---|
776 | echo " ...OK"
|
---|
777 | ;;
|
---|
778 |
|
---|
779 | lfs)
|
---|
780 | echo -n "Creating <${PROGNAME}> specific packageslist_.wget file"
|
---|
781 | grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' \
|
---|
782 | -e 's@">@"@' \
|
---|
783 | -e '/generic/d' >> packages
|
---|
784 | echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages
|
---|
785 | echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@'` >> packages
|
---|
786 | echo " ...OK"
|
---|
787 | ;;
|
---|
788 | esac
|
---|
789 |
|
---|
790 | # Download the vim-lang package if it must be installed
|
---|
791 | if [ "$VIMLANG" = "1" ] && [ ! "$PROGNAME" = "hlfs" ] ; then
|
---|
792 | echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
|
---|
793 | fi
|
---|
794 |
|
---|
795 | # There is no useful patches.ent file so we will create one.
|
---|
796 | case "${PROGNAME}" in
|
---|
797 | hlfs)
|
---|
798 | build_patches_file ;;
|
---|
799 | clfs )
|
---|
800 | build_patches_file ;;
|
---|
801 | lfs)
|
---|
802 | grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
---|
803 | ;;
|
---|
804 | blfs) ;;
|
---|
805 | *) exit 1
|
---|
806 | esac
|
---|
807 |
|
---|
808 | # Done. Moving on...
|
---|
809 | get_sources
|
---|
810 | }
|
---|
811 |
|
---|
812 |
|
---|
813 | #----------------------------#
|
---|
814 | download() { # Download file, write name to MISSING_FILES.DMP if an error
|
---|
815 | #----------------------------#
|
---|
816 | cd $BUILDDIR/sources
|
---|
817 |
|
---|
818 | # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn}
|
---|
819 | # that don't conform to norms in the URL scheme.
|
---|
820 | DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
|
---|
821 |
|
---|
822 | # If the file exists in the archive copy it to the $BUILDDIR/sources dir
|
---|
823 | # MD5SUM is assumed to be correct from previous download
|
---|
824 | if [ ! -z ${SRC_ARCHIVE} ] &&
|
---|
825 | [ -d ${SRC_ARCHIVE} ] &&
|
---|
826 | [ -f ${SRC_ARCHIVE}/$2 ]; then
|
---|
827 | cp ${SRC_ARCHIVE}/$2 .
|
---|
828 | echo "$2: -- ok"
|
---|
829 | return
|
---|
830 | fi
|
---|
831 |
|
---|
832 | # Find the md5 sum for this package.
|
---|
833 | if [ $2 != MD5SUMS ] ; then
|
---|
834 | set +e
|
---|
835 | MD5=`grep " $2" MD5SUMS`
|
---|
836 | if [ $? -ne 0 ]; then
|
---|
837 | set -e
|
---|
838 | echo "${RED}$2 not found in MD5SUMS${OFF}"
|
---|
839 | echo "$2 not found in MD5SUMS" >> MISSING_FILES.DMP
|
---|
840 | return
|
---|
841 | fi
|
---|
842 | set -e
|
---|
843 | fi
|
---|
844 |
|
---|
845 | if [ ! -f $2 ] ; then
|
---|
846 | case $DL in
|
---|
847 | wgetFTP ) wget --passive $FTP/$DIR/$2 ;;
|
---|
848 | wget ) wget $HTTP/$DIR/$2 ;;
|
---|
849 | curl ) `curl -# $FTP/$DIR/$2 -o $2` ;;
|
---|
850 | * ) echo "$DL not supported at this time." ;;
|
---|
851 | esac
|
---|
852 | elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
|
---|
853 | case $DL in
|
---|
854 | wgetFTP ) wget --passive -c $FTP/$DIR/$2 ;;
|
---|
855 | wget ) wget -c $HTTP/$DIR/$2 ;;
|
---|
856 | curl ) `curl -# -C - $FTP/$DIR/$2 -o $2` ;;
|
---|
857 | * ) echo "$DL not supported at this time." ;;
|
---|
858 | esac
|
---|
859 | fi
|
---|
860 |
|
---|
861 | if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
|
---|
862 | exit 1
|
---|
863 | fi
|
---|
864 | if [ $2 != MD5SUMS ] ; then
|
---|
865 | echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
|
---|
866 | fi
|
---|
867 |
|
---|
868 | # If we make it this far we should copy the freshly downloaded file
|
---|
869 | # to the source archive.
|
---|
870 | if [ ! -z ${SRC_ARCHIVE} ] &&
|
---|
871 | [ -d ${SRC_ARCHIVE} ] &&
|
---|
872 | [ -w ${SRC_ARCHIVE} ] &&
|
---|
873 | [ $2 != MD5SUMS ]; then
|
---|
874 | echo "Store file:<$2> in package archive"
|
---|
875 | cp -v $2 ${SRC_ARCHIVE}
|
---|
876 | fi
|
---|
877 |
|
---|
878 | }
|
---|
879 |
|
---|
880 |
|
---|
881 | #----------------------------#
|
---|
882 | get_sources() {
|
---|
883 | #----------------------------#
|
---|
884 |
|
---|
885 | # Test if the packages must be downloaded
|
---|
886 | if [ "$HPKG" = "1" ] ; then
|
---|
887 |
|
---|
888 | # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
|
---|
889 | # separates each iteration by lines.
|
---|
890 | # Modify the 'internal field separator' to break on 'LF' only
|
---|
891 | IFS=$'\x0A'
|
---|
892 |
|
---|
893 | if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
|
---|
894 | cd $BUILDDIR/sources
|
---|
895 | if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
|
---|
896 | if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
|
---|
897 | if [ -f MISSING_FILES.DMP ] ; then rm MISSING_FILES.DMP ; fi
|
---|
898 |
|
---|
899 | download "" MD5SUMS
|
---|
900 |
|
---|
901 | # Iterate through each package and grab it, along with any patches it needs.
|
---|
902 | for i in `cat $JHALFSDIR/packages` ; do
|
---|
903 | PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'`
|
---|
904 |
|
---|
905 | # There are some entities that aren't valid packages.
|
---|
906 | if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
|
---|
907 |
|
---|
908 | VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
|
---|
909 | case $PKG in
|
---|
910 | tcl) FILE="$PKG$VRS-src.tar.bz2" ;;
|
---|
911 | vim-lang) PKG="vim"
|
---|
912 | FILE="vim-$VRS-lang.tar.bz2" ;;
|
---|
913 | udev-config) PKG="udev"
|
---|
914 | FILE="$VRS" ;;
|
---|
915 | *) FILE="$PKG-$VRS.tar.bz2" ;;
|
---|
916 | esac
|
---|
917 | download $PKG $FILE
|
---|
918 |
|
---|
919 | # Download any associated patches
|
---|
920 | for patch in `grep "&$PKG-version" $JHALFSDIR/patches` ; do
|
---|
921 | PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
|
---|
922 | download $PKG $PATCH
|
---|
923 | done
|
---|
924 | done
|
---|
925 | if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
|
---|
926 | echo -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n"
|
---|
927 | fi
|
---|
928 | fi
|
---|
929 | }
|
---|
930 |
|
---|
931 | #-----------------------------------------------#
|
---|
932 | _IS_() # Function to test build scripts names
|
---|
933 | #-----------------------------------------------#
|
---|
934 | {
|
---|
935 | # Returns substr $2 or null str
|
---|
936 | # Must use string testing
|
---|
937 | case $1 in
|
---|
938 | *$2*) echo "$2" ;;
|
---|
939 | *) echo "" ;;
|
---|
940 | esac
|
---|
941 | }
|
---|