[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 |
|
---|
[480390a] | 56 | #--- CONSTANTS
|
---|
| 57 | declare -r SVN="svn://svn.linuxfromscratch.org"
|
---|
| 58 | declare -r LOG=000-masterscript.log
|
---|
[0044289] | 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
|
---|
[613d46b] | 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
|
---|
[47fddc8] | 72 | XSL=$PROGNAME.xsl
|
---|
[1d14a64] | 73 | PKG_LST=unpacked
|
---|
[613d46b] | 74 |
|
---|
[47fddc8] | 75 | case $PROGNAME in
|
---|
[9e627f6] | 76 | clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;;
|
---|
[47fddc8] | 77 | *) LFSVRS=development; TREE=trunk/BOOK ;;
|
---|
| 78 | esac
|
---|
[9e627f6] | 79 |
|
---|
[398a037] | 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 | ;;
|
---|
[613d46b] | 105 | esac
|
---|
[398a037] | 106 | fi
|
---|
[47fddc8] | 107 | # These are boolean vars generated from Config.in.
|
---|
[9e627f6] | 108 | # ISSUE: If a boolean parameter is not set <true> that
|
---|
| 109 | # variable is not defined by the menu app. This can
|
---|
[47fddc8] | 110 | # cause a headache if you are not careful.
|
---|
[9e627f6] | 111 | # The following parameters MUST be created and have a
|
---|
[47fddc8] | 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}
|
---|
[9e627f6] | 125 |
|
---|
[47fddc8] | 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 | #
|
---|
[613d46b] | 138 | fi
|
---|
[0170229] | 139 |
|
---|
[47fddc8] | 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 |
|
---|
[0170229] | 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 | #*******************************************************************#
|
---|
[26a8fdf] | 162 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[12a5707] | 163 | source $COMMON_DIR/func_check_version.sh
|
---|
| 164 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 165 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[0170229] | 166 |
|
---|
[26a8fdf] | 167 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[12a5707] | 168 | source $COMMON_DIR/func_validate_configs.sh
|
---|
| 169 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
[26a8fdf] | 170 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[65d83a6] | 171 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[0170229] | 172 |
|
---|
| 173 |
|
---|
| 174 | ###################################
|
---|
[4612459] | 175 | ### MAIN ###
|
---|
[0170229] | 176 | ###################################
|
---|
| 177 |
|
---|
| 178 | # Evaluate any command line switches
|
---|
| 179 |
|
---|
| 180 | while test $# -gt 0 ; do
|
---|
| 181 | case $1 in
|
---|
[25b52e2] | 182 | # Common options for {C,H}LFS books
|
---|
[5627958] | 183 | --book | -B )
|
---|
[0170229] | 184 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 185 | shift
|
---|
| 186 | case $1 in
|
---|
| 187 | dev* | SVN | trunk )
|
---|
| 188 | LFSVRS=development
|
---|
[3b63c8c] | 189 | TREE=trunk/BOOK
|
---|
[0170229] | 190 | ;;
|
---|
[3b63c8c] | 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
|
---|
[0170229] | 206 | ;;
|
---|
| 207 | esac
|
---|
| 208 | ;;
|
---|
| 209 |
|
---|
[c16cedc] | 210 | --directory | -D )
|
---|
[0170229] | 211 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 212 | shift
|
---|
[e95c26c] | 213 | case $1 in
|
---|
| 214 | -* )
|
---|
[ea29b1f] | 215 | echo -e "\n$1 isn't a valid build directory."
|
---|
[e95c26c] | 216 | echo -e "Directory names can't start with - .\n"
|
---|
| 217 | exit 1
|
---|
| 218 | ;;
|
---|
| 219 | * )
|
---|
| 220 | BUILDDIR=$1
|
---|
[460ea63] | 221 | JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
|
---|
[e95c26c] | 222 | LOGDIR=$JHALFSDIR/logs
|
---|
[e35e794] | 223 | TESTLOGDIR=$JHALFSDIR/test-logs
|
---|
[e95c26c] | 224 | MKFILE=$JHALFSDIR/Makefile
|
---|
| 225 | ;;
|
---|
| 226 | esac
|
---|
[0170229] | 227 | ;;
|
---|
| 228 |
|
---|
[47fddc8] | 229 | --get-packages | -G ) GETPKG=y ;;
|
---|
[c16cedc] | 230 |
|
---|
[e2b5b99] | 231 | --help | -h ) usage | more && exit ;;
|
---|
[c16cedc] | 232 |
|
---|
[53588e2] | 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 |
|
---|
[c16cedc] | 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 |
|
---|
[0170229] | 268 | --working-copy | -W )
|
---|
| 269 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 270 | shift
|
---|
[5627958] | 271 | case $PROGNAME in # Poor checks. We should find better ones.
|
---|
| 272 | lfs)
|
---|
[f8615e5] | 273 | if [ -d $1/chapter09 ] ; then
|
---|
[5627958] | 274 | WC=1
|
---|
| 275 | BOOK=$1
|
---|
| 276 | else
|
---|
[3b63c8c] | 277 | echo -e "\nLooks like $1 isn't an LFS working copy."
|
---|
[5627958] | 278 | exit 1
|
---|
| 279 | fi
|
---|
| 280 | ;;
|
---|
| 281 | clfs)
|
---|
[f8615e5] | 282 | if [ -d $1/cross-tools ] ; then
|
---|
[5627958] | 283 | WC=1
|
---|
| 284 | BOOK=$1
|
---|
| 285 | else
|
---|
[da626a9] | 286 | echo -e "\nLooks like $1 isn't a CLFS working copy."
|
---|
[5627958] | 287 | exit 1
|
---|
| 288 | fi
|
---|
| 289 | ;;
|
---|
| 290 | hlfs)
|
---|
| 291 | if [ -f $1/template.xml ] ; then
|
---|
| 292 | WC=1
|
---|
| 293 | BOOK=$1
|
---|
| 294 | else
|
---|
[3b63c8c] | 295 | echo -e "\nLooks like $1 isn't an HLFS working copy."
|
---|
[5627958] | 296 | exit 1
|
---|
| 297 | fi
|
---|
| 298 | ;;
|
---|
[4532c37] | 299 | esac
|
---|
| 300 | ;;
|
---|
[0170229] | 301 |
|
---|
[3b63c8c] | 302 | --comparison | -C )
|
---|
[4612459] | 303 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 304 | shift
|
---|
[02d1ae7] | 305 | case $1 in
|
---|
[47fddc8] | 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 ;;
|
---|
[4612459] | 309 | *)
|
---|
[c58f330] | 310 | echo -e "\n$1 is an unknown analysis method."
|
---|
[4612459] | 311 | exit 1
|
---|
| 312 | ;;
|
---|
| 313 | esac
|
---|
| 314 | ;;
|
---|
[42346b2] | 315 |
|
---|
[40ccddf] | 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 |
|
---|
[3fa20d4] | 338 | --run-make | -M ) RUNMAKE=y ;;
|
---|
[40ccddf] | 339 |
|
---|
[3fa20d4] | 340 | --rebuild | -R ) CLEAN=y ;;
|
---|
[40ccddf] | 341 |
|
---|
[bd99331] | 342 | # CLFS options
|
---|
| 343 | --arch | -A )
|
---|
| 344 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 345 | shift
|
---|
[47fddc8] | 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" ;;
|
---|
[9e627f6] | 364 |
|
---|
[47fddc8] | 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" ;;
|
---|
[9e627f6] | 370 |
|
---|
[47fddc8] | 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" ;;
|
---|
[9e627f6] | 376 |
|
---|
[47fddc8] | 377 | * ) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 ;;
|
---|
| 378 | esac
|
---|
| 379 | ;;
|
---|
[bd99331] | 380 | esac
|
---|
| 381 | ;;
|
---|
| 382 |
|
---|
[5ff30ff] | 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 |
|
---|
[bd99331] | 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 |
|
---|
[890acc6] | 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 |
|
---|
[bd99331] | 423 | # Unknown options
|
---|
[e794f06] | 424 | * ) usage ;;
|
---|
[0170229] | 425 | esac
|
---|
| 426 | shift
|
---|
| 427 | done
|
---|
| 428 |
|
---|
[47fddc8] | 429 |
|
---|
[0170229] | 430 | #===================================================
|
---|
| 431 | # Set the document location...
|
---|
[13e816f] | 432 | # BOOK is either defined in
|
---|
[0170229] | 433 | # xxx.config
|
---|
| 434 | # comand line
|
---|
[13e816f] | 435 | # default
|
---|
[d95b8f2] | 436 | # If set by conf file or cmd line leave it
|
---|
[0170229] | 437 | # alone otherwise load the default version
|
---|
| 438 | #===================================================
|
---|
| 439 | BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
---|
| 440 | #===================================================
|
---|
| 441 |
|
---|
[13e816f] | 442 |
|
---|
[47fddc8] | 443 | # Check for minimum bash,tar,gcc and kernel versions
|
---|
[f15fe85] | 444 | echo
|
---|
[13e816f] | 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"
|
---|
[e35e794] | 448 | tarVer=`tar --version | head -n1 | cut -d " " -f4`
|
---|
| 449 | check_version "1.15.0" "${tarVer}" "TAR"
|
---|
[65d83a6] | 450 | echo "${SD_BORDER}${nl_}"
|
---|
[13e816f] | 451 |
|
---|
[3051f95] | 452 | validate_config
|
---|
[65d83a6] | 453 | echo "${SD_BORDER}${nl_}"
|
---|
[7e6ddf0] | 454 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
[13e816f] | 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
|
---|
[65d83a6] | 460 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
[13e816f] | 461 |
|
---|
[3a27393] | 462 | # Load additional modules or configuration files based on global settings
|
---|
[bb8e6bc] | 463 | # compare module
|
---|
[47fddc8] | 464 | if [[ "$COMPARE" = "y" ]]; then
|
---|
[bb8e6bc] | 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
|
---|
| 470 | #
|
---|
[2c2471d] | 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"
|
---|
[3a27393] | 477 | #
|
---|
| 478 | # optimize configurations
|
---|
[bb8e6bc] | 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"
|
---|
[3a27393] | 483 | # Validate optimize settings, if required
|
---|
| 484 | validate_opt_settings
|
---|
[bb8e6bc] | 485 | fi
|
---|
| 486 | #
|
---|
| 487 |
|
---|
[13e816f] | 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 |
|
---|
[0170229] | 497 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
[a110145] | 498 | mkdir -p $JHALFSDIR
|
---|
[0170229] | 499 | fi
|
---|
[3a27393] | 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 | #
|
---|
[e35e794] | 512 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
[3a27393] | 513 | #
|
---|
[13e816f] | 514 | if [[ "$PWD" != "$JHALFSDIR" ]]; then
|
---|
[460ea63] | 515 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
---|
[e35e794] | 516 | #
|
---|
[d0e48ec] | 517 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[e35e794] | 518 | #
|
---|
[47fddc8] | 519 | if [[ "$COMPARE" = "y" ]]; then
|
---|
[cc020f4] | 520 | mkdir -p $JHALFSDIR/extras
|
---|
[4612459] | 521 | cp extras/* $JHALFSDIR/extras
|
---|
[ed0a142] | 522 | fi
|
---|
[3a27393] | 523 | #
|
---|
[0170229] | 524 | if [[ -n "$FILES" ]]; then
|
---|
[3b63c8c] | 525 | # pushd/popd necessary to deal with multiple files
|
---|
[a110145] | 526 | pushd $PACKAGE_DIR 1> /dev/null
|
---|
| 527 | cp $FILES $JHALFSDIR/
|
---|
| 528 | popd 1> /dev/null
|
---|
[0170229] | 529 | fi
|
---|
[3a27393] | 530 | #
|
---|
[47fddc8] | 531 | if [[ "$REPORT" = "y" ]]; then
|
---|
[25b52e2] | 532 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[3b63c8c] | 533 | # After being sure that all looks sane, dump the settings to a file
|
---|
[25b52e2] | 534 | # This file will be used to create the REPORT header
|
---|
| 535 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
[708a612] | 536 | fi
|
---|
[3a27393] | 537 | #
|
---|
[47fddc8] | 538 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
[25b52e2] | 539 | #
|
---|
[3b63c8c] | 540 | cp $COMMON_DIR/packages.xsl $JHALFSDIR/
|
---|
| 541 | #
|
---|
[12a5707] | 542 | sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
---|
[0170229] | 543 | export XSL=$JHALFSDIR/${XSL}
|
---|
| 544 | fi
|
---|
| 545 |
|
---|
| 546 | get_book
|
---|
[65d83a6] | 547 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 548 |
|
---|
[0170229] | 549 | build_Makefile
|
---|
[65d83a6] | 550 | echo "${SD_BORDER}${nl_}"
|
---|
[12a5707] | 551 |
|
---|
[386bc75] | 552 | run_make
|
---|