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