[877cc6a] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | set +e
|
---|
| 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 |
|
---|
[47e524f] | 27 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
| 28 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
| 29 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
[877cc6a] | 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 |
|
---|
[efc0d1e] | 42 | ${RED}IMPORTANT:${OFF} Only supported command line switches are listed here.
|
---|
[4dd25a1] | 43 | For more fine-grained setups you must edit the relevant
|
---|
[efc0d1e] | 44 | configuration files placed under ${BOLD}common/${OFF} and ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])/${OFF}
|
---|
| 45 |
|
---|
[877cc6a] | 46 | Options:
|
---|
| 47 | ${BOLD} -h, --help${OFF}
|
---|
| 48 | print this help, then exit
|
---|
| 49 |
|
---|
| 50 | ${BOLD} -V, --version${OFF}
|
---|
| 51 | print version information, then exit
|
---|
| 52 |
|
---|
| 53 | ${BOLD} -B, --book VER${OFF}
|
---|
[e2fa2bd] | 54 | use VER version of the book as the system to build.
|
---|
| 55 | Supported versions are: dev*, trunk, SVN
|
---|
[1ec8fce] | 56 | These are aliases for the Development version of {C,H}LFS
|
---|
[877cc6a] | 57 |
|
---|
| 58 | ${BOLD} -D --directory DIR${OFF}
|
---|
[73e5448] | 59 | use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs produces
|
---|
[1a1f099] | 60 | will be in the directory DIR/${SCRIPT_ROOT}.
|
---|
[511923a] | 61 | The current setting for BUILDDIR is "$BUILDDIR"
|
---|
[877cc6a] | 62 |
|
---|
| 63 | ${BOLD} -G, --get-packages${OFF}
|
---|
| 64 | download the packages and patches. This assumes that the server declared
|
---|
| 65 | in the configuration file has the proper packages and patches for the
|
---|
| 66 | book version being processed.
|
---|
| 67 |
|
---|
[1b65a84] | 68 | ${BOLD} -O, --optimize${OFF}
|
---|
| 69 | Optimize [0-2]
|
---|
| 70 | 0 = no optimization
|
---|
[1ec8fce] | 71 | 1 = optimize final system only
|
---|
| 72 | 2 = optimize both temporary tools and final system
|
---|
[1b65a84] | 73 | Edit common/opt_config{,.d/*} and common/opt_override as desired.
|
---|
| 74 |
|
---|
[877cc6a] | 75 | ${BOLD} -T, --testsuites N ${OFF}
|
---|
| 76 | Run test suites [0-3]
|
---|
| 77 | 0 = none
|
---|
[0755d1a] | 78 | 1 = only final system Glibc, GCC and Binutils testsuites
|
---|
| 79 | 2 = all final system testsuites
|
---|
[b240ee6] | 80 | 3 = all temporary tools and final system testsuites
|
---|
[877cc6a] | 81 | In CLFS, 3 is an alias to 2
|
---|
| 82 |
|
---|
| 83 | ${BOLD} -W, --working-copy DIR${OFF}
|
---|
| 84 | use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book
|
---|
| 85 |
|
---|
[45f82718] | 86 | ${BOLD} -C, --comparasion TYPE${OFF}
|
---|
[e2fa2bd] | 87 | do iterative comparison analysis. This extends the total build time
|
---|
| 88 | considerably because the entire final system will rebuild itself
|
---|
| 89 | the number of times specified by ITERATIONS in common/config.
|
---|
[6dcfd53] | 90 | Types allowed are:
|
---|
[e2fa2bd] | 91 | ICA = do ICA as designed by Greg Schafer
|
---|
[0ad851d] | 92 | farce = do the farce analysis designed by Ken Moffat
|
---|
| 93 | both = perfom both ICA and farce analysis
|
---|
[45f82718] | 94 |
|
---|
[877cc6a] | 95 | ${BOLD} -F, --fstab FILE${OFF}
|
---|
| 96 | use FILE as the /etc/fstab file for the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} system. If not specified,
|
---|
| 97 | a default /etc/fstab file with dummy values is created.
|
---|
| 98 |
|
---|
| 99 | ${BOLD} -K, --kernel-config FILE${OFF}
|
---|
| 100 | use the kernel configuration file specified in FILE to build the kernel.
|
---|
| 101 | if the file is not found, or if not specified, the kernel build is skipped.
|
---|
| 102 |
|
---|
| 103 | ${BOLD} -M, --run-make${OFF}
|
---|
| 104 | run make on the generated Makefile
|
---|
| 105 |
|
---|
| 106 | ${BOLD} -R --rebuild${OFF}
|
---|
[e2fa2bd] | 107 | clean the build directory before perfoming any other task. The directory
|
---|
[73e5448] | 108 | is cleaned only if it was populated by a previous jhalfs run.
|
---|
[877cc6a] | 109 | -EOF-
|
---|
| 110 |
|
---|
| 111 | [[ ${PROGNAME} = "clfs" ]] &&
|
---|
| 112 | cat <<- -EOF-
|
---|
| 113 |
|
---|
| 114 | ${BOLD} -A, --arch ARCH ${OFF}
|
---|
| 115 | Select the TARGET architecture, valid selections are:
|
---|
| 116 | 32bit builds
|
---|
[b0dd4bd] | 117 | x86, i486, i586, ppc, mips, mipsel, sparc
|
---|
[877cc6a] | 118 | 64bit builds
|
---|
| 119 | x86_64-64, mips64-64, mipsel64-64, sparc64-64, alpha
|
---|
| 120 | 64bit multi-lib
|
---|
| 121 | x86_64, mips64, mipsel64, sparc64, ppc64
|
---|
| 122 |
|
---|
[c7c5a53] | 123 | ${BOLD} --boot-config FILE ${OFF}
|
---|
[877cc6a] | 124 | The configuration file for the bootstrap kernel if method=boot
|
---|
| 125 |
|
---|
| 126 | ${BOLD} --method BUILDMETHOD ${OFF}
|
---|
| 127 | Select the build method, chroot or boot
|
---|
| 128 | -EOF-
|
---|
| 129 |
|
---|
| 130 | [[ ${PROGNAME} = "hlfs" ]] &&
|
---|
| 131 | cat <<- -EOF-
|
---|
| 132 |
|
---|
| 133 | ${BOLD} --model STYLE ${OFF}
|
---|
| 134 | Select the library model for the HLFS system
|
---|
| 135 | Valid choices are: glibc or uclibc
|
---|
| 136 | -EOF-
|
---|
| 137 |
|
---|
| 138 | cat <<- -EOF-
|
---|
| 139 | ${DD_BORDER}
|
---|
| 140 | -EOF-
|
---|
| 141 | exit
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | version="
|
---|
[73e5448] | 145 | ${BOLD} \"jhalfs\"${OFF} builder tool (development) \$Rev$
|
---|
[877cc6a] | 146 | \$Date$
|
---|
| 147 |
|
---|
| 148 | ${BOLD} \"${PROGNAME}\"${OFF} script module
|
---|
| 149 |
|
---|
| 150 | Written by George Boudreau,
|
---|
| 151 | Manuel Canales Esparcia,
|
---|
| 152 | Jeremy Huntwork
|
---|
| 153 |
|
---|
| 154 | This program is published under the ${BOLD}Gnu General Public License, Version 2.${OFF}
|
---|
| 155 | "
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 | no_empty_builddir() {
|
---|
| 159 | 'clear'
|
---|
| 160 | cat <<- -EOF-
|
---|
| 161 | ${DD_BORDER}
|
---|
| 162 |
|
---|
| 163 | ${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
|
---|
| 164 | Looks like the \$BUILDDIR directory contains subdirectories
|
---|
| 165 | from a previous HLFS build.
|
---|
| 166 |
|
---|
| 167 | Please format the partition mounted on \$BUILDDIR or set
|
---|
[73e5448] | 168 | a different build directory before running jhalfs.
|
---|
[877cc6a] | 169 | ${OFF}
|
---|
| 170 | ${DD_BORDER}
|
---|
| 171 | -EOF-
|
---|
| 172 | exit
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 |
|
---|
| 176 | help="${nl_}Try '$0 --help' for more information."
|
---|
| 177 |
|
---|
| 178 | exit_missing_arg="\
|
---|
| 179 | echo \"Option '\$1' requires an argument\" >&2
|
---|
| 180 | echo \"\$help\" >&2
|
---|
| 181 | exit 1"
|
---|
| 182 |
|
---|
[73e5448] | 183 | HEADER="# This file is automatically generated by jhalfs
|
---|
[877cc6a] | 184 | # DO NOT EDIT THIS FILE MANUALLY
|
---|
| 185 | #
|
---|
| 186 | # Generated on `date \"+%F %X %Z\"`"
|
---|
| 187 |
|
---|
| 188 |
|
---|
| 189 |
|
---|
| 190 | #----------------------------------#
|
---|
[3a321ea] | 191 | wrt_target() { # Create target and initialize log file
|
---|
[877cc6a] | 192 | #----------------------------------#
|
---|
| 193 | local i=$1
|
---|
| 194 | local PREV=$2
|
---|
[4edf3b7] | 195 | case $i in
|
---|
| 196 | iteration* ) local LOGFILE=$this_script.log ;;
|
---|
| 197 | * ) local LOGFILE=$this_script ;;
|
---|
| 198 | esac
|
---|
[877cc6a] | 199 | (
|
---|
| 200 | cat << EOF
|
---|
| 201 |
|
---|
| 202 | $i: $PREV
|
---|
| 203 | @\$(call echo_message, Building)
|
---|
[46758a2] | 204 | @./progress_bar.sh \$@ &
|
---|
[1a1f099] | 205 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
|
---|
[877cc6a] | 206 | EOF
|
---|
| 207 | ) >> $MKFILE.tmp
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 |
|
---|
[5842156] | 211 | #----------------------------------#
|
---|
| 212 | wrt_remove_existing_dirs() { #
|
---|
| 213 | #----------------------------------#
|
---|
| 214 | local PKG_NAME=$1
|
---|
| 215 | (
|
---|
| 216 | cat << EOF
|
---|
[3b3251a] | 217 | @PKG_PATH=\`ls -t \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1\` && \\
|
---|
| 218 | ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
|
---|
[5842156] | 219 | [[ -n \$\$ROOT ]] && \\
|
---|
| 220 | rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
---|
[15787a3] | 221 | if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build ]; then \\
|
---|
| 222 | rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%-*}-build; \\
|
---|
[5842156] | 223 | fi;
|
---|
| 224 | EOF
|
---|
| 225 | ) >> $MKFILE.tmp
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | #----------------------------------#
|
---|
| 229 | wrt_remove_existing_dirs2() { #
|
---|
| 230 | #----------------------------------#
|
---|
| 231 | local PKG_NAME=$1
|
---|
| 232 | (
|
---|
| 233 | cat << EOF
|
---|
[3b3251a] | 234 | @PKG_PATH=\`ls -t \$(SRC)/${PKG_NAME} | head -n1\` && \\
|
---|
| 235 | ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
|
---|
[5842156] | 236 | [[ -n \$\$ROOT ]] && \\
|
---|
| 237 | rm -rf \$(SRC)/\$\$ROOT && \\
|
---|
[15787a3] | 238 | if [ -e \$(SRC)/${PKG_NAME%-*}-build ]; then \\
|
---|
| 239 | rm -rf \$(SRC)/${PKG_NAME%-*}-build; \\
|
---|
[5842156] | 240 | fi;
|
---|
| 241 | EOF
|
---|
| 242 | ) >> $MKFILE.tmp
|
---|
| 243 | }
|
---|
| 244 |
|
---|
| 245 |
|
---|
| 246 |
|
---|
[877cc6a] | 247 | #----------------------------------#
|
---|
| 248 | wrt_unpack() { # Unpack and set 'ROOT' var
|
---|
| 249 | #----------------------------------#
|
---|
| 250 | local FILE=$1
|
---|
[5842156] | 251 | local optSAVE_PREVIOUS=$2
|
---|
[82eb8c1] | 252 |
|
---|
[5842156] | 253 | if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
---|
| 254 | wrt_remove_existing_dirs "$FILE"
|
---|
| 255 | fi
|
---|
[877cc6a] | 256 | (
|
---|
| 257 | cat << EOF
|
---|
| 258 | @\$(call unpack,$FILE)
|
---|
[82eb8c1] | 259 | @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[877cc6a] | 260 | echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
---|
[15537d5] | 261 | chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
---|
[877cc6a] | 262 | EOF
|
---|
| 263 | ) >> $MKFILE.tmp
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 |
|
---|
| 267 | #----------------------------------#
|
---|
| 268 | wrt_unpack2() { #
|
---|
| 269 | #----------------------------------#
|
---|
| 270 | local FILE=$1
|
---|
[5842156] | 271 | local optSAVE_PREVIOUS=$2
|
---|
| 272 |
|
---|
| 273 | if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
---|
| 274 | wrt_remove_existing_dirs "$FILE"
|
---|
| 275 | fi
|
---|
[877cc6a] | 276 | (
|
---|
| 277 | cat << EOF
|
---|
| 278 | @\$(call unpack2,$FILE)
|
---|
[a229600] | 279 | @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[877cc6a] | 280 | echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
|
---|
| 281 | EOF
|
---|
| 282 | ) >> $MKFILE.tmp
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 |
|
---|
[261eea6] | 286 | #----------------------------------#
|
---|
| 287 | wrt_unpack3() { #
|
---|
| 288 | #----------------------------------#
|
---|
[877cc6a] | 289 | local FILE=$1
|
---|
[5842156] | 290 | local optSAVE_PREVIOUS=$2
|
---|
| 291 |
|
---|
| 292 | if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
---|
| 293 | wrt_remove_existing_dirs2 "$FILE"
|
---|
| 294 | fi
|
---|
[877cc6a] | 295 | (
|
---|
| 296 | cat << EOF
|
---|
| 297 | @\$(call unpack3,$FILE)
|
---|
[82eb8c1] | 298 | @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[877cc6a] | 299 | echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
|
---|
| 300 | EOF
|
---|
| 301 | ) >> $MKFILE.tmp
|
---|
| 302 | }
|
---|
| 303 |
|
---|
[a229600] | 304 | #----------------------------------#
|
---|
| 305 | wrt_test_log() { # Initialize testsuite log file
|
---|
| 306 | #----------------------------------#
|
---|
| 307 | local TESTLOGFILE=$1
|
---|
| 308 | (
|
---|
| 309 | cat << EOF
|
---|
| 310 | @echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
---|
| 311 | su - lfs -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"
|
---|
| 312 | EOF
|
---|
| 313 | ) >> $MKFILE.tmp
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | #----------------------------------#
|
---|
| 317 | wrt_test_log2() { #
|
---|
| 318 | #----------------------------------#
|
---|
| 319 | local TESTLOGFILE=$1
|
---|
| 320 | (
|
---|
| 321 | cat << EOF
|
---|
| 322 | @echo "export TEST_LOG=/$SCRIPT_ROOT/test-logs/$TESTLOGFILE" >> envars && \\
|
---|
| 323 | echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE
|
---|
| 324 | EOF
|
---|
| 325 | ) >> $MKFILE.tmp
|
---|
| 326 | }
|
---|
| 327 |
|
---|
[877cc6a] | 328 | #----------------------------------#
|
---|
| 329 | wrt_target_vars() { # Target vars for hlfs (cross-build method)
|
---|
| 330 | #----------------------------------#
|
---|
| 331 | (
|
---|
| 332 | cat << EOF
|
---|
| 333 | @echo "export target=$(uname -m)-${TARGET}" >> envars && \\
|
---|
| 334 | echo "export ldso=/lib/${LOADER}" >> envars
|
---|
| 335 | EOF
|
---|
| 336 | ) >> $MKFILE.tmp
|
---|
| 337 |
|
---|
| 338 | }
|
---|
| 339 |
|
---|
| 340 |
|
---|
| 341 | #----------------------------------#
|
---|
[3a321ea] | 342 | wrt_run_as_su() { # Execute script inside time { }, footer to log file
|
---|
[877cc6a] | 343 | #----------------------------------#
|
---|
| 344 | local this_script=$1
|
---|
| 345 | local file=$2
|
---|
| 346 | (
|
---|
| 347 | cat << EOF
|
---|
[3a321ea] | 348 | @( time { su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
---|
[1a1f099] | 349 | echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
---|
[877cc6a] | 350 | EOF
|
---|
| 351 | ) >> $MKFILE.tmp
|
---|
| 352 | }
|
---|
| 353 |
|
---|
| 354 |
|
---|
| 355 | #----------------------------------#
|
---|
[3a321ea] | 356 | wrt_run_as_root() { # Some scripts must be run as root..
|
---|
[877cc6a] | 357 | #----------------------------------#
|
---|
| 358 | local this_script=$1
|
---|
| 359 | local file=$2
|
---|
| 360 | (
|
---|
| 361 | cat << EOF
|
---|
[3a321ea] | 362 | @( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
---|
[1a1f099] | 363 | echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
---|
[877cc6a] | 364 | EOF
|
---|
| 365 | ) >> $MKFILE.tmp
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 |
|
---|
[261eea6] | 369 | #----------------------------------#
|
---|
| 370 | wrt_run_as_root2() { #
|
---|
| 371 | #----------------------------------#
|
---|
[877cc6a] | 372 | local this_script=$1
|
---|
| 373 | local file=$2
|
---|
| 374 | (
|
---|
| 375 | cat << EOF
|
---|
[3a321ea] | 376 | @( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
---|
[1a1f099] | 377 | echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script
|
---|
[877cc6a] | 378 | EOF
|
---|
| 379 | ) >> $MKFILE.tmp
|
---|
| 380 | }
|
---|
| 381 |
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | #----------------------------------#
|
---|
| 385 | wrt_run_as_chroot1() { #
|
---|
| 386 | #----------------------------------#
|
---|
| 387 | local this_script=$1
|
---|
| 388 | local file=$2
|
---|
| 389 | (
|
---|
| 390 | cat << EOF
|
---|
[1a1f099] | 391 | @( time { \$(CHROOT1) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
|
---|
| 392 | echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script}
|
---|
[877cc6a] | 393 | EOF
|
---|
| 394 | ) >> $MKFILE.tmp
|
---|
| 395 | }
|
---|
| 396 |
|
---|
| 397 |
|
---|
| 398 | #----------------------------------#
|
---|
| 399 | wrt_run_as_chroot2() { #
|
---|
| 400 | #----------------------------------#
|
---|
| 401 | local this_script=$1
|
---|
| 402 | local file=$2
|
---|
| 403 | (
|
---|
| 404 | cat << EOF
|
---|
[1a1f099] | 405 | @( time { \$(CHROOT2) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
|
---|
| 406 | echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script}
|
---|
[877cc6a] | 407 | EOF
|
---|
| 408 | ) >> $MKFILE.tmp
|
---|
| 409 | }
|
---|
| 410 |
|
---|
| 411 |
|
---|
| 412 | #----------------------------------#
|
---|
| 413 | wrt_copy_fstab() { #
|
---|
| 414 | #----------------------------------#
|
---|
| 415 | local i=$1
|
---|
| 416 | (
|
---|
| 417 | cat << EOF
|
---|
[3a321ea] | 418 | @cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1
|
---|
[877cc6a] | 419 | EOF
|
---|
| 420 | ) >> $MKFILE.tmp
|
---|
| 421 | }
|
---|
| 422 |
|
---|
| 423 | #----------------------------------#
|
---|
[3a321ea] | 424 | wrt_copy_fstab2() { #
|
---|
[877cc6a] | 425 | #----------------------------------#
|
---|
| 426 | local i=$1
|
---|
| 427 | (
|
---|
| 428 | cat << EOF
|
---|
[3a321ea] | 429 | @cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1
|
---|
[877cc6a] | 430 | EOF
|
---|
| 431 | ) >> $MKFILE.tmp
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 |
|
---|
| 435 | #----------------------------------#
|
---|
[0bdf6ed] | 436 | wrt_remove_build_dirs() { #
|
---|
[877cc6a] | 437 | #----------------------------------#
|
---|
[0bdf6ed] | 438 | local name=$1
|
---|
[877cc6a] | 439 | (
|
---|
[0bdf6ed] | 440 | cat << EOF
|
---|
[82eb8c1] | 441 | @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[b7faa5a] | 442 | rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
---|
| 443 | if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
|
---|
[0bdf6ed] | 444 | rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
|
---|
| 445 | fi;
|
---|
| 446 | EOF
|
---|
| 447 | ) >> $MKFILE.tmp
|
---|
| 448 | }
|
---|
| 449 |
|
---|
| 450 |
|
---|
| 451 | #----------------------------------#
|
---|
| 452 | wrt_remove_build_dirs2() { #
|
---|
| 453 | #----------------------------------#
|
---|
| 454 | local name=$1
|
---|
| 455 | (
|
---|
| 456 | cat << EOF
|
---|
[82eb8c1] | 457 | @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[b7faa5a] | 458 | rm -r \$(SRC)/\$\$ROOT && \\
|
---|
| 459 | if [ -e \$(SRC)/$name-build ]; then \\
|
---|
[0bdf6ed] | 460 | rm -r \$(SRC)/$name-build; \\
|
---|
| 461 | fi;
|
---|
[877cc6a] | 462 | EOF
|
---|
| 463 | ) >> $MKFILE.tmp
|
---|
| 464 | }
|
---|
| 465 |
|
---|
| 466 |
|
---|
[e2ef100] | 467 | #----------------------------------#
|
---|
| 468 | wrt_touch() { #
|
---|
| 469 | #----------------------------------#
|
---|
| 470 | (
|
---|
| 471 | cat << EOF
|
---|
| 472 | @touch \$@ && \\
|
---|
| 473 | sleep .25 && \\
|
---|
[4a444f1] | 474 | echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 475 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
[e2ef100] | 476 | EOF
|
---|
| 477 | ) >> $MKFILE.tmp
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 |
|
---|
[453bef0] | 481 | #----------------------------------#
|
---|
[261eea6] | 482 | wrt_report() { #
|
---|
[453bef0] | 483 | #----------------------------------#
|
---|
| 484 | (
|
---|
| 485 | cat << EOF
|
---|
| 486 |
|
---|
| 487 | create-sbu_du-report: $PREV
|
---|
| 488 | @\$(call echo_message, Building)
|
---|
[a9429d5] | 489 | @./create-sbu_du-report.sh logs $VERSION
|
---|
[453bef0] | 490 | @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
|
---|
| 491 | @touch \$@
|
---|
| 492 | EOF
|
---|
| 493 | ) >> $MKFILE.tmp
|
---|
| 494 |
|
---|
| 495 | chapter789="$chapter789 create-sbu_du-report"
|
---|
| 496 | }
|
---|
| 497 |
|
---|
| 498 |
|
---|
[877cc6a] | 499 | #----------------------------#
|
---|
[261eea6] | 500 | run_make() { #
|
---|
[877cc6a] | 501 | #----------------------------#
|
---|
| 502 | # Test if make must be run.
|
---|
| 503 | if [ "$RUNMAKE" = "1" ] ; then
|
---|
| 504 | # Test to make sure we're running the build as root
|
---|
| 505 | if [ "$UID" != "0" ] ; then
|
---|
| 506 | echo "You must be logged in as root to successfully build the system."
|
---|
| 507 | exit 1
|
---|
| 508 | fi
|
---|
| 509 | # Build the system
|
---|
| 510 | if [ -e $MKFILE ] ; then
|
---|
| 511 | echo -ne "Building the system...\n"
|
---|
[a167246] | 512 | cd $JHALFSDIR && make
|
---|
[877cc6a] | 513 | echo -ne "done\n"
|
---|
| 514 | fi
|
---|
| 515 | fi
|
---|
| 516 | }
|
---|
| 517 |
|
---|
| 518 |
|
---|
| 519 | #----------------------------#
|
---|
[261eea6] | 520 | clean_builddir() { #
|
---|
[877cc6a] | 521 | #----------------------------#
|
---|
| 522 | # Test if the clean must be done.
|
---|
| 523 | if [ "$CLEAN" = "1" ] ; then
|
---|
| 524 | # Test to make sure we're running the clean as root
|
---|
| 525 | if [ "$UID" != "0" ] ; then
|
---|
| 526 | echo "You must be logged in as root to clean the build directory."
|
---|
| 527 | exit 1
|
---|
| 528 | fi
|
---|
| 529 | # Test to make sure that the build directory was populated by jhalfs
|
---|
| 530 | if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
---|
[73e5448] | 531 | echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
|
---|
[877cc6a] | 532 | exit 1
|
---|
| 533 | else
|
---|
| 534 | # Clean the build directory
|
---|
| 535 | echo -ne "Cleaning $BUILDDIR...\n"
|
---|
| 536 | rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
|
---|
| 537 | echo -ne "Cleaning $JHALFSDIR...\n"
|
---|
| 538 | rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
| 539 | echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
|
---|
| 540 | rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
|
---|
| 541 | echo -ne "done\n"
|
---|
| 542 | fi
|
---|
| 543 | fi
|
---|
| 544 | }
|
---|
| 545 |
|
---|
| 546 | #----------------------------#
|
---|
[261eea6] | 547 | get_book() { #
|
---|
[877cc6a] | 548 | #----------------------------#
|
---|
| 549 | cd $JHALFSDIR
|
---|
| 550 |
|
---|
| 551 | if [ -z $WC ] ; then
|
---|
| 552 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
| 553 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
| 554 | exit 1"
|
---|
| 555 | echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
---|
| 556 |
|
---|
| 557 | case $PROGNAME in
|
---|
| 558 | lfs) svn_root="LFS" ;;
|
---|
| 559 | hlfs) svn_root="HLFS" ;;
|
---|
| 560 | clfs) svn_root="cross-lfs" ;;
|
---|
| 561 | *) echo "BOOK not defined in function <get_book>"
|
---|
| 562 | exit 1 ;;
|
---|
| 563 | esac
|
---|
| 564 | # Grab a fresh book if it's missing, otherwise, update it from the
|
---|
| 565 | # repo. If we've already extracted the commands, move on to getting the
|
---|
| 566 | # sources.
|
---|
| 567 | if [ -d ${PROGNAME}-$LFSVRS ] ; then
|
---|
| 568 | cd ${PROGNAME}-$LFSVRS
|
---|
[19528f8] | 569 | if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/${PROGNAME}-commands && \
|
---|
| 570 | test -f $JHALFSDIR/packages ; then
|
---|
[877cc6a] | 571 | echo -ne "done\n"
|
---|
| 572 | # Set the canonical book version
|
---|
| 573 | cd $JHALFSDIR
|
---|
| 574 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
[a7db907] | 575 | # Another work-around, clfs book has a x.x.x-date versioning system
|
---|
| 576 | if [ "$PROGNAME" = "clfs" ]; then
|
---|
| 577 | VERSION=${VERSION##*-}
|
---|
| 578 | fi
|
---|
[877cc6a] | 579 | get_sources
|
---|
| 580 | else
|
---|
| 581 | echo -ne "done\n"
|
---|
| 582 | extract_commands
|
---|
| 583 | fi
|
---|
| 584 | else
|
---|
| 585 | case $LFSVRS in
|
---|
| 586 | development)
|
---|
| 587 | svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
|
---|
| 588 | esac
|
---|
| 589 | echo -ne "done\n"
|
---|
| 590 | extract_commands
|
---|
| 591 | fi
|
---|
| 592 | else
|
---|
| 593 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
| 594 | extract_commands
|
---|
| 595 | fi
|
---|
| 596 | }
|
---|
| 597 |
|
---|
| 598 | #----------------------------#
|
---|
| 599 | extract_commands() { #
|
---|
| 600 | #----------------------------#
|
---|
| 601 |
|
---|
| 602 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 603 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
| 604 | exit 1"
|
---|
| 605 |
|
---|
| 606 | cd $JHALFSDIR
|
---|
| 607 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
---|
[3d1b542] | 608 | # Another work-around, clfs book has a x.x.x-date versioning system
|
---|
| 609 | if [ "$PROGNAME" = "clfs" ]; then
|
---|
| 610 | VERSION=${VERSION##*-}
|
---|
| 611 | fi
|
---|
[877cc6a] | 612 |
|
---|
| 613 | # Start clean
|
---|
[bfc07d6] | 614 | if [ -d ${PROGNAME}-commands ]; then
|
---|
| 615 | rm -rf ${PROGNAME}-commands
|
---|
| 616 | mkdir -v ${PROGNAME}-commands
|
---|
[877cc6a] | 617 | fi
|
---|
| 618 | echo -n "Extracting commands for"
|
---|
| 619 |
|
---|
| 620 | # Dump the commands in shell script form from the HLFS book.
|
---|
| 621 | case ${PROGNAME} in
|
---|
| 622 | clfs)
|
---|
| 623 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
---|
| 624 | xsltproc --nonet \
|
---|
| 625 | --xinclude \
|
---|
| 626 | --stringparam method $METHOD \
|
---|
| 627 | --stringparam testsuite $TEST \
|
---|
| 628 | --stringparam vim-lang $VIMLANG \
|
---|
| 629 | --stringparam timezone $TIMEZONE \
|
---|
| 630 | --stringparam page $PAGE \
|
---|
| 631 | --stringparam lang $LANG \
|
---|
| 632 | --stringparam keymap $KEYMAP \
|
---|
| 633 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 634 | ;;
|
---|
| 635 | hlfs)
|
---|
| 636 | echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
|
---|
| 637 | xsltproc --nonet \
|
---|
| 638 | --xinclude \
|
---|
| 639 | --stringparam model $MODEL \
|
---|
| 640 | --stringparam testsuite $TEST \
|
---|
| 641 | --stringparam timezone $TIMEZONE \
|
---|
| 642 | --stringparam page $PAGE \
|
---|
| 643 | --stringparam lang $LANG \
|
---|
| 644 | --stringparam lc_all $LC_ALL \
|
---|
| 645 | --stringparam keymap $KEYMAP \
|
---|
| 646 | --stringparam grsecurity_host $GRSECURITY_HOST \
|
---|
| 647 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 648 | ;;
|
---|
| 649 | lfs)
|
---|
| 650 | echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
|
---|
| 651 | xsltproc --nonet \
|
---|
| 652 | --xinclude \
|
---|
| 653 | --stringparam testsuite $TEST \
|
---|
| 654 | --stringparam vim-lang $VIMLANG \
|
---|
| 655 | --stringparam timezone $TIMEZONE \
|
---|
| 656 | --stringparam page $PAGE \
|
---|
| 657 | --stringparam lang $LANG \
|
---|
| 658 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 659 | ;;
|
---|
[15cad16] | 660 | *) exit 1 ;;
|
---|
[877cc6a] | 661 | esac
|
---|
| 662 |
|
---|
| 663 | echo " ...OK"
|
---|
| 664 |
|
---|
| 665 | # Make the scripts executable.
|
---|
| 666 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
| 667 |
|
---|
[15cad16] | 668 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 669 | rm -f packages
|
---|
[1ec8fce] | 670 | echo -n "Creating <${PROGNAME}> specific packages file"
|
---|
| 671 | grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
|
---|
| 672 | -e 's@">@"@' > packages
|
---|
| 673 | echo " ...OK"
|
---|
[877cc6a] | 674 |
|
---|
| 675 | # Done. Moving on...
|
---|
| 676 | get_sources
|
---|
| 677 | }
|
---|
| 678 |
|
---|
| 679 | #----------------------------#
|
---|
[15cad16] | 680 | get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
|
---|
[93135fd] | 681 | #----------------------------#
|
---|
| 682 | local saveIFS=$IFS
|
---|
[26053c4] | 683 | local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
|
---|
[93135fd] | 684 |
|
---|
[a160d86] | 685 | # ALWAYS create a list of the full filenames
|
---|
| 686 | create_package_list
|
---|
| 687 |
|
---|
[93135fd] | 688 | # Test if the packages must be downloaded
|
---|
| 689 | [ ! "$GETPKG" = "1" ] && return
|
---|
| 690 |
|
---|
| 691 | gs_wrt_message(){
|
---|
| 692 | echo "${RED}$1${OFF}"
|
---|
[c7dbe78] | 693 | echo "$1" >> MISSING_FILES.DMP
|
---|
| 694 | }
|
---|
[93135fd] | 695 | # Housekeeping
|
---|
| 696 | [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
|
---|
| 697 | cd $BUILDDIR/sources
|
---|
| 698 | [[ -f MD5SUMS ]] && rm MD5SUMS
|
---|
| 699 | [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
|
---|
| 700 | [[ -f urls.lst ]] && rm urls.lst
|
---|
| 701 |
|
---|
| 702 | # Generate URLs file
|
---|
| 703 | create_urls
|
---|
| 704 |
|
---|
| 705 | IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
|
---|
| 706 | for line in `cat urls.lst`; do
|
---|
| 707 | IFS=$saveIFS # Restore the system defaults
|
---|
| 708 |
|
---|
| 709 | # Skip some packages if they aren't needed
|
---|
| 710 | case $line in
|
---|
| 711 | */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
|
---|
| 712 | [[ "$TEST" = "0" ]] && continue
|
---|
| 713 | ;;
|
---|
| 714 | */vim-*-lang* )
|
---|
| 715 | [[ "$VIMLANG" = "0" ]] && continue
|
---|
| 716 | ;;
|
---|
[0c3f2f9] | 717 | *linux/linux-* )
|
---|
[294c937] | 718 | [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
|
---|
| 719 | [[ "$GETKERNEL" = "0" ]] && continue
|
---|
[0c3f2f9] | 720 | ;;
|
---|
[93135fd] | 721 | esac
|
---|
| 722 |
|
---|
| 723 | # Locations
|
---|
[296ae69] | 724 | URL1=`echo $line | cut -d" " -f2` # Preferred URL
|
---|
| 725 | URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
|
---|
[26053c4] | 726 | FILE=`basename $URL1` # File name
|
---|
| 727 | BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
|
---|
| 728 |
|
---|
[8a43b5b] | 729 | # Validation pair
|
---|
| 730 | MD5="$BOOKMD5 $FILE"
|
---|
| 731 | HAVEMD5=1
|
---|
[93135fd] | 732 |
|
---|
| 733 | set -e
|
---|
[c7dbe78] | 734 | # If the file exists in the archive copy it to the
|
---|
[93135fd] | 735 | # $BUILDDIR/sources dir. MD5SUM will be validated later.
|
---|
| 736 | if [ ! -z ${SRC_ARCHIVE} ] &&
|
---|
| 737 | [ -d ${SRC_ARCHIVE} ] &&
|
---|
| 738 | [ -f ${SRC_ARCHIVE}/$FILE ]; then
|
---|
| 739 | cp ${SRC_ARCHIVE}/$FILE .
|
---|
| 740 | echo "$FILE: -- copied from $SRC_ARCHIVE"
|
---|
| 741 | fromARCHIVE=1
|
---|
| 742 | else
|
---|
| 743 | echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
|
---|
| 744 | fromARCHIVE=0
|
---|
[8a43b5b] | 745 | # If the file does not exist yet in /sources download a fresh one
|
---|
[93135fd] | 746 | if [ ! -f $FILE ] ; then
|
---|
| 747 | if ! wget $URL1 && ! wget $URL2 ; then
|
---|
[c7dbe78] | 748 | gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
|
---|
| 749 | continue
|
---|
[93135fd] | 750 | fi
|
---|
| 751 | fi
|
---|
| 752 | fi
|
---|
| 753 |
|
---|
[8a43b5b] | 754 | # IF the md5sum does not match the existing files
|
---|
| 755 | if ! echo "$MD5" | md5sum -c - >/dev/null ; then
|
---|
| 756 | [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
|
---|
| 757 | [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
|
---|
| 758 | # Remove the old file and download a new one
|
---|
| 759 | rm -fv $FILE
|
---|
| 760 | # Force storage in SRC_ARCHIVE
|
---|
| 761 | fromARCHIVE=0;
|
---|
| 762 | # Try to retrieve again the file. Servers in reverse order.
|
---|
| 763 | if ! wget $URL2 && ! wget $URL1 ; then
|
---|
| 764 | gs_wrt_message "$FILE not found on the servers.. SKIPPING"
|
---|
| 765 | continue
|
---|
[93135fd] | 766 | fi
|
---|
| 767 | fi
|
---|
| 768 |
|
---|
| 769 | # Validate the MD5SUM one last time
|
---|
[8a43b5b] | 770 | if ! echo "$MD5" | md5sum -c - >/dev/null ; then
|
---|
[93135fd] | 771 | gs_wrt_message "$FILE does not match MD5SUMS value"
|
---|
[0910f55] | 772 | # Force generation of MD5SUM
|
---|
| 773 | HAVEMD5=0
|
---|
[93135fd] | 774 | fi
|
---|
| 775 |
|
---|
| 776 | # Generate a fresh MD5SUM for this file
|
---|
| 777 | if [[ "$HAVEMD5" = "0" ]] ; then
|
---|
| 778 | echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
|
---|
[8a43b5b] | 779 | echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
|
---|
[93135fd] | 780 | fi
|
---|
| 781 |
|
---|
| 782 | # Good or bad we write the original md5sum to a file
|
---|
[8a43b5b] | 783 | echo "$MD5" >> MD5SUMS
|
---|
[93135fd] | 784 |
|
---|
| 785 | # Copy the freshly downloaded file
|
---|
| 786 | # to the source archive.
|
---|
| 787 | if [ ! -z ${SRC_ARCHIVE} ] &&
|
---|
| 788 | [ -d ${SRC_ARCHIVE} ] &&
|
---|
| 789 | [ -w ${SRC_ARCHIVE} ] &&
|
---|
| 790 | [ "$fromARCHIVE" = "0" ] ; then
|
---|
| 791 | echo "Storing file:<$FILE> in the package archive"
|
---|
| 792 | cp -f $FILE ${SRC_ARCHIVE}
|
---|
| 793 | fi
|
---|
| 794 |
|
---|
| 795 | done
|
---|
| 796 |
|
---|
| 797 | if [[ -s MISSING_FILES.DMP ]]; then
|
---|
| 798 | echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
|
---|
| 799 | # Do not allow the automatic exection of the Makefile.
|
---|
[261eea6] | 800 | echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
|
---|
[93135fd] | 801 | RUNMAKE=0
|
---|
| 802 | fi
|
---|
| 803 | }
|
---|
| 804 |
|
---|
[a160d86] | 805 | #----------------------------#
|
---|
| 806 | create_package_list() { #
|
---|
| 807 | #----------------------------#
|
---|
| 808 |
|
---|
| 809 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 810 | echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
|
---|
| 811 | case ${PROGNAME} in
|
---|
| 812 | clfs)
|
---|
| 813 | xsltproc --nonet \
|
---|
| 814 | --xinclude \
|
---|
| 815 | -o pkg_tarball_list packages.xsl $BOOK/${ARCH}-index.xml
|
---|
| 816 | ;;
|
---|
| 817 | hlfs | lfs )
|
---|
| 818 | xsltproc --nonet \
|
---|
| 819 | --xinclude \
|
---|
| 820 | -o pkg_tarball_list packages.xsl $BOOK/index.xml
|
---|
| 821 | ;;
|
---|
| 822 | esac
|
---|
| 823 | echo " ...OK"
|
---|
| 824 |
|
---|
| 825 | }
|
---|
| 826 |
|
---|
[93135fd] | 827 |
|
---|
[877cc6a] | 828 | #----------------------------#
|
---|
[15cad16] | 829 | create_urls() { #
|
---|
[877cc6a] | 830 | #----------------------------#
|
---|
[15cad16] | 831 | cd $JHALFSDIR
|
---|
[877cc6a] | 832 |
|
---|
[15cad16] | 833 | case ${PROGNAME} in
|
---|
| 834 | clfs)
|
---|
| 835 | echo -n "Creating CLFS <${ARCH}> specific URLs file"
|
---|
| 836 | xsltproc --nonet --xinclude \
|
---|
| 837 | --stringparam server $SERVER \
|
---|
| 838 | -o $BUILDDIR/sources/urls.lst urls.xsl \
|
---|
| 839 | $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 840 | echo " ...OK"
|
---|
| 841 | ;;
|
---|
| 842 | hlfs)
|
---|
| 843 | echo -n "Creating HLFS <${MODEL}> specific URLs file"
|
---|
| 844 | xsltproc --nonet --xinclude \
|
---|
| 845 | --stringparam server $SERVER \
|
---|
| 846 | --stringparam model $MODEL \
|
---|
| 847 | -o $BUILDDIR/sources/urls.lst urls.xsl \
|
---|
| 848 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 849 | echo " ...OK"
|
---|
| 850 | ;;
|
---|
| 851 | lfs)
|
---|
| 852 | echo -n "Creating LFS specific URLs file"
|
---|
| 853 | xsltproc --nonet --xinclude \
|
---|
| 854 | --stringparam server $SERVER \
|
---|
| 855 | -o ../sources/urls.lst urls.xsl \
|
---|
| 856 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 857 | echo " ...OK"
|
---|
| 858 | ;;
|
---|
| 859 | esac
|
---|
[877cc6a] | 860 |
|
---|
[15cad16] | 861 | cd $BUILDDIR/sources
|
---|
[877cc6a] | 862 | }
|
---|
[a160d86] | 863 |
|
---|
| 864 |
|
---|
| 865 | #----------------------------#
|
---|
| 866 | get_package_tarball_name() { #
|
---|
| 867 | #----------------------------#
|
---|
| 868 | local script_name=$1
|
---|
| 869 |
|
---|
| 870 | # The use of 'head' is necessary to limit the return value to the FIRST match..
|
---|
| 871 | # hopefully this will not cause problems.
|
---|
| 872 | #
|
---|
| 873 | case $script_name in
|
---|
| 874 | tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
---|
| 875 | *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
---|
| 876 | esac
|
---|
| 877 |
|
---|
| 878 | } |
---|