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