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