[4da2512] | 1 | #!/bin/bash
|
---|
| 2 | # $Id$
|
---|
| 3 | set -e
|
---|
[bbcdeab] | 4 | # Pass trap handlers to functions
|
---|
| 5 | set -E
|
---|
[4da2512] | 6 |
|
---|
| 7 | # VT100 colors
|
---|
| 8 | declare -r BLACK=$'\e[1;30m'
|
---|
| 9 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
| 10 |
|
---|
| 11 | declare -r RED=$'\e[31m'
|
---|
| 12 | declare -r GREEN=$'\e[32m'
|
---|
| 13 | declare -r YELLOW=$'\e[33m'
|
---|
| 14 | declare -r BLUE=$'\e[34m'
|
---|
| 15 | declare -r MAGENTA=$'\e[35m'
|
---|
| 16 | declare -r CYAN=$'\e[36m'
|
---|
| 17 | declare -r WHITE=$'\e[37m'
|
---|
| 18 |
|
---|
| 19 | declare -r OFF=$'\e[0m'
|
---|
| 20 | declare -r BOLD=$'\e[1m'
|
---|
| 21 | declare -r REVERSE=$'\e[7m'
|
---|
| 22 | declare -r HIDDEN=$'\e[8m'
|
---|
| 23 |
|
---|
| 24 | declare -r tab_=$'\t'
|
---|
| 25 | declare -r nl_=$'\n'
|
---|
| 26 |
|
---|
| 27 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
| 28 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
| 29 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
| 30 |
|
---|
| 31 | # bold yellow > < pair
|
---|
| 32 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
| 33 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
---|
| 37 | #-----------------------#
|
---|
| 38 | simple_error() { # Basic error trap.... JUST DIE
|
---|
| 39 | #-----------------------#
|
---|
| 40 | # If +e then disable text output
|
---|
[a96109a] | 41 | if [[ "$-" =~ e ]]; then
|
---|
[bbcdeab] | 42 | LASTLINE="$1"
|
---|
| 43 | LASTERR="$2"
|
---|
| 44 | LASTFUNC="$3"
|
---|
| 45 | LASTSOURCE="$4"
|
---|
| 46 | # echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
| 47 | echo -e "\n${RED}ERROR:${GREEN} Error $LASTERR at $LASTSOURCE line ${LASTLINE}!${OFF}\n" >&2
|
---|
[4da2512] | 48 | fi
|
---|
[bbcdeab] | 49 | exit $LASTERR
|
---|
[4da2512] | 50 | }
|
---|
| 51 |
|
---|
| 52 | see_ya() {
|
---|
[401aac8] | 53 | echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
|
---|
[4da2512] | 54 | }
|
---|
| 55 | ##### Simple error TRAPS
|
---|
| 56 | # ctrl-c SIGINT
|
---|
| 57 | # ctrl-y
|
---|
| 58 | # ctrl-z SIGTSTP
|
---|
| 59 | # SIGHUP 1 HANGUP
|
---|
| 60 | # SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
---|
| 61 | # SIGQUIT 3
|
---|
| 62 | # SIGKILL 9 KILL
|
---|
| 63 | # SIGTERM 15 TERMINATION
|
---|
| 64 | # SIGSTOP 17,18,23 STOP THE PROCESS
|
---|
| 65 | #####
|
---|
| 66 | set -e
|
---|
| 67 | trap see_ya 0
|
---|
[bbcdeab] | 68 | trap 'simple_error "${LINENO}" "$?" "${FUNCNAME}" "${BASH_SOURCE}"' ERR
|
---|
[4da2512] | 69 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
| 70 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
| 71 |
|
---|
| 72 | version="
|
---|
[401aac8] | 73 | ${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
|
---|
[4da2512] | 74 | \$Date$
|
---|
| 75 |
|
---|
| 76 | Written by George Boudreau and Manuel Canales Esparcia,
|
---|
| 77 | plus several contributions.
|
---|
| 78 |
|
---|
| 79 | Based on an idea from Jeremy Huntwork
|
---|
| 80 |
|
---|
| 81 | This set of files are published under the
|
---|
| 82 | ${BOLD}Gnu General Public License, Version 2.${OFF}
|
---|
| 83 | "
|
---|
| 84 |
|
---|
| 85 | case $1 in
|
---|
| 86 | -v ) echo "$version" && exit 1 ;;
|
---|
| 87 | run ) : ;;
|
---|
| 88 | * )
|
---|
| 89 | echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
---|
| 90 | exit 1
|
---|
| 91 | ;;
|
---|
| 92 | esac
|
---|
| 93 |
|
---|
[65c998b] | 94 | # If the user has not saved his configuration file, let's ask
|
---|
| 95 | # if he or she really wants to run this stuff
|
---|
| 96 | if [ $(ls -l --time-style='+%Y%m%d%H%M%S' configuration.old | cut -d' ' -f 6) \
|
---|
| 97 | -ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ]
|
---|
| 98 | then echo -n "Do you want to run jhalfs? yes/no (yes): "
|
---|
| 99 | read ANSWER
|
---|
| 100 | if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
|
---|
| 101 | echo "${nl_}Exiting gracefully.${nl_}"
|
---|
| 102 | exit
|
---|
| 103 | fi
|
---|
| 104 | fi
|
---|
| 105 |
|
---|
| 106 | # Change this to 0 to suppress almost all messages
|
---|
[4da2512] | 107 | VERBOSITY=1
|
---|
| 108 |
|
---|
| 109 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
| 110 | source configuration
|
---|
[7072e1f] | 111 | [[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
---|
[4da2512] | 112 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 113 |
|
---|
| 114 | # These are boolean vars generated from Config.in.
|
---|
[7072e1f] | 115 | # ISSUE: If a boolean parameter is not set to y(es) there
|
---|
| 116 | # is no variable defined by the menu app. This can
|
---|
| 117 | # cause a headache if you are not aware.
|
---|
| 118 | # The following variables MUST exist. If they don't, the
|
---|
| 119 | # default value is n(o).
|
---|
[4da2512] | 120 | RUNMAKE=${RUNMAKE:-n}
|
---|
| 121 | GETPKG=${GETPKG:-n}
|
---|
| 122 | COMPARE=${COMPARE:-n}
|
---|
| 123 | RUN_FARCE=${RUN_FARCE:-n}
|
---|
| 124 | RUN_ICA=${RUN_ICA:-n}
|
---|
[7072e1f] | 125 | PKGMNGT=${PKGMNGT:-n}
|
---|
[4da2512] | 126 | BOMB_TEST=${BOMB_TEST:-n}
|
---|
| 127 | STRIP=${STRIP:=n}
|
---|
| 128 | REPORT=${REPORT:=n}
|
---|
| 129 | VIMLANG=${VIMLANG:-n}
|
---|
[b339c94] | 130 | FULL_LOCALE=${FULL_LOCALE:-n}
|
---|
[4da2512] | 131 | GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
---|
[9a536f7] | 132 | CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
---|
[a16f769] | 133 | REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
---|
[93346ee] | 134 | INSTALL_LOG=${INSTALL_LOG:-n}
|
---|
[486e9a7] | 135 | CLEAN=${CLEAN:=n}
|
---|
[d035526] | 136 | SET_SSP=${SET_SSP:=n}
|
---|
| 137 | SET_ASLR=${SET_ASLR:=n}
|
---|
| 138 | SET_PAX=${SET_PAX:=n}
|
---|
| 139 | SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
|
---|
| 140 | SET_WARNINGS=${SET_WARNINGS:=n}
|
---|
| 141 | SET_MISC=${SET_MISC:=n}
|
---|
| 142 | SET_BLOWFISH=${SET_BLOWFISH:=n}
|
---|
[4da2512] | 143 |
|
---|
[75d6d1c] | 144 | if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
---|
| 145 | NO_PROGRESS="#"
|
---|
| 146 | fi
|
---|
| 147 |
|
---|
| 148 |
|
---|
[38ae01f] | 149 | # Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
---|
| 150 | CWD=$(cd `dirname $0` && pwd)
|
---|
| 151 | if [[ $JHALFSDIR == $CWD ]]; then
|
---|
| 152 | echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
---|
| 153 | echo " Please move the source directory or change the build directory."
|
---|
| 154 | exit 2
|
---|
| 155 | fi
|
---|
| 156 |
|
---|
[0873ccc] | 157 | # Book sources envars
|
---|
[4965fa8] | 158 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
| 159 |
|
---|
| 160 | case $BRANCH_ID in
|
---|
| 161 | development )
|
---|
| 162 | case $PROGNAME in
|
---|
[92b7cb8] | 163 | clfs* ) TREE="" ;;
|
---|
[4965fa8] | 164 | *) TREE=trunk/BOOK ;;
|
---|
| 165 | esac
|
---|
| 166 | LFSVRS=development
|
---|
| 167 | ;;
|
---|
| 168 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
| 169 | echo " Please rerun make and fix the configuration."
|
---|
| 170 | exit 2 ;;
|
---|
| 171 | branch-* )
|
---|
| 172 | LFSVRS=${BRANCH_ID}
|
---|
| 173 | TREE=branches/${BRANCH_ID#branch-}/BOOK
|
---|
| 174 | ;;
|
---|
| 175 | * )
|
---|
| 176 | case $PROGNAME in
|
---|
[e650dc7] | 177 | lfs )
|
---|
| 178 | LFSVRS=${BRANCH_ID}
|
---|
| 179 | TREE=tags/${BRANCH_ID}
|
---|
| 180 | if (( ${BRANCH_ID:0:1} < 7 )) ; then
|
---|
| 181 | TREE=${TREE}/BOOK
|
---|
| 182 | fi
|
---|
| 183 | ;;
|
---|
| 184 | hlfs )
|
---|
[4965fa8] | 185 | LFSVRS=${BRANCH_ID}
|
---|
| 186 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
| 187 | ;;
|
---|
[92b7cb8] | 188 | clfs* )
|
---|
[4965fa8] | 189 | LFSVRS=${BRANCH_ID}
|
---|
[34d1b6a] | 190 | TREE=clfs-${BRANCH_ID}
|
---|
[4965fa8] | 191 | ;;
|
---|
[92b7cb8] | 192 | * )
|
---|
[4965fa8] | 193 | esac
|
---|
| 194 | ;;
|
---|
| 195 | esac
|
---|
| 196 |
|
---|
[4da2512] | 197 | # Set the document location...
|
---|
[1cf621b] | 198 | BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS}
|
---|
[4da2512] | 199 |
|
---|
[4965fa8] | 200 |
|
---|
[728955b] | 201 | #--- Envars not sourced from configuration
|
---|
| 202 | case $PROGNAME in
|
---|
[92b7cb8] | 203 | clfs ) declare -r GIT="git://git.cross-lfs.org/cross-lfs" ;;
|
---|
| 204 | clfs2 ) declare -r GIT="git://git.cross-lfs.org/clfs-sysroot" ;;
|
---|
| 205 | clfs3 ) declare -r GIT="git://git.cross-lfs.org/clfs-embedded" ;;
|
---|
| 206 | *) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
---|
[728955b] | 207 | esac
|
---|
| 208 | declare -r LOG=000-masterscript.log
|
---|
[7072e1f] | 209 | # Needed for fetching BLFS book sources when building CLFS
|
---|
[728955b] | 210 | declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
---|
| 211 |
|
---|
[4da2512] | 212 | # Set true internal variables
|
---|
| 213 | COMMON_DIR="common"
|
---|
[52b0d10] | 214 | PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
---|
[4da2512] | 215 | MODULE=$PACKAGE_DIR/master.sh
|
---|
[7072e1f] | 216 | PKGMNGTDIR="pkgmngt"
|
---|
| 217 | # The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
---|
[4da2512] | 218 |
|
---|
| 219 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
| 220 | source $COMMON_DIR/common-functions
|
---|
| 221 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
| 222 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 223 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
| 224 | source $MODULE
|
---|
| 225 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
| 226 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 227 | #
|
---|
| 228 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 229 |
|
---|
| 230 |
|
---|
| 231 | #*******************************************************************#
|
---|
| 232 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[d517356] | 233 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
[4da2512] | 234 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 235 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 236 |
|
---|
| 237 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[d517356] | 238 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
[4da2512] | 239 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 240 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[9a536f7] | 241 |
|
---|
[fe30c61] | 242 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
---|
| 243 | source $COMMON_DIR/libs/func_custom_pkgs
|
---|
[9a536f7] | 244 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 245 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 246 |
|
---|
| 247 |
|
---|
[6ed3dd7] | 248 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 249 |
|
---|
| 250 | [[ $VERBOSITY > 0 ]] && echo Checking tools required for jhalfs
|
---|
| 251 | check_alfs_tools
|
---|
| 252 |
|
---|
[4da2512] | 253 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 254 |
|
---|
[e576789] | 255 | # blfs-tool envars
|
---|
| 256 | BLFS_TOOL=${BLFS_TOOL:-n}
|
---|
| 257 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
[6ed3dd7] | 258 | [[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS
|
---|
| 259 | check_blfs_tools
|
---|
| 260 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
[854854e] | 261 | BLFS_SVN=${BLFS_SVN:-n}
|
---|
| 262 | BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
---|
| 263 | BLFS_BRANCH=${BLFS_BRANCH:-n}
|
---|
| 264 | if [[ "${BLFS_SVN}" = "y" ]]; then
|
---|
| 265 | BLFS_BRANCH_ID=development
|
---|
| 266 | BLFS_TREE=trunk/BOOK
|
---|
| 267 | elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
|
---|
| 268 | [[ -d "$BLFS_WC_LOCATION" ]] &&
|
---|
| 269 | [[ -d "$BLFS_WC_LOCATION/postlfs" ]] || {
|
---|
| 270 | echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
|
---|
| 271 | echo " Please rerun make and fix the configuration."
|
---|
| 272 | exit 2
|
---|
| 273 | }
|
---|
| 274 | BLFS_TREE=$(cd $BLFS_WC_LOCATION; svn info | grep URL | sed 's@.*BLFS/@@')
|
---|
| 275 | BLFS_BRANCH_ID=$(echo $BLFS_TREE | sed -e 's@trunk/BOOK@development@' \
|
---|
| 276 | -e 's@branches/@branch-@' \
|
---|
| 277 | -e 's@tags/@@' \
|
---|
| 278 | -e 's@/BOOK@@')
|
---|
[0ba80be] | 279 | elif [[ "${BLFS_BRANCH}" = "y" ]] ; then
|
---|
[854854e] | 280 | case $BLFS_BRANCH_ID in
|
---|
| 281 | *EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
---|
| 282 | echo " Please rerun make and fix the configuration."
|
---|
| 283 | exit 2 ;;
|
---|
| 284 | branch-systemd ) BLFS_TREE=branches/systemd ;;
|
---|
| 285 | branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
|
---|
| 286 | 6.2* | 7.4* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
---|
| 287 | * ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
|
---|
| 288 | esac
|
---|
| 289 | fi
|
---|
[e576789] | 290 | [[ $VERBOSITY > 0 ]] && echo -n "Loading blfs tools installation function..."
|
---|
| 291 | source $COMMON_DIR/libs/func_install_blfs
|
---|
| 292 | [[ $? > 0 ]] && echo "function module did not load.." && exit 1
|
---|
| 293 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 294 | fi
|
---|
[4da2512] | 295 |
|
---|
| 296 | ###################################
|
---|
| 297 | ### MAIN ###
|
---|
| 298 | ###################################
|
---|
| 299 |
|
---|
| 300 |
|
---|
| 301 | validate_config
|
---|
| 302 | echo "${SD_BORDER}${nl_}"
|
---|
| 303 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
| 304 | read ANSWER
|
---|
| 305 | if [ x$ANSWER != "xyes" ] ; then
|
---|
[881c96f] | 306 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
[d023a35] | 307 | exit
|
---|
[4da2512] | 308 | fi
|
---|
| 309 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
| 310 |
|
---|
| 311 | # Load additional modules or configuration files based on global settings
|
---|
| 312 | # compare module
|
---|
| 313 | if [[ "$COMPARE" = "y" ]]; then
|
---|
| 314 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
[d517356] | 315 | source $COMMON_DIR/libs/func_compare.sh
|
---|
| 316 | [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
---|
[4da2512] | 317 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 318 | fi
|
---|
| 319 | #
|
---|
| 320 | # optimize module
|
---|
| 321 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
| 322 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
| 323 | source optimize/optimize_functions
|
---|
| 324 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
| 325 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 326 | #
|
---|
| 327 | # optimize configurations
|
---|
| 328 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
| 329 | source optimize/opt_config
|
---|
| 330 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
| 331 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
[854854e] | 332 | # The number of parallel jobs is taken from configuration now
|
---|
| 333 | MAKEFLAGS="-j${N_PARALLEL}"
|
---|
[4da2512] | 334 | # Validate optimize settings, if required
|
---|
| 335 | validate_opt_settings
|
---|
| 336 | fi
|
---|
| 337 | #
|
---|
| 338 |
|
---|
[a16f769] | 339 | if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
---|
[4da2512] | 340 |
|
---|
[7b6ecc5] | 341 | # If requested, clean the build directory
|
---|
| 342 | clean_builddir
|
---|
[4da2512] | 343 |
|
---|
[7b6ecc5] | 344 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
| 345 | mkdir -p $JHALFSDIR
|
---|
| 346 | fi
|
---|
[3e7ceed] | 347 |
|
---|
[7b6ecc5] | 348 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
| 349 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
| 350 | mkdir -p $BUILDDIR/sources
|
---|
| 351 | fi
|
---|
| 352 | #
|
---|
| 353 | # Create the log directory
|
---|
| 354 | if [[ ! -d $LOGDIR ]]; then
|
---|
| 355 | mkdir $LOGDIR
|
---|
| 356 | fi
|
---|
| 357 | >$LOGDIR/$LOG
|
---|
| 358 | #
|
---|
[3e7ceed] | 359 | # Copy common helper files
|
---|
[d68eb1b] | 360 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
---|
| 361 | # Copy needed stylesheets
|
---|
| 362 | cp $COMMON_DIR/{packages.xsl,chroot.xsl} $JHALFSDIR/
|
---|
[7b6ecc5] | 363 | #
|
---|
[3e7ceed] | 364 | # Fix the XSL book parser
|
---|
[92b7cb8] | 365 | case $PROGNAME in
|
---|
| 366 | clfs* ) sed 's,FAKEDIR,'${BOOK}/BOOK',' ${PACKAGE_DIR}/${XSL} > $JHALFSDIR/${XSL} ;;
|
---|
| 367 | lfs | hlfs ) sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} ;;
|
---|
| 368 | * ) ;;
|
---|
| 369 | esac
|
---|
[3e7ceed] | 370 | export XSL=$JHALFSDIR/${XSL}
|
---|
[7b6ecc5] | 371 | #
|
---|
| 372 |
|
---|
[7072e1f] | 373 | # Copy packageManager.xml, if needed
|
---|
| 374 | [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
---|
| 375 | cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
---|
| 376 | cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
---|
| 377 | #
|
---|
[3e7ceed] | 378 | # Copy urls.xsl, if needed
|
---|
| 379 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
[7b6ecc5] | 380 | #
|
---|
[3e7ceed] | 381 | # Create the test-log directory, if needed
|
---|
| 382 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
| 383 | #
|
---|
[93346ee] | 384 | # Create the installed-files directory, if needed
|
---|
| 385 | [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
---|
| 386 | #
|
---|
[3e7ceed] | 387 | # Prepare report creation, if needed
|
---|
[7b6ecc5] | 388 | if [[ "$REPORT" = "y" ]]; then
|
---|
| 389 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
[7072e1f] | 390 | # After making sure that all looks sane, dump the settings to a file
|
---|
[7b6ecc5] | 391 | # This file will be used to create the REPORT header
|
---|
| 392 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
| 393 | fi
|
---|
| 394 | #
|
---|
[3e7ceed] | 395 | # Copy optimize files, if needed
|
---|
| 396 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
[7b6ecc5] | 397 | #
|
---|
[3e7ceed] | 398 | # Copy compare files, if needed
|
---|
| 399 | if [[ "$COMPARE" = "y" ]]; then
|
---|
| 400 | mkdir -p $JHALFSDIR/extras
|
---|
| 401 | cp extras/* $JHALFSDIR/extras
|
---|
| 402 | fi
|
---|
[7b6ecc5] | 403 | #
|
---|
[3e7ceed] | 404 | # Copy custom tools config files, if requested
|
---|
| 405 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
| 406 | echo "Copying custom tool scripts to $JHALFSDIR"
|
---|
| 407 | mkdir -p $JHALFSDIR/custom-commands
|
---|
| 408 | cp -f custom/config/* $JHALFSDIR/custom-commands
|
---|
| 409 | fi
|
---|
| 410 | #
|
---|
[7b6ecc5] | 411 | # Install blfs-tool, if requested.
|
---|
| 412 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
[6ed3dd7] | 413 | echo Installing BLFS book and tools
|
---|
[e576789] | 414 | install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
---|
[bbcdeab] | 415 | [[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
---|
[7b6ecc5] | 416 | fi
|
---|
[3e7ceed] | 417 | #
|
---|
[7b6ecc5] | 418 |
|
---|
[1cf621b] | 419 | # Download or updates the book source
|
---|
[7b6ecc5] | 420 | get_book
|
---|
[1cf621b] | 421 | extract_commands
|
---|
[4965fa8] | 422 | echo "${SD_BORDER}${nl_}"
|
---|
[7b6ecc5] | 423 |
|
---|
[4965fa8] | 424 | fi
|
---|
| 425 |
|
---|
[e576789] | 426 | # When regenerating the Makefile, we need to know also the
|
---|
| 427 | # canonical book version
|
---|
[a16f769] | 428 | if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
---|
| 429 | case $PROGNAME in
|
---|
[92b7cb8] | 430 | clfs* )
|
---|
[a16f769] | 431 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 432 | *)
|
---|
| 433 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 434 | esac
|
---|
| 435 | fi
|
---|
| 436 |
|
---|
[4da2512] | 437 | build_Makefile
|
---|
[3e7ceed] | 438 |
|
---|
[4da2512] | 439 | echo "${SD_BORDER}${nl_}"
|
---|
| 440 |
|
---|
[1cf621b] | 441 | # Check for build prerequisites.
|
---|
| 442 | echo
|
---|
| 443 | cd $CWD
|
---|
| 444 | check_prerequisites
|
---|
| 445 | echo "${SD_BORDER}${nl_}"
|
---|
| 446 | # All is well, run the build (if requested)
|
---|
[4da2512] | 447 | run_make
|
---|