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