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