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