[0170229] | 1 | #!/bin/bash
|
---|
[12a5707] | 2 | # $Id$
|
---|
[0170229] | 3 | set -e
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
---|
| 7 | #-----------------------#
|
---|
| 8 | simple_error() { # Basic error trap.... JUST DIE
|
---|
| 9 | #-----------------------#
|
---|
| 10 | # If +e then disable text output
|
---|
| 11 | if [[ "$-" =~ "e" ]]; then
|
---|
| 12 | echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
| 13 | fi
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | see_ya() {
|
---|
[f7590ba] | 17 | echo -e "\n\t${BOLD}Goodbye and thank you for choosing ${L_arrow}jhalfs-X${R_arrow}\n"
|
---|
[0170229] | 18 | }
|
---|
| 19 | ##### Simple error TRAPS
|
---|
| 20 | # ctrl-c SIGINT
|
---|
| 21 | # ctrl-y
|
---|
| 22 | # ctrl-z SIGTSTP
|
---|
| 23 | # SIGHUP 1 HANGUP
|
---|
| 24 | # SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
---|
| 25 | # SIGQUIT 3
|
---|
| 26 | # SIGKILL 9 KILL
|
---|
| 27 | # SIGTERM 15 TERMINATION
|
---|
| 28 | # SIGSTOP 17,18,23 STOP THE PROCESS
|
---|
| 29 | #####
|
---|
| 30 | set -e
|
---|
| 31 | trap see_ya 0
|
---|
| 32 | trap simple_error ERR
|
---|
| 33 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
| 34 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 | if [ ! -L $0 ] ; then
|
---|
| 38 | echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
---|
| 39 | exit 1
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
[12a5707] | 42 | PROGNAME=$(basename $0)
|
---|
| 43 | COMMON_DIR="common"
|
---|
[26a8fdf] | 44 | PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z])
|
---|
[12a5707] | 45 | MODULE=$PACKAGE_DIR/master.sh
|
---|
| 46 | MODULE_CONFIG=$PACKAGE_DIR/config
|
---|
[26a8fdf] | 47 | VERBOSITY=0
|
---|
[12a5707] | 48 |
|
---|
[26a8fdf] | 49 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
[12a5707] | 50 | source $COMMON_DIR/common-functions
|
---|
| 51 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
[26a8fdf] | 52 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[12a5707] | 53 | #
|
---|
[26a8fdf] | 54 | [[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
|
---|
[12a5707] | 55 | source $COMMON_DIR/config
|
---|
[13e816f] | 56 | [[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
|
---|
[26a8fdf] | 57 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 58 | #
|
---|
[26a8fdf] | 59 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
|
---|
[0170229] | 60 | source $MODULE_CONFIG
|
---|
| 61 | [[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
|
---|
[26a8fdf] | 62 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 63 | #
|
---|
[26a8fdf] | 64 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
[0170229] | 65 | source $MODULE
|
---|
[12a5707] | 66 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
[26a8fdf] | 67 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 68 | #
|
---|
[65d83a6] | 69 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[0170229] | 70 |
|
---|
[613d46b] | 71 | if [[ -e using_menuconfig ]]; then
|
---|
| 72 | source configuration
|
---|
| 73 | #--- Working directories
|
---|
| 74 | SCRIPT_ROOT=jhalfs
|
---|
| 75 | JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
|
---|
| 76 | LOGDIR=$JHALFSDIR/logs
|
---|
| 77 | TESTLOGDIR=$JHALFSDIR/test-logs
|
---|
| 78 | MKFILE=$JHALFSDIR/Makefile
|
---|
| 79 | #--- ICA report log directory
|
---|
| 80 | ICALOGDIR=$LOGDIR/ICA
|
---|
| 81 | #--- farce report log directory
|
---|
| 82 | FARCELOGDIR=$LOGDIR/farce
|
---|
| 83 |
|
---|
| 84 | [[ ! -z ${BRANCH_ID} ]] &&
|
---|
| 85 | case $BRANCH_ID in
|
---|
| 86 | dev* | SVN | trunk )
|
---|
| 87 | case $PROGNAME in
|
---|
| 88 | clfs2 ) TREE=branches/clfs-2.0/BOOK ;;
|
---|
| 89 | *) TREE=trunk/BOOK ;;
|
---|
| 90 | esac
|
---|
| 91 | LFSVRS=development
|
---|
| 92 | ;;
|
---|
| 93 | branch-* )
|
---|
| 94 | LFSVRS=${BRANCH_ID}
|
---|
| 95 | TREE=branches/${BRANCH_ID#branch-}/BOOK
|
---|
| 96 | ;;
|
---|
| 97 | * )
|
---|
| 98 | case $PROGNAME in
|
---|
| 99 | lfs | hlfs )
|
---|
| 100 | LFSVRS=${BRANCH_ID}
|
---|
| 101 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
| 102 | ;;
|
---|
| 103 | clfs | clfs2 )
|
---|
| 104 | LFSVRS=${BRANCH_ID}
|
---|
| 105 | TREE=tags/${BRANCH_ID}
|
---|
| 106 | ;;
|
---|
| 107 | esac
|
---|
| 108 | ;;
|
---|
| 109 | esac
|
---|
| 110 | fi
|
---|
[0170229] | 111 |
|
---|
| 112 | #===========================================================
|
---|
| 113 | # If the var BOOK contains something then, maybe, it points
|
---|
| 114 | # to a working doc.. set WC=1, else 'null'
|
---|
| 115 | #===========================================================
|
---|
| 116 | WC=${BOOK:+1}
|
---|
| 117 | #===========================================================
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 | #*******************************************************************#
|
---|
[26a8fdf] | 121 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[12a5707] | 122 | source $COMMON_DIR/func_check_version.sh
|
---|
| 123 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 124 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 125 |
|
---|
[26a8fdf] | 126 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[12a5707] | 127 | source $COMMON_DIR/func_validate_configs.sh
|
---|
| 128 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 129 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[65d83a6] | 130 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[0170229] | 131 |
|
---|
| 132 |
|
---|
| 133 | ###################################
|
---|
[4612459] | 134 | ### MAIN ###
|
---|
[0170229] | 135 | ###################################
|
---|
| 136 |
|
---|
| 137 | # Evaluate any command line switches
|
---|
| 138 |
|
---|
| 139 | while test $# -gt 0 ; do
|
---|
| 140 | case $1 in
|
---|
[25b52e2] | 141 | # Common options for {C,H}LFS books
|
---|
[5627958] | 142 | --book | -B )
|
---|
[0170229] | 143 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 144 | shift
|
---|
| 145 | case $1 in
|
---|
| 146 | dev* | SVN | trunk )
|
---|
| 147 | LFSVRS=development
|
---|
[3b63c8c] | 148 | TREE=trunk/BOOK
|
---|
[0170229] | 149 | ;;
|
---|
[3b63c8c] | 150 | branch-* )
|
---|
| 151 | LFSVRS=$1
|
---|
| 152 | TREE=branches/${1#branch-}/BOOK
|
---|
| 153 | ;;
|
---|
| 154 | * )
|
---|
| 155 | case $PROGNAME in
|
---|
| 156 | lfs | hlfs )
|
---|
| 157 | LFSVRS=$1
|
---|
| 158 | TREE=tags/$1/BOOK
|
---|
| 159 | ;;
|
---|
| 160 | clfs )
|
---|
| 161 | LFSVRS=$1
|
---|
| 162 | TREE=tags/$1
|
---|
| 163 | ;;
|
---|
| 164 | esac
|
---|
[0170229] | 165 | ;;
|
---|
| 166 | esac
|
---|
| 167 | ;;
|
---|
| 168 |
|
---|
[c16cedc] | 169 | --directory | -D )
|
---|
[0170229] | 170 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 171 | shift
|
---|
[e95c26c] | 172 | case $1 in
|
---|
| 173 | -* )
|
---|
[ea29b1f] | 174 | echo -e "\n$1 isn't a valid build directory."
|
---|
[e95c26c] | 175 | echo -e "Directory names can't start with - .\n"
|
---|
| 176 | exit 1
|
---|
| 177 | ;;
|
---|
| 178 | * )
|
---|
| 179 | BUILDDIR=$1
|
---|
[460ea63] | 180 | JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
|
---|
[e95c26c] | 181 | LOGDIR=$JHALFSDIR/logs
|
---|
[e35e794] | 182 | TESTLOGDIR=$JHALFSDIR/test-logs
|
---|
[e95c26c] | 183 | MKFILE=$JHALFSDIR/Makefile
|
---|
| 184 | ;;
|
---|
| 185 | esac
|
---|
[0170229] | 186 | ;;
|
---|
| 187 |
|
---|
[3e7af38] | 188 | --get-packages | -G ) GETPKG=1 ;;
|
---|
[c16cedc] | 189 |
|
---|
[e2b5b99] | 190 | --help | -h ) usage | more && exit ;;
|
---|
[c16cedc] | 191 |
|
---|
[53588e2] | 192 | --optimize | -O )
|
---|
| 193 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 194 | shift
|
---|
| 195 | case $1 in
|
---|
| 196 | 0 | 1 | 2 )
|
---|
| 197 | OPTIMIZE=$1
|
---|
| 198 | ;;
|
---|
| 199 | * )
|
---|
| 200 | echo -e "\n$1 isn't a valid optimize level value."
|
---|
| 201 | echo -e "You must use 0, 1, or 2.\n"
|
---|
| 202 | exit 1
|
---|
| 203 | ;;
|
---|
| 204 | esac
|
---|
| 205 | ;;
|
---|
| 206 |
|
---|
[c16cedc] | 207 | --testsuites | -T )
|
---|
| 208 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 209 | shift
|
---|
| 210 | case $1 in
|
---|
| 211 | 0 | 1 | 2 | 3 )
|
---|
| 212 | TEST=$1
|
---|
| 213 | ;;
|
---|
| 214 | * )
|
---|
| 215 | echo -e "\n$1 isn't a valid testsuites level value."
|
---|
| 216 | echo -e "You must to use 0, 1, 2, or 3.\n"
|
---|
| 217 | exit 1
|
---|
| 218 | ;;
|
---|
| 219 | esac
|
---|
| 220 | ;;
|
---|
| 221 |
|
---|
| 222 | --version | -V )
|
---|
| 223 | echo "$version"
|
---|
| 224 | exit 0
|
---|
| 225 | ;;
|
---|
| 226 |
|
---|
[0170229] | 227 | --working-copy | -W )
|
---|
| 228 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 229 | shift
|
---|
[5627958] | 230 | case $PROGNAME in # Poor checks. We should find better ones.
|
---|
| 231 | lfs)
|
---|
[f8615e5] | 232 | if [ -d $1/chapter09 ] ; then
|
---|
[5627958] | 233 | WC=1
|
---|
| 234 | BOOK=$1
|
---|
| 235 | else
|
---|
[3b63c8c] | 236 | echo -e "\nLooks like $1 isn't an LFS working copy."
|
---|
[5627958] | 237 | exit 1
|
---|
| 238 | fi
|
---|
| 239 | ;;
|
---|
| 240 | clfs)
|
---|
[f8615e5] | 241 | if [ -d $1/cross-tools ] ; then
|
---|
[5627958] | 242 | WC=1
|
---|
| 243 | BOOK=$1
|
---|
| 244 | else
|
---|
[da626a9] | 245 | echo -e "\nLooks like $1 isn't a CLFS working copy."
|
---|
[5627958] | 246 | exit 1
|
---|
| 247 | fi
|
---|
| 248 | ;;
|
---|
| 249 | hlfs)
|
---|
| 250 | if [ -f $1/template.xml ] ; then
|
---|
| 251 | WC=1
|
---|
| 252 | BOOK=$1
|
---|
| 253 | else
|
---|
[3b63c8c] | 254 | echo -e "\nLooks like $1 isn't an HLFS working copy."
|
---|
[5627958] | 255 | exit 1
|
---|
| 256 | fi
|
---|
| 257 | ;;
|
---|
[4532c37] | 258 | esac
|
---|
| 259 | ;;
|
---|
[0170229] | 260 |
|
---|
[3b63c8c] | 261 | --comparison | -C )
|
---|
[4612459] | 262 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 263 | shift
|
---|
[02d1ae7] | 264 | case $1 in
|
---|
[4612459] | 265 | ICA) RUN_ICA=1
|
---|
| 266 | RUN_FARCE=0
|
---|
[fb68d23] | 267 | COMPARE=1
|
---|
[4612459] | 268 | ;;
|
---|
| 269 | farce) RUN_ICA=0
|
---|
| 270 | RUN_FARCE=1
|
---|
[fb68d23] | 271 | COMPARE=1
|
---|
[4612459] | 272 | ;;
|
---|
| 273 | both) RUN_ICA=1
|
---|
| 274 | RUN_FARCE=1
|
---|
[fb68d23] | 275 | COMPARE=1
|
---|
[97520c9] | 276 | ;;
|
---|
[4612459] | 277 | *)
|
---|
[c58f330] | 278 | echo -e "\n$1 is an unknown analysis method."
|
---|
[4612459] | 279 | exit 1
|
---|
| 280 | ;;
|
---|
| 281 | esac
|
---|
| 282 | ;;
|
---|
[42346b2] | 283 |
|
---|
[40ccddf] | 284 | --fstab | -F )
|
---|
| 285 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 286 | shift
|
---|
| 287 | if [ -f $1 ] ; then
|
---|
| 288 | FSTAB=$1
|
---|
| 289 | else
|
---|
| 290 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 291 | exit 1
|
---|
| 292 | fi
|
---|
| 293 | ;;
|
---|
| 294 |
|
---|
| 295 | --kernel-config | -K )
|
---|
| 296 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 297 | shift
|
---|
| 298 | if [ -f $1 ] ; then
|
---|
| 299 | CONFIG=$1
|
---|
| 300 | else
|
---|
| 301 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 302 | exit 1
|
---|
| 303 | fi
|
---|
| 304 | ;;
|
---|
| 305 |
|
---|
[3b63c8c] | 306 | --run-make | -M ) RUNMAKE=1 ;;
|
---|
[40ccddf] | 307 |
|
---|
| 308 | --rebuild | -R ) CLEAN=1 ;;
|
---|
| 309 |
|
---|
[bd99331] | 310 | # CLFS options
|
---|
| 311 | --arch | -A )
|
---|
| 312 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 313 | shift
|
---|
| 314 | case $1 in
|
---|
[3b63c8c] | 315 | arm )
|
---|
| 316 | ARCH=arm
|
---|
| 317 | TARGET="arm-unknown-linux-gnu"
|
---|
| 318 | ;;
|
---|
[bd99331] | 319 | x86 )
|
---|
| 320 | ARCH=x86
|
---|
| 321 | TARGET="i686-pc-linux-gnu"
|
---|
| 322 | ;;
|
---|
| 323 | i486 )
|
---|
| 324 | ARCH=x86
|
---|
| 325 | TARGET="i486-pc-linux-gnu"
|
---|
| 326 | ;;
|
---|
| 327 | i586 )
|
---|
| 328 | ARCH=x86
|
---|
| 329 | TARGET="i586-pc-linux-gnu"
|
---|
| 330 | ;;
|
---|
| 331 | ppc )
|
---|
| 332 | ARCH=ppc
|
---|
| 333 | TARGET="powerpc-unknown-linux-gnu"
|
---|
| 334 | ;;
|
---|
| 335 | mips )
|
---|
| 336 | ARCH=mips
|
---|
| 337 | TARGET="mips-unknown-linux-gnu"
|
---|
| 338 | ;;
|
---|
| 339 | mipsel )
|
---|
| 340 | ARCH=mips
|
---|
| 341 | TARGET="mipsel-unknown-linux-gnu"
|
---|
| 342 | ;;
|
---|
| 343 | sparc )
|
---|
| 344 | ARCH=sparc
|
---|
| 345 | TARGET="sparcv9-unknown-linux-gnu"
|
---|
| 346 | ;;
|
---|
| 347 | x86_64-64 )
|
---|
| 348 | ARCH=x86_64-64
|
---|
| 349 | TARGET="x86_64-unknown-linux-gnu"
|
---|
| 350 | ;;
|
---|
| 351 | mips64-64 )
|
---|
| 352 | ARCH=mips64-64
|
---|
| 353 | TARGET="mips-unknown-linux-gnu"
|
---|
| 354 | ;;
|
---|
| 355 | mipsel64-64 )
|
---|
| 356 | ARCH=mips64-64
|
---|
| 357 | TARGET="mipsel-unknown-linux-gnu"
|
---|
| 358 | ;;
|
---|
| 359 | sparc64-64 )
|
---|
| 360 | ARCH=sparc64-64
|
---|
| 361 | TARGET="sparc64-unknown-linux-gnu"
|
---|
| 362 | ;;
|
---|
| 363 | alpha )
|
---|
| 364 | ARCH=alpha
|
---|
| 365 | TARGET="alpha-unknown-linux-gnu"
|
---|
| 366 | ;;
|
---|
| 367 | x86_64 )
|
---|
| 368 | ARCH=x86_64
|
---|
| 369 | TARGET="x86_64-unknown-linux-gnu"
|
---|
| 370 | TARGET32="i686-pc-linux-gnu"
|
---|
| 371 | ;;
|
---|
| 372 | mips64 )
|
---|
| 373 | ARCH=mips64
|
---|
| 374 | TARGET="mips-unknown-linux-gnu"
|
---|
| 375 | TARGET32="mips-unknown-linux-gnu"
|
---|
| 376 | ;;
|
---|
| 377 | mipsel64 )
|
---|
| 378 | ARCH=mips64
|
---|
| 379 | TARGET="mipsel-unknown-linux-gnu"
|
---|
| 380 | TARGET32="mipsel-unknown-linux-gnu"
|
---|
| 381 | ;;
|
---|
| 382 | sparc64 )
|
---|
| 383 | ARCH=sparc64
|
---|
| 384 | TARGET="sparc64-unknown-linux-gnu"
|
---|
| 385 | TARGET32="sparcv9-unknown-linux-gnu"
|
---|
| 386 | ;;
|
---|
| 387 | ppc64 )
|
---|
| 388 | ARCH=ppc64
|
---|
| 389 | TARGET="powerpc64-unknown-linux-gnu"
|
---|
| 390 | TARGET32="powerpc-unknown-linux-gnu"
|
---|
| 391 | ;;
|
---|
| 392 | * )
|
---|
[3b63c8c] | 393 | echo -e "\n$1 is an unknown or unsupported arch."
|
---|
[bd99331] | 394 | exit 1
|
---|
| 395 | ;;
|
---|
| 396 | esac
|
---|
| 397 | ;;
|
---|
| 398 |
|
---|
[5ff30ff] | 399 | --boot-config )
|
---|
| 400 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 401 | shift
|
---|
| 402 | if [ -f $1 ] ; then
|
---|
| 403 | BOOT_CONFIG=$1
|
---|
| 404 | else
|
---|
| 405 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 406 | exit 1
|
---|
| 407 | fi
|
---|
| 408 | ;;
|
---|
| 409 |
|
---|
[bd99331] | 410 | --method )
|
---|
| 411 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 412 | shift
|
---|
| 413 | case $1 in
|
---|
| 414 | chroot | boot )
|
---|
| 415 | METHOD=$1
|
---|
| 416 | ;;
|
---|
| 417 | * )
|
---|
| 418 | echo -e "\n$1 isn't a valid build method."
|
---|
| 419 | exit 1
|
---|
| 420 | ;;
|
---|
| 421 | esac
|
---|
| 422 | ;;
|
---|
| 423 |
|
---|
[890acc6] | 424 | # HLFS options
|
---|
| 425 | --model )
|
---|
| 426 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 427 | shift
|
---|
| 428 | case $1 in
|
---|
| 429 | glibc | uclibc )
|
---|
| 430 | MODEL=$1
|
---|
| 431 | ;;
|
---|
| 432 | * )
|
---|
| 433 | echo -e "\n$1 isn't a valid libc model."
|
---|
| 434 | exit 1
|
---|
| 435 | ;;
|
---|
| 436 | esac
|
---|
| 437 | ;;
|
---|
| 438 |
|
---|
[bd99331] | 439 | # Unknown options
|
---|
[e794f06] | 440 | * ) usage ;;
|
---|
[0170229] | 441 | esac
|
---|
| 442 | shift
|
---|
| 443 | done
|
---|
| 444 |
|
---|
| 445 | #===================================================
|
---|
| 446 | # Set the document location...
|
---|
[13e816f] | 447 | # BOOK is either defined in
|
---|
[0170229] | 448 | # xxx.config
|
---|
| 449 | # comand line
|
---|
[13e816f] | 450 | # default
|
---|
[d95b8f2] | 451 | # If set by conf file or cmd line leave it
|
---|
[0170229] | 452 | # alone otherwise load the default version
|
---|
| 453 | #===================================================
|
---|
| 454 | BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
---|
| 455 | #===================================================
|
---|
| 456 |
|
---|
[13e816f] | 457 |
|
---|
[3b63c8c] | 458 | # Check for minimum gcc and kernel versions
|
---|
[13e816f] | 459 | #check_requirements 1 # 0/1 0-do not display values.
|
---|
[f15fe85] | 460 | echo
|
---|
[13e816f] | 461 | check_version "2.6.2" "`uname -r`" "KERNEL"
|
---|
| 462 | check_version "3.0" "$BASH_VERSION" "BASH"
|
---|
| 463 | check_version "3.0" "`gcc -dumpversion`" "GCC"
|
---|
[e35e794] | 464 | tarVer=`tar --version | head -n1 | cut -d " " -f4`
|
---|
| 465 | check_version "1.15.0" "${tarVer}" "TAR"
|
---|
[65d83a6] | 466 | echo "${SD_BORDER}${nl_}"
|
---|
[13e816f] | 467 |
|
---|
[3051f95] | 468 | validate_config
|
---|
[65d83a6] | 469 | echo "${SD_BORDER}${nl_}"
|
---|
[7e6ddf0] | 470 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
[13e816f] | 471 | read ANSWER
|
---|
| 472 | if [ x$ANSWER != "xyes" ] ; then
|
---|
| 473 | echo "${nl_}Fix the configuration options and rerun the script.${nl_}"
|
---|
| 474 | exit 1
|
---|
| 475 | fi
|
---|
[65d83a6] | 476 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
[13e816f] | 477 |
|
---|
[3a27393] | 478 | # Load additional modules or configuration files based on global settings
|
---|
[bb8e6bc] | 479 | # compare module
|
---|
| 480 | if [[ "$COMPARE" = "1" ]]; then
|
---|
| 481 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
| 482 | source $COMMON_DIR/func_compare.sh
|
---|
| 483 | [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
|
---|
| 484 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 485 | fi
|
---|
| 486 | #
|
---|
[2c2471d] | 487 | # optimize module
|
---|
| 488 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
| 489 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
| 490 | source optimize/optimize_functions
|
---|
| 491 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
| 492 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[3a27393] | 493 | #
|
---|
| 494 | # optimize configurations
|
---|
[bb8e6bc] | 495 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
| 496 | source optimize/opt_config
|
---|
| 497 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
| 498 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[3a27393] | 499 | # Validate optimize settings, if required
|
---|
| 500 | validate_opt_settings
|
---|
[bb8e6bc] | 501 | fi
|
---|
| 502 | #
|
---|
| 503 |
|
---|
[13e816f] | 504 | # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
|
---|
| 505 | # and notify the user about that.
|
---|
| 506 | if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
|
---|
| 507 | eval "$no_empty_builddir"
|
---|
| 508 | fi
|
---|
| 509 |
|
---|
| 510 | # If requested, clean the build directory
|
---|
| 511 | clean_builddir
|
---|
| 512 |
|
---|
[0170229] | 513 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
[a110145] | 514 | mkdir -p $JHALFSDIR
|
---|
[0170229] | 515 | fi
|
---|
[3a27393] | 516 | #
|
---|
| 517 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
| 518 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
| 519 | mkdir -p $BUILDDIR/sources
|
---|
| 520 | fi
|
---|
| 521 | #
|
---|
| 522 | # Create the log directory
|
---|
| 523 | if [[ ! -d $LOGDIR ]]; then
|
---|
| 524 | mkdir $LOGDIR
|
---|
| 525 | fi
|
---|
| 526 | >$LOGDIR/$LOG
|
---|
| 527 | #
|
---|
[e35e794] | 528 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
[3a27393] | 529 | #
|
---|
[13e816f] | 530 | if [[ "$PWD" != "$JHALFSDIR" ]]; then
|
---|
[460ea63] | 531 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
---|
[e35e794] | 532 | #
|
---|
[d0e48ec] | 533 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[e35e794] | 534 | #
|
---|
[fb68d23] | 535 | if [[ "$COMPARE" != "0" ]] ; then
|
---|
[cc020f4] | 536 | mkdir -p $JHALFSDIR/extras
|
---|
[4612459] | 537 | cp extras/* $JHALFSDIR/extras
|
---|
[ed0a142] | 538 | fi
|
---|
[3a27393] | 539 | #
|
---|
[0170229] | 540 | if [[ -n "$FILES" ]]; then
|
---|
[3b63c8c] | 541 | # pushd/popd necessary to deal with multiple files
|
---|
[a110145] | 542 | pushd $PACKAGE_DIR 1> /dev/null
|
---|
| 543 | cp $FILES $JHALFSDIR/
|
---|
| 544 | popd 1> /dev/null
|
---|
[0170229] | 545 | fi
|
---|
[3a27393] | 546 | #
|
---|
[25b52e2] | 547 | if [[ "$REPORT" = "1" ]]; then
|
---|
| 548 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[3b63c8c] | 549 | # After being sure that all looks sane, dump the settings to a file
|
---|
[25b52e2] | 550 | # This file will be used to create the REPORT header
|
---|
| 551 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
[708a612] | 552 | fi
|
---|
[3a27393] | 553 | #
|
---|
[25b52e2] | 554 | [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
| 555 | #
|
---|
[3b63c8c] | 556 | cp $COMMON_DIR/packages.xsl $JHALFSDIR/
|
---|
| 557 | #
|
---|
[12a5707] | 558 | sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
---|
[0170229] | 559 | export XSL=$JHALFSDIR/${XSL}
|
---|
| 560 | fi
|
---|
| 561 |
|
---|
| 562 | get_book
|
---|
[65d83a6] | 563 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 564 |
|
---|
[0170229] | 565 | build_Makefile
|
---|
[65d83a6] | 566 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 567 |
|
---|
[386bc75] | 568 | run_make
|
---|