[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 | #
|
---|
[17c7894] | 59 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
[d0e48ec] | 60 | source optimize/opt_config
|
---|
| 61 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
[17c7894] | 62 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 63 | #
|
---|
[d6614ab] | 64 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
| 65 | source $COMMON_DIR/func_compare.sh
|
---|
| 66 | [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
|
---|
[a5fa1a9] | 67 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 68 | #
|
---|
[26a8fdf] | 69 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
|
---|
[0170229] | 70 | source $MODULE_CONFIG
|
---|
| 71 | [[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
|
---|
[26a8fdf] | 72 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 73 | #
|
---|
[26a8fdf] | 74 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
[0170229] | 75 | source $MODULE
|
---|
[12a5707] | 76 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
[26a8fdf] | 77 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 78 | #
|
---|
[65d83a6] | 79 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[0170229] | 80 |
|
---|
| 81 |
|
---|
| 82 | #===========================================================
|
---|
| 83 | # If the var BOOK contains something then, maybe, it points
|
---|
| 84 | # to a working doc.. set WC=1, else 'null'
|
---|
| 85 | #===========================================================
|
---|
| 86 | WC=${BOOK:+1}
|
---|
| 87 | #===========================================================
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | #*******************************************************************#
|
---|
[26a8fdf] | 91 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[12a5707] | 92 | source $COMMON_DIR/func_check_version.sh
|
---|
| 93 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 94 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 95 |
|
---|
[26a8fdf] | 96 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[12a5707] | 97 | source $COMMON_DIR/func_validate_configs.sh
|
---|
| 98 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 99 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[65d83a6] | 100 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[0170229] | 101 |
|
---|
| 102 |
|
---|
| 103 | ###################################
|
---|
[4612459] | 104 | ### MAIN ###
|
---|
[0170229] | 105 | ###################################
|
---|
| 106 |
|
---|
| 107 | # Evaluate any command line switches
|
---|
| 108 |
|
---|
| 109 | while test $# -gt 0 ; do
|
---|
| 110 | case $1 in
|
---|
[40ccddf] | 111 | # Common options for all books
|
---|
[5627958] | 112 | --book | -B )
|
---|
[0170229] | 113 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 114 | shift
|
---|
| 115 | case $1 in
|
---|
| 116 | dev* | SVN | trunk )
|
---|
| 117 | LFSVRS=development
|
---|
| 118 | ;;
|
---|
[5627958] | 119 | *) if [[ "$PROGNAME" = "lfs" ]]; then
|
---|
| 120 | case $1 in
|
---|
[d95b8f2] | 121 | 6.1.1 )
|
---|
| 122 | echo "For stable 6.1.1 book, please use jhalfs-0.2."
|
---|
| 123 | exit 0
|
---|
| 124 | ;;
|
---|
[18911500] | 125 | * )
|
---|
| 126 | echo "$1 is an unsupported version at this time."
|
---|
| 127 | exit 0
|
---|
| 128 | ;;
|
---|
[5627958] | 129 | esac
|
---|
| 130 | else
|
---|
| 131 | echo "The requested version, ${L_arrow} ${BOLD}$1${OFF} ${R_arrow}, is undefined in the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} series."
|
---|
[d95b8f2] | 132 | exit 0
|
---|
| 133 | fi
|
---|
[0170229] | 134 | ;;
|
---|
| 135 | esac
|
---|
| 136 | ;;
|
---|
| 137 |
|
---|
[c16cedc] | 138 | --directory | -D )
|
---|
[0170229] | 139 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 140 | shift
|
---|
[e95c26c] | 141 | case $1 in
|
---|
| 142 | -* )
|
---|
[ea29b1f] | 143 | echo -e "\n$1 isn't a valid build directory."
|
---|
[e95c26c] | 144 | echo -e "Directory names can't start with - .\n"
|
---|
| 145 | exit 1
|
---|
| 146 | ;;
|
---|
| 147 | * )
|
---|
| 148 | BUILDDIR=$1
|
---|
| 149 | JHALFSDIR=$BUILDDIR/jhalfs
|
---|
| 150 | LOGDIR=$JHALFSDIR/logs
|
---|
| 151 | MKFILE=$JHALFSDIR/Makefile
|
---|
| 152 | ;;
|
---|
| 153 | esac
|
---|
[0170229] | 154 | ;;
|
---|
| 155 |
|
---|
[3e7af38] | 156 | --get-packages | -G ) GETPKG=1 ;;
|
---|
[c16cedc] | 157 |
|
---|
[e2b5b99] | 158 | --help | -h ) usage | more && exit ;;
|
---|
[c16cedc] | 159 |
|
---|
[53588e2] | 160 | --optimize | -O )
|
---|
| 161 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 162 | shift
|
---|
| 163 | case $1 in
|
---|
| 164 | 0 | 1 | 2 )
|
---|
| 165 | OPTIMIZE=$1
|
---|
| 166 | ;;
|
---|
| 167 | * )
|
---|
| 168 | echo -e "\n$1 isn't a valid optimize level value."
|
---|
| 169 | echo -e "You must use 0, 1, or 2.\n"
|
---|
| 170 | exit 1
|
---|
| 171 | ;;
|
---|
| 172 | esac
|
---|
| 173 | ;;
|
---|
| 174 |
|
---|
[c16cedc] | 175 | --testsuites | -T )
|
---|
| 176 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 177 | shift
|
---|
| 178 | case $1 in
|
---|
| 179 | 0 | 1 | 2 | 3 )
|
---|
| 180 | TEST=$1
|
---|
| 181 | ;;
|
---|
| 182 | * )
|
---|
| 183 | echo -e "\n$1 isn't a valid testsuites level value."
|
---|
| 184 | echo -e "You must to use 0, 1, 2, or 3.\n"
|
---|
| 185 | exit 1
|
---|
| 186 | ;;
|
---|
| 187 | esac
|
---|
| 188 | ;;
|
---|
| 189 |
|
---|
| 190 | --version | -V )
|
---|
| 191 | echo "$version"
|
---|
| 192 | exit 0
|
---|
| 193 | ;;
|
---|
| 194 |
|
---|
[0170229] | 195 | --working-copy | -W )
|
---|
| 196 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 197 | shift
|
---|
[5627958] | 198 | case $PROGNAME in # Poor checks. We should find better ones.
|
---|
| 199 | lfs)
|
---|
| 200 | if [ -f $1/patches.ent ] ; then
|
---|
| 201 | WC=1
|
---|
| 202 | BOOK=$1
|
---|
| 203 | else
|
---|
[da626a9] | 204 | echo -e "\nLooks like $1 isn't a LFS working copy."
|
---|
[5627958] | 205 | exit 1
|
---|
| 206 | fi
|
---|
| 207 | ;;
|
---|
| 208 | clfs)
|
---|
| 209 | if [ -f $1/patches.ent ] && [ -f $1/packages.ent ]; then
|
---|
| 210 | WC=1
|
---|
| 211 | BOOK=$1
|
---|
| 212 | else
|
---|
[da626a9] | 213 | echo -e "\nLooks like $1 isn't a CLFS working copy."
|
---|
[5627958] | 214 | exit 1
|
---|
| 215 | fi
|
---|
| 216 | ;;
|
---|
| 217 | hlfs)
|
---|
| 218 | if [ -f $1/template.xml ] ; then
|
---|
| 219 | WC=1
|
---|
| 220 | BOOK=$1
|
---|
| 221 | else
|
---|
[da626a9] | 222 | echo -e "\nLooks like $1 isn't a HLFS working copy."
|
---|
[5627958] | 223 | exit 1
|
---|
| 224 | fi
|
---|
| 225 | ;;
|
---|
| 226 | blfs)
|
---|
| 227 | if [ -f $1/use-unzip.xml ] ; then
|
---|
| 228 | WC=1
|
---|
| 229 | BOOK=$1
|
---|
| 230 | else
|
---|
[da626a9] | 231 | echo -e "\nLooks like $1 isn't a BLFS working copy."
|
---|
[5627958] | 232 | exit 1
|
---|
| 233 | fi
|
---|
| 234 | ;;
|
---|
[4532c37] | 235 | esac
|
---|
| 236 | ;;
|
---|
[0170229] | 237 |
|
---|
[40ccddf] | 238 | # Common options for LFS, CLFS and HLFS
|
---|
[4612459] | 239 | --comparasion | -C )
|
---|
| 240 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 241 | shift
|
---|
[02d1ae7] | 242 | case $1 in
|
---|
[4612459] | 243 | ICA) RUN_ICA=1
|
---|
| 244 | RUN_FARCE=0
|
---|
[fb68d23] | 245 | COMPARE=1
|
---|
[4612459] | 246 | ;;
|
---|
| 247 | farce) RUN_ICA=0
|
---|
| 248 | RUN_FARCE=1
|
---|
[fb68d23] | 249 | COMPARE=1
|
---|
[4612459] | 250 | ;;
|
---|
| 251 | both) RUN_ICA=1
|
---|
| 252 | RUN_FARCE=1
|
---|
[fb68d23] | 253 | COMPARE=1
|
---|
[97520c9] | 254 | ;;
|
---|
[4612459] | 255 | *)
|
---|
[c58f330] | 256 | echo -e "\n$1 is an unknown analysis method."
|
---|
[4612459] | 257 | exit 1
|
---|
| 258 | ;;
|
---|
| 259 | esac
|
---|
| 260 | ;;
|
---|
[42346b2] | 261 |
|
---|
[40ccddf] | 262 | --fstab | -F )
|
---|
| 263 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 264 | shift
|
---|
| 265 | if [ -f $1 ] ; then
|
---|
| 266 | FSTAB=$1
|
---|
| 267 | else
|
---|
| 268 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 269 | exit 1
|
---|
| 270 | fi
|
---|
| 271 | ;;
|
---|
| 272 |
|
---|
| 273 | --kernel-config | -K )
|
---|
| 274 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 275 | shift
|
---|
| 276 | if [ -f $1 ] ; then
|
---|
| 277 | CONFIG=$1
|
---|
| 278 | else
|
---|
| 279 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 280 | exit 1
|
---|
| 281 | fi
|
---|
| 282 | ;;
|
---|
| 283 |
|
---|
[bd99331] | 284 | --make | -M ) RUNMAKE=1 ;;
|
---|
[40ccddf] | 285 |
|
---|
| 286 | --rebuild | -R ) CLEAN=1 ;;
|
---|
| 287 |
|
---|
[bd99331] | 288 | # CLFS options
|
---|
| 289 | --arch | -A )
|
---|
| 290 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 291 | shift
|
---|
| 292 | case $1 in
|
---|
| 293 | x86 )
|
---|
| 294 | ARCH=x86
|
---|
| 295 | TARGET="i686-pc-linux-gnu"
|
---|
| 296 | ;;
|
---|
| 297 | i486 )
|
---|
| 298 | ARCH=x86
|
---|
| 299 | TARGET="i486-pc-linux-gnu"
|
---|
| 300 | ;;
|
---|
| 301 | i586 )
|
---|
| 302 | ARCH=x86
|
---|
| 303 | TARGET="i586-pc-linux-gnu"
|
---|
| 304 | ;;
|
---|
| 305 | ppc )
|
---|
| 306 | ARCH=ppc
|
---|
| 307 | TARGET="powerpc-unknown-linux-gnu"
|
---|
| 308 | ;;
|
---|
| 309 | mips )
|
---|
| 310 | ARCH=mips
|
---|
| 311 | TARGET="mips-unknown-linux-gnu"
|
---|
| 312 | ;;
|
---|
| 313 | mipsel )
|
---|
| 314 | ARCH=mips
|
---|
| 315 | TARGET="mipsel-unknown-linux-gnu"
|
---|
| 316 | ;;
|
---|
| 317 | sparc )
|
---|
| 318 | ARCH=sparc
|
---|
| 319 | TARGET="sparcv9-unknown-linux-gnu"
|
---|
| 320 | ;;
|
---|
| 321 | x86_64-64 )
|
---|
| 322 | ARCH=x86_64-64
|
---|
| 323 | TARGET="x86_64-unknown-linux-gnu"
|
---|
| 324 | ;;
|
---|
| 325 | mips64-64 )
|
---|
| 326 | ARCH=mips64-64
|
---|
| 327 | TARGET="mips-unknown-linux-gnu"
|
---|
| 328 | ;;
|
---|
| 329 | mipsel64-64 )
|
---|
| 330 | ARCH=mips64-64
|
---|
| 331 | TARGET="mipsel-unknown-linux-gnu"
|
---|
| 332 | ;;
|
---|
| 333 | sparc64-64 )
|
---|
| 334 | ARCH=sparc64-64
|
---|
| 335 | TARGET="sparc64-unknown-linux-gnu"
|
---|
| 336 | ;;
|
---|
| 337 | alpha )
|
---|
| 338 | ARCH=alpha
|
---|
| 339 | TARGET="alpha-unknown-linux-gnu"
|
---|
| 340 | ;;
|
---|
| 341 | x86_64 )
|
---|
| 342 | ARCH=x86_64
|
---|
| 343 | TARGET="x86_64-unknown-linux-gnu"
|
---|
| 344 | TARGET32="i686-pc-linux-gnu"
|
---|
| 345 | ;;
|
---|
| 346 | mips64 )
|
---|
| 347 | ARCH=mips64
|
---|
| 348 | TARGET="mips-unknown-linux-gnu"
|
---|
| 349 | TARGET32="mips-unknown-linux-gnu"
|
---|
| 350 | ;;
|
---|
| 351 | mipsel64 )
|
---|
| 352 | ARCH=mips64
|
---|
| 353 | TARGET="mipsel-unknown-linux-gnu"
|
---|
| 354 | TARGET32="mipsel-unknown-linux-gnu"
|
---|
| 355 | ;;
|
---|
| 356 | sparc64 )
|
---|
| 357 | ARCH=sparc64
|
---|
| 358 | TARGET="sparc64-unknown-linux-gnu"
|
---|
| 359 | TARGET32="sparcv9-unknown-linux-gnu"
|
---|
| 360 | ;;
|
---|
| 361 | ppc64 )
|
---|
| 362 | ARCH=ppc64
|
---|
| 363 | TARGET="powerpc64-unknown-linux-gnu"
|
---|
| 364 | TARGET32="powerpc-unknown-linux-gnu"
|
---|
| 365 | ;;
|
---|
| 366 | * )
|
---|
| 367 | echo -e "\n$1 is an unknown or unsopported arch."
|
---|
| 368 | exit 1
|
---|
| 369 | ;;
|
---|
| 370 | esac
|
---|
| 371 | ;;
|
---|
| 372 |
|
---|
[5ff30ff] | 373 | --boot-config )
|
---|
| 374 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 375 | shift
|
---|
| 376 | if [ -f $1 ] ; then
|
---|
| 377 | BOOT_CONFIG=$1
|
---|
| 378 | else
|
---|
| 379 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 380 | exit 1
|
---|
| 381 | fi
|
---|
| 382 | ;;
|
---|
| 383 |
|
---|
[bd99331] | 384 | --method )
|
---|
| 385 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 386 | shift
|
---|
| 387 | case $1 in
|
---|
| 388 | chroot | boot )
|
---|
| 389 | METHOD=$1
|
---|
| 390 | ;;
|
---|
| 391 | * )
|
---|
| 392 | echo -e "\n$1 isn't a valid build method."
|
---|
| 393 | exit 1
|
---|
| 394 | ;;
|
---|
| 395 | esac
|
---|
| 396 | ;;
|
---|
| 397 |
|
---|
[890acc6] | 398 | # HLFS options
|
---|
| 399 | --model )
|
---|
| 400 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 401 | shift
|
---|
| 402 | case $1 in
|
---|
| 403 | glibc | uclibc )
|
---|
| 404 | MODEL=$1
|
---|
| 405 | ;;
|
---|
| 406 | * )
|
---|
| 407 | echo -e "\n$1 isn't a valid libc model."
|
---|
| 408 | exit 1
|
---|
| 409 | ;;
|
---|
| 410 | esac
|
---|
| 411 | ;;
|
---|
| 412 |
|
---|
| 413 | # BLFS options
|
---|
| 414 | --dependencies )
|
---|
| 415 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 416 | shift
|
---|
| 417 | case $1 in
|
---|
| 418 | 0 | 1 | 2 )
|
---|
| 419 | DEPEND=$1
|
---|
| 420 | ;;
|
---|
| 421 | * )
|
---|
| 422 | echo -e "\n$1 isn't a valid dependencies level."
|
---|
| 423 | exit 1
|
---|
| 424 | ;;
|
---|
| 425 | esac
|
---|
| 426 | ;;
|
---|
| 427 |
|
---|
[bd99331] | 428 | # Unknown options
|
---|
[e794f06] | 429 | * ) usage ;;
|
---|
[0170229] | 430 | esac
|
---|
| 431 | shift
|
---|
| 432 | done
|
---|
| 433 |
|
---|
| 434 | #===================================================
|
---|
| 435 | # Set the document location...
|
---|
[13e816f] | 436 | # BOOK is either defined in
|
---|
[0170229] | 437 | # xxx.config
|
---|
| 438 | # comand line
|
---|
[13e816f] | 439 | # default
|
---|
[d95b8f2] | 440 | # If set by conf file or cmd line leave it
|
---|
[0170229] | 441 | # alone otherwise load the default version
|
---|
| 442 | #===================================================
|
---|
| 443 | BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
---|
| 444 | #===================================================
|
---|
| 445 |
|
---|
[13e816f] | 446 |
|
---|
| 447 | # Check for minumum gcc and kernel versions
|
---|
| 448 | #check_requirements 1 # 0/1 0-do not display values.
|
---|
[f15fe85] | 449 | echo
|
---|
[13e816f] | 450 | check_version "2.6.2" "`uname -r`" "KERNEL"
|
---|
| 451 | check_version "3.0" "$BASH_VERSION" "BASH"
|
---|
| 452 | check_version "3.0" "`gcc -dumpversion`" "GCC"
|
---|
[e1edff3] | 453 | tarVer=`tar --version`
|
---|
| 454 | check_version "1.15.0" "${tarVer##* }" "TAR"
|
---|
[65d83a6] | 455 | echo "${SD_BORDER}${nl_}"
|
---|
[13e816f] | 456 |
|
---|
[3051f95] | 457 | validate_config
|
---|
[65d83a6] | 458 | echo "${SD_BORDER}${nl_}"
|
---|
[13e816f] | 459 |
|
---|
[7e6ddf0] | 460 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
[13e816f] | 461 | read ANSWER
|
---|
| 462 | if [ x$ANSWER != "xyes" ] ; then
|
---|
| 463 | echo "${nl_}Fix the configuration options and rerun the script.${nl_}"
|
---|
| 464 | exit 1
|
---|
| 465 | fi
|
---|
[65d83a6] | 466 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
[13e816f] | 467 |
|
---|
| 468 | # Prevents setting "-d /" by mistake.
|
---|
| 469 |
|
---|
| 470 | if [ $BUILDDIR = / ] ; then
|
---|
| 471 | echo -ne "\nThe root directory can't be used to build LFS.\n\n"
|
---|
| 472 | exit 1
|
---|
| 473 | fi
|
---|
| 474 |
|
---|
| 475 | # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
|
---|
| 476 | # and notify the user about that.
|
---|
| 477 |
|
---|
| 478 | if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
|
---|
| 479 | eval "$no_empty_builddir"
|
---|
| 480 | fi
|
---|
| 481 |
|
---|
| 482 | # If requested, clean the build directory
|
---|
| 483 | clean_builddir
|
---|
| 484 |
|
---|
[0170229] | 485 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
[a110145] | 486 | mkdir -p $JHALFSDIR
|
---|
[0170229] | 487 | fi
|
---|
| 488 |
|
---|
[13e816f] | 489 | if [[ "$PWD" != "$JHALFSDIR" ]]; then
|
---|
[a110145] | 490 | cp $COMMON_DIR/makefile-functions $JHALFSDIR/
|
---|
[d0e48ec] | 491 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[fb68d23] | 492 | if [[ "$COMPARE" != "0" ]] ; then
|
---|
[cc020f4] | 493 | mkdir -p $JHALFSDIR/extras
|
---|
[4612459] | 494 | cp extras/* $JHALFSDIR/extras
|
---|
[ed0a142] | 495 | fi
|
---|
[0170229] | 496 | if [[ -n "$FILES" ]]; then
|
---|
[9c90294] | 497 | # pushd/popd necessary to deal with mulitiple files
|
---|
[a110145] | 498 | pushd $PACKAGE_DIR 1> /dev/null
|
---|
| 499 | cp $FILES $JHALFSDIR/
|
---|
| 500 | popd 1> /dev/null
|
---|
[0170229] | 501 | fi
|
---|
[9e4b9a1] | 502 | [[ "$REPORT" = "1" ]] && cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[3e7af38] | 503 | [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
[12a5707] | 504 | sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
---|
[0170229] | 505 | export XSL=$JHALFSDIR/${XSL}
|
---|
| 506 | fi
|
---|
| 507 |
|
---|
| 508 | if [[ ! -d $LOGDIR ]]; then
|
---|
[a110145] | 509 | mkdir $LOGDIR
|
---|
[0170229] | 510 | fi
|
---|
[3cc7540] | 511 |
|
---|
| 512 | # After be sure that all look sane and if REPORT=1, dump the settings to a file
|
---|
| 513 | # This file will be used to create the REPORT header
|
---|
| 514 | [[ "$REPORT" = "1" ]] && validate_config > $JHALFSDIR/jhalfs.config
|
---|
| 515 |
|
---|
[0170229] | 516 | >$LOGDIR/$LOG
|
---|
| 517 |
|
---|
| 518 | get_book
|
---|
[65d83a6] | 519 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 520 |
|
---|
[0170229] | 521 | build_Makefile
|
---|
[65d83a6] | 522 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 523 |
|
---|
[386bc75] | 524 | run_make
|
---|
[0170229] | 525 |
|
---|