[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() {
|
---|
[9e627f6] | 17 | echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\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 |
|
---|
[0170229] | 49 |
|
---|
[613d46b] | 50 | if [[ -e using_menuconfig ]]; then
|
---|
[398a037] | 51 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
[613d46b] | 52 | source configuration
|
---|
[398a037] | 53 | [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
---|
| 54 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[9485eba] | 55 |
|
---|
[613d46b] | 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
|
---|
[47fddc8] | 66 | XSL=$PROGNAME.xsl
|
---|
[613d46b] | 67 |
|
---|
[47fddc8] | 68 | case $PROGNAME in
|
---|
[9e627f6] | 69 | clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;;
|
---|
[47fddc8] | 70 | *) LFSVRS=development; TREE=trunk/BOOK ;;
|
---|
| 71 | esac
|
---|
[9e627f6] | 72 |
|
---|
[398a037] | 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 | ;;
|
---|
[613d46b] | 98 | esac
|
---|
[398a037] | 99 | fi
|
---|
[47fddc8] | 100 | # These are boolean vars generated from Config.in.
|
---|
[9e627f6] | 101 | # ISSUE: If a boolean parameter is not set <true> that
|
---|
| 102 | # variable is not defined by the menu app. This can
|
---|
[47fddc8] | 103 | # cause a headache if you are not careful.
|
---|
[9e627f6] | 104 | # The following parameters MUST be created and have a
|
---|
[47fddc8] | 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}
|
---|
[9e627f6] | 118 |
|
---|
[47fddc8] | 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 | #
|
---|
[613d46b] | 131 | fi
|
---|
[0170229] | 132 |
|
---|
[47fddc8] | 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 |
|
---|
[0170229] | 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 | #*******************************************************************#
|
---|
[26a8fdf] | 155 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[12a5707] | 156 | source $COMMON_DIR/func_check_version.sh
|
---|
| 157 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 158 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 159 |
|
---|
[26a8fdf] | 160 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[12a5707] | 161 | source $COMMON_DIR/func_validate_configs.sh
|
---|
| 162 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 163 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[65d83a6] | 164 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[0170229] | 165 |
|
---|
| 166 |
|
---|
| 167 | ###################################
|
---|
[4612459] | 168 | ### MAIN ###
|
---|
[0170229] | 169 | ###################################
|
---|
| 170 |
|
---|
| 171 | # Evaluate any command line switches
|
---|
| 172 |
|
---|
| 173 | while test $# -gt 0 ; do
|
---|
| 174 | case $1 in
|
---|
[25b52e2] | 175 | # Common options for {C,H}LFS books
|
---|
[5627958] | 176 | --book | -B )
|
---|
[0170229] | 177 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 178 | shift
|
---|
| 179 | case $1 in
|
---|
| 180 | dev* | SVN | trunk )
|
---|
| 181 | LFSVRS=development
|
---|
[3b63c8c] | 182 | TREE=trunk/BOOK
|
---|
[0170229] | 183 | ;;
|
---|
[3b63c8c] | 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
|
---|
[0170229] | 199 | ;;
|
---|
| 200 | esac
|
---|
| 201 | ;;
|
---|
| 202 |
|
---|
[c16cedc] | 203 | --directory | -D )
|
---|
[0170229] | 204 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 205 | shift
|
---|
[e95c26c] | 206 | case $1 in
|
---|
| 207 | -* )
|
---|
[ea29b1f] | 208 | echo -e "\n$1 isn't a valid build directory."
|
---|
[e95c26c] | 209 | echo -e "Directory names can't start with - .\n"
|
---|
| 210 | exit 1
|
---|
| 211 | ;;
|
---|
| 212 | * )
|
---|
| 213 | BUILDDIR=$1
|
---|
[460ea63] | 214 | JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
|
---|
[e95c26c] | 215 | LOGDIR=$JHALFSDIR/logs
|
---|
[e35e794] | 216 | TESTLOGDIR=$JHALFSDIR/test-logs
|
---|
[e95c26c] | 217 | MKFILE=$JHALFSDIR/Makefile
|
---|
| 218 | ;;
|
---|
| 219 | esac
|
---|
[0170229] | 220 | ;;
|
---|
| 221 |
|
---|
[47fddc8] | 222 | --get-packages | -G ) GETPKG=y ;;
|
---|
[c16cedc] | 223 |
|
---|
[e2b5b99] | 224 | --help | -h ) usage | more && exit ;;
|
---|
[c16cedc] | 225 |
|
---|
[53588e2] | 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 |
|
---|
[c16cedc] | 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 |
|
---|
[0170229] | 261 | --working-copy | -W )
|
---|
| 262 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 263 | shift
|
---|
[5627958] | 264 | case $PROGNAME in # Poor checks. We should find better ones.
|
---|
| 265 | lfs)
|
---|
[f8615e5] | 266 | if [ -d $1/chapter09 ] ; then
|
---|
[5627958] | 267 | WC=1
|
---|
| 268 | BOOK=$1
|
---|
| 269 | else
|
---|
[3b63c8c] | 270 | echo -e "\nLooks like $1 isn't an LFS working copy."
|
---|
[5627958] | 271 | exit 1
|
---|
| 272 | fi
|
---|
| 273 | ;;
|
---|
| 274 | clfs)
|
---|
[f8615e5] | 275 | if [ -d $1/cross-tools ] ; then
|
---|
[5627958] | 276 | WC=1
|
---|
| 277 | BOOK=$1
|
---|
| 278 | else
|
---|
[da626a9] | 279 | echo -e "\nLooks like $1 isn't a CLFS working copy."
|
---|
[5627958] | 280 | exit 1
|
---|
| 281 | fi
|
---|
| 282 | ;;
|
---|
| 283 | hlfs)
|
---|
| 284 | if [ -f $1/template.xml ] ; then
|
---|
| 285 | WC=1
|
---|
| 286 | BOOK=$1
|
---|
| 287 | else
|
---|
[3b63c8c] | 288 | echo -e "\nLooks like $1 isn't an HLFS working copy."
|
---|
[5627958] | 289 | exit 1
|
---|
| 290 | fi
|
---|
| 291 | ;;
|
---|
[4532c37] | 292 | esac
|
---|
| 293 | ;;
|
---|
[0170229] | 294 |
|
---|
[3b63c8c] | 295 | --comparison | -C )
|
---|
[4612459] | 296 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 297 | shift
|
---|
[02d1ae7] | 298 | case $1 in
|
---|
[47fddc8] | 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 ;;
|
---|
[4612459] | 302 | *)
|
---|
[c58f330] | 303 | echo -e "\n$1 is an unknown analysis method."
|
---|
[4612459] | 304 | exit 1
|
---|
| 305 | ;;
|
---|
| 306 | esac
|
---|
| 307 | ;;
|
---|
[42346b2] | 308 |
|
---|
[40ccddf] | 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 |
|
---|
[3fa20d4] | 331 | --run-make | -M ) RUNMAKE=y ;;
|
---|
[40ccddf] | 332 |
|
---|
[3fa20d4] | 333 | --rebuild | -R ) CLEAN=y ;;
|
---|
[40ccddf] | 334 |
|
---|
[bd99331] | 335 | # CLFS options
|
---|
| 336 | --arch | -A )
|
---|
| 337 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 338 | shift
|
---|
[47fddc8] | 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" ;;
|
---|
[9e627f6] | 357 |
|
---|
[47fddc8] | 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" ;;
|
---|
[9e627f6] | 363 |
|
---|
[47fddc8] | 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" ;;
|
---|
[9e627f6] | 369 |
|
---|
[47fddc8] | 370 | * ) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 ;;
|
---|
| 371 | esac
|
---|
| 372 | ;;
|
---|
[bd99331] | 373 | esac
|
---|
| 374 | ;;
|
---|
| 375 |
|
---|
[5ff30ff] | 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 |
|
---|
[bd99331] | 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 |
|
---|
[890acc6] | 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 |
|
---|
[bd99331] | 416 | # Unknown options
|
---|
[e794f06] | 417 | * ) usage ;;
|
---|
[0170229] | 418 | esac
|
---|
| 419 | shift
|
---|
| 420 | done
|
---|
| 421 |
|
---|
[47fddc8] | 422 |
|
---|
[0170229] | 423 | #===================================================
|
---|
| 424 | # Set the document location...
|
---|
[13e816f] | 425 | # BOOK is either defined in
|
---|
[0170229] | 426 | # xxx.config
|
---|
| 427 | # comand line
|
---|
[13e816f] | 428 | # default
|
---|
[d95b8f2] | 429 | # If set by conf file or cmd line leave it
|
---|
[0170229] | 430 | # alone otherwise load the default version
|
---|
| 431 | #===================================================
|
---|
| 432 | BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
---|
| 433 | #===================================================
|
---|
| 434 |
|
---|
[13e816f] | 435 |
|
---|
[47fddc8] | 436 | # Check for minimum bash,tar,gcc and kernel versions
|
---|
[f15fe85] | 437 | echo
|
---|
[13e816f] | 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"
|
---|
[e35e794] | 441 | tarVer=`tar --version | head -n1 | cut -d " " -f4`
|
---|
| 442 | check_version "1.15.0" "${tarVer}" "TAR"
|
---|
[65d83a6] | 443 | echo "${SD_BORDER}${nl_}"
|
---|
[13e816f] | 444 |
|
---|
[3051f95] | 445 | validate_config
|
---|
[65d83a6] | 446 | echo "${SD_BORDER}${nl_}"
|
---|
[7e6ddf0] | 447 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
[13e816f] | 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
|
---|
[65d83a6] | 453 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
[13e816f] | 454 |
|
---|
[3a27393] | 455 | # Load additional modules or configuration files based on global settings
|
---|
[bb8e6bc] | 456 | # compare module
|
---|
[47fddc8] | 457 | if [[ "$COMPARE" = "y" ]]; then
|
---|
[bb8e6bc] | 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
|
---|
| 463 | #
|
---|
[2c2471d] | 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"
|
---|
[3a27393] | 470 | #
|
---|
| 471 | # optimize configurations
|
---|
[bb8e6bc] | 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"
|
---|
[3a27393] | 476 | # Validate optimize settings, if required
|
---|
| 477 | validate_opt_settings
|
---|
[bb8e6bc] | 478 | fi
|
---|
| 479 | #
|
---|
| 480 |
|
---|
[13e816f] | 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 |
|
---|
[0170229] | 490 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
[a110145] | 491 | mkdir -p $JHALFSDIR
|
---|
[0170229] | 492 | fi
|
---|
[3a27393] | 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 | #
|
---|
[e35e794] | 505 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
[3a27393] | 506 | #
|
---|
[13e816f] | 507 | if [[ "$PWD" != "$JHALFSDIR" ]]; then
|
---|
[460ea63] | 508 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
---|
[e35e794] | 509 | #
|
---|
[d0e48ec] | 510 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[e35e794] | 511 | #
|
---|
[47fddc8] | 512 | if [[ "$COMPARE" = "y" ]]; then
|
---|
[cc020f4] | 513 | mkdir -p $JHALFSDIR/extras
|
---|
[4612459] | 514 | cp extras/* $JHALFSDIR/extras
|
---|
[ed0a142] | 515 | fi
|
---|
[3a27393] | 516 | #
|
---|
[0170229] | 517 | if [[ -n "$FILES" ]]; then
|
---|
[3b63c8c] | 518 | # pushd/popd necessary to deal with multiple files
|
---|
[a110145] | 519 | pushd $PACKAGE_DIR 1> /dev/null
|
---|
| 520 | cp $FILES $JHALFSDIR/
|
---|
| 521 | popd 1> /dev/null
|
---|
[0170229] | 522 | fi
|
---|
[3a27393] | 523 | #
|
---|
[47fddc8] | 524 | if [[ "$REPORT" = "y" ]]; then
|
---|
[25b52e2] | 525 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[3b63c8c] | 526 | # After being sure that all looks sane, dump the settings to a file
|
---|
[25b52e2] | 527 | # This file will be used to create the REPORT header
|
---|
| 528 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
[708a612] | 529 | fi
|
---|
[3a27393] | 530 | #
|
---|
[47fddc8] | 531 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
[25b52e2] | 532 | #
|
---|
[3b63c8c] | 533 | cp $COMMON_DIR/packages.xsl $JHALFSDIR/
|
---|
| 534 | #
|
---|
[12a5707] | 535 | sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
---|
[0170229] | 536 | export XSL=$JHALFSDIR/${XSL}
|
---|
| 537 | fi
|
---|
| 538 |
|
---|
| 539 | get_book
|
---|
[65d83a6] | 540 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 541 |
|
---|
[0170229] | 542 | build_Makefile
|
---|
[65d83a6] | 543 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 544 |
|
---|
[386bc75] | 545 | run_make
|
---|