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