1 | #!/bin/bash
|
---|
2 | # $Id$
|
---|
3 | set -e
|
---|
4 | # Pass trap handlers to functions
|
---|
5 | set -E
|
---|
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
|
---|
41 | if [[ "$-" =~ e ]]; then
|
---|
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
|
---|
48 | fi
|
---|
49 | exit $LASTERR
|
---|
50 | }
|
---|
51 |
|
---|
52 | see_ya() {
|
---|
53 | echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
|
---|
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
|
---|
68 | trap 'simple_error "${LINENO}" "$?" "${FUNCNAME}" "${BASH_SOURCE}"' ERR
|
---|
69 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
70 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
71 |
|
---|
72 | version="
|
---|
73 | ${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
|
---|
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 |
|
---|
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
|
---|
107 | VERBOSITY=1
|
---|
108 |
|
---|
109 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
110 | source configuration
|
---|
111 | [[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
---|
112 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
113 |
|
---|
114 | # These are boolean vars generated from Config.in.
|
---|
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).
|
---|
120 | RUNMAKE=${RUNMAKE:-n}
|
---|
121 | GETPKG=${GETPKG:-n}
|
---|
122 | COMPARE=${COMPARE:-n}
|
---|
123 | RUN_FARCE=${RUN_FARCE:-n}
|
---|
124 | RUN_ICA=${RUN_ICA:-n}
|
---|
125 | PKGMNGT=${PKGMNGT:-n}
|
---|
126 | BOMB_TEST=${BOMB_TEST:-n}
|
---|
127 | STRIP=${STRIP:=n}
|
---|
128 | REPORT=${REPORT:=n}
|
---|
129 | VIMLANG=${VIMLANG:-n}
|
---|
130 | FULL_LOCALE=${FULL_LOCALE:-n}
|
---|
131 | GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
---|
132 | CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
---|
133 | REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
---|
134 | INSTALL_LOG=${INSTALL_LOG:-n}
|
---|
135 | CLEAN=${CLEAN:=n}
|
---|
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}
|
---|
143 |
|
---|
144 | if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
---|
145 | NO_PROGRESS="#"
|
---|
146 | fi
|
---|
147 |
|
---|
148 |
|
---|
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 |
|
---|
157 | # Book sources envars
|
---|
158 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
159 |
|
---|
160 | case $BRANCH_ID in
|
---|
161 | development )
|
---|
162 | case $PROGNAME in
|
---|
163 | clfs* ) TREE="" ;;
|
---|
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 | case $PROGNAME in
|
---|
173 | lfs )
|
---|
174 | LFSVRS=${BRANCH_ID}
|
---|
175 | TREE=branches/${BRANCH_ID#branch-}
|
---|
176 | if [ ${BRANCH_ID#branch-} = 6 ]; then
|
---|
177 | TREE=${TREE}/BOOK
|
---|
178 | fi
|
---|
179 | ;;
|
---|
180 | clfs* )
|
---|
181 | LFSVRS=${BRANCH_ID}
|
---|
182 | TREE=${BRANCH_ID#branch-}
|
---|
183 | ;;
|
---|
184 | esac
|
---|
185 | ;;
|
---|
186 | * )
|
---|
187 | case $PROGNAME in
|
---|
188 | lfs )
|
---|
189 | LFSVRS=${BRANCH_ID}
|
---|
190 | TREE=tags/${BRANCH_ID}
|
---|
191 | if (( ${BRANCH_ID:0:1} < 7 )) ; then
|
---|
192 | TREE=${TREE}/BOOK
|
---|
193 | fi
|
---|
194 | ;;
|
---|
195 | hlfs )
|
---|
196 | LFSVRS=${BRANCH_ID}
|
---|
197 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
198 | ;;
|
---|
199 | clfs* )
|
---|
200 | LFSVRS=${BRANCH_ID}
|
---|
201 | TREE=clfs-${BRANCH_ID}
|
---|
202 | ;;
|
---|
203 | * )
|
---|
204 | esac
|
---|
205 | ;;
|
---|
206 | esac
|
---|
207 |
|
---|
208 | # Set the document location...
|
---|
209 | BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS}
|
---|
210 |
|
---|
211 |
|
---|
212 | #--- Envars not sourced from configuration
|
---|
213 | case $PROGNAME in
|
---|
214 | clfs ) declare -r GIT="git://git.clfs.org/cross-lfs" ;;
|
---|
215 | clfs2 ) declare -r GIT="git://git.clfs.org/clfs-sysroot" ;;
|
---|
216 | clfs3 ) declare -r GIT="git://git.clfs.org/clfs-embedded" ;;
|
---|
217 | *) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
---|
218 | esac
|
---|
219 | declare -r LOG=000-masterscript.log
|
---|
220 | # Needed for fetching BLFS book sources when building CLFS
|
---|
221 | declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
---|
222 |
|
---|
223 | # Set true internal variables
|
---|
224 | COMMON_DIR="common"
|
---|
225 | PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
---|
226 | MODULE=$PACKAGE_DIR/master.sh
|
---|
227 | PKGMNGTDIR="pkgmngt"
|
---|
228 | # The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
---|
229 |
|
---|
230 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
231 | source $COMMON_DIR/common-functions
|
---|
232 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
233 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
234 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
235 | source $MODULE
|
---|
236 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
237 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
238 | #
|
---|
239 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
240 |
|
---|
241 |
|
---|
242 | #*******************************************************************#
|
---|
243 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
244 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
245 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
246 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
247 |
|
---|
248 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
249 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
250 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
251 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
252 |
|
---|
253 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
---|
254 | source $COMMON_DIR/libs/func_custom_pkgs
|
---|
255 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
256 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
257 |
|
---|
258 |
|
---|
259 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
260 |
|
---|
261 | [[ $VERBOSITY > 0 ]] && echo Checking tools required for jhalfs
|
---|
262 | check_alfs_tools
|
---|
263 |
|
---|
264 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
265 |
|
---|
266 | # blfs-tool envars
|
---|
267 | BLFS_TOOL=${BLFS_TOOL:-n}
|
---|
268 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
269 | [[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS
|
---|
270 | check_blfs_tools
|
---|
271 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
272 | BLFS_SVN=${BLFS_SVN:-n}
|
---|
273 | BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
---|
274 | BLFS_BRANCH=${BLFS_BRANCH:-n}
|
---|
275 | if [[ "${BLFS_SVN}" = "y" ]]; then
|
---|
276 | BLFS_BRANCH_ID=development
|
---|
277 | BLFS_TREE=trunk/BOOK
|
---|
278 | elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
|
---|
279 | [[ -d "$BLFS_WC_LOCATION" ]] &&
|
---|
280 | [[ -d "$BLFS_WC_LOCATION/postlfs" ]] || {
|
---|
281 | echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
|
---|
282 | echo " Please rerun make and fix the configuration."
|
---|
283 | exit 2
|
---|
284 | }
|
---|
285 | BLFS_TREE=$(cd $BLFS_WC_LOCATION; svn info | grep '^URL' | sed 's@.*BLFS/@@')
|
---|
286 | BLFS_BRANCH_ID=$(echo $BLFS_TREE | sed -e 's@trunk/BOOK@development@' \
|
---|
287 | -e 's@branches/@branch-@' \
|
---|
288 | -e 's@tags/@@' \
|
---|
289 | -e 's@/BOOK@@')
|
---|
290 | elif [[ "${BLFS_BRANCH}" = "y" ]] ; then
|
---|
291 | case $BLFS_BRANCH_ID in
|
---|
292 | *EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
---|
293 | echo " Please rerun make and fix the configuration."
|
---|
294 | exit 2 ;;
|
---|
295 | branch-systemd ) BLFS_TREE=branches/systemd ;;
|
---|
296 | branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
|
---|
297 | 6.2* | 7.* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
---|
298 | * ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
|
---|
299 | esac
|
---|
300 | fi
|
---|
301 | [[ $VERBOSITY > 0 ]] && echo -n "Loading blfs tools installation function..."
|
---|
302 | source $COMMON_DIR/libs/func_install_blfs
|
---|
303 | [[ $? > 0 ]] && echo "function module did not load.." && exit 1
|
---|
304 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
305 | fi
|
---|
306 |
|
---|
307 | ###################################
|
---|
308 | ### MAIN ###
|
---|
309 | ###################################
|
---|
310 |
|
---|
311 |
|
---|
312 | validate_config
|
---|
313 | echo "${SD_BORDER}${nl_}"
|
---|
314 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
315 | read ANSWER
|
---|
316 | if [ x$ANSWER != "xyes" ] ; then
|
---|
317 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
318 | exit
|
---|
319 | fi
|
---|
320 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
321 |
|
---|
322 | # Load additional modules or configuration files based on global settings
|
---|
323 | # compare module
|
---|
324 | if [[ "$COMPARE" = "y" ]]; then
|
---|
325 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
326 | source $COMMON_DIR/libs/func_compare.sh
|
---|
327 | [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
---|
328 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
329 | fi
|
---|
330 | #
|
---|
331 | # optimize module
|
---|
332 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
333 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
334 | source optimize/optimize_functions
|
---|
335 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
336 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
337 | #
|
---|
338 | # optimize configurations
|
---|
339 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
340 | source optimize/opt_config
|
---|
341 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
342 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
343 | # The number of parallel jobs is taken from configuration now
|
---|
344 | MAKEFLAGS="-j${N_PARALLEL}"
|
---|
345 | # Validate optimize settings, if required
|
---|
346 | validate_opt_settings
|
---|
347 | fi
|
---|
348 | #
|
---|
349 |
|
---|
350 | if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
---|
351 |
|
---|
352 | # If requested, clean the build directory
|
---|
353 | clean_builddir
|
---|
354 |
|
---|
355 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
356 | mkdir -p $JHALFSDIR
|
---|
357 | fi
|
---|
358 |
|
---|
359 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
360 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
361 | mkdir -p $BUILDDIR/sources
|
---|
362 | fi
|
---|
363 | #
|
---|
364 | # Create the log directory
|
---|
365 | if [[ ! -d $LOGDIR ]]; then
|
---|
366 | mkdir $LOGDIR
|
---|
367 | fi
|
---|
368 | >$LOGDIR/$LOG
|
---|
369 | #
|
---|
370 | # Copy common helper files
|
---|
371 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
---|
372 | # Copy needed stylesheets
|
---|
373 | cp $COMMON_DIR/{packages.xsl,chroot.xsl} $JHALFSDIR/
|
---|
374 | #
|
---|
375 | # Fix the XSL book parser
|
---|
376 | case $PROGNAME in
|
---|
377 | clfs* ) sed 's,FAKEDIR,'${BOOK}/BOOK',' ${PACKAGE_DIR}/${XSL} > $JHALFSDIR/${XSL} ;;
|
---|
378 | lfs | hlfs ) sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} ;;
|
---|
379 | * ) ;;
|
---|
380 | esac
|
---|
381 | export XSL=$JHALFSDIR/${XSL}
|
---|
382 | #
|
---|
383 |
|
---|
384 | # Copy packageManager.xml, if needed
|
---|
385 | [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
---|
386 | cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
---|
387 | cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
---|
388 | #
|
---|
389 | # Copy urls.xsl, if needed
|
---|
390 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
391 | #
|
---|
392 | # Create the test-log directory, if needed
|
---|
393 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
394 | #
|
---|
395 | # Create the installed-files directory, if needed
|
---|
396 | [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
---|
397 | #
|
---|
398 | # Prepare report creation, if needed
|
---|
399 | if [[ "$REPORT" = "y" ]]; then
|
---|
400 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
401 | # After making sure that all looks sane, dump the settings to a file
|
---|
402 | # This file will be used to create the REPORT header
|
---|
403 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
404 | fi
|
---|
405 | #
|
---|
406 | # Copy optimize files, if needed
|
---|
407 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
408 | #
|
---|
409 | # Copy compare files, if needed
|
---|
410 | if [[ "$COMPARE" = "y" ]]; then
|
---|
411 | mkdir -p $JHALFSDIR/extras
|
---|
412 | cp extras/* $JHALFSDIR/extras
|
---|
413 | fi
|
---|
414 | #
|
---|
415 | # Copy custom tools config files, if requested
|
---|
416 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
417 | echo "Copying custom tool scripts to $JHALFSDIR"
|
---|
418 | mkdir -p $JHALFSDIR/custom-commands
|
---|
419 | cp -f custom/config/* $JHALFSDIR/custom-commands
|
---|
420 | fi
|
---|
421 | #
|
---|
422 | # Install blfs-tool, if requested.
|
---|
423 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
424 | echo Installing BLFS book and tools
|
---|
425 | install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
---|
426 | [[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
---|
427 | fi
|
---|
428 | #
|
---|
429 |
|
---|
430 | # Download or updates the book source
|
---|
431 | get_book
|
---|
432 | extract_commands
|
---|
433 | echo "${SD_BORDER}${nl_}"
|
---|
434 |
|
---|
435 | fi
|
---|
436 |
|
---|
437 | # When regenerating the Makefile, we need to know also the
|
---|
438 | # canonical book version
|
---|
439 | if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
---|
440 | case $PROGNAME in
|
---|
441 | clfs* )
|
---|
442 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
443 | *)
|
---|
444 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
445 | esac
|
---|
446 | fi
|
---|
447 |
|
---|
448 | build_Makefile
|
---|
449 |
|
---|
450 | echo "${SD_BORDER}${nl_}"
|
---|
451 |
|
---|
452 | # Check for build prerequisites.
|
---|
453 | echo
|
---|
454 | cd $CWD
|
---|
455 | check_prerequisites
|
---|
456 | echo "${SD_BORDER}${nl_}"
|
---|
457 | # All is well, run the build (if requested)
|
---|
458 | run_make
|
---|