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