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