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