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