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${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\"${OFF} builder tool (development) \$Rev$
|
---|
74 | \$Date$
|
---|
75 |
|
---|
76 | Written by George Boudreau, Manuel Canales Esparcia, Pierre Labastie,
|
---|
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 | See the ${BOLD}LICENCE${OFF} file in this directory.
|
---|
84 | "
|
---|
85 |
|
---|
86 | case $1 in
|
---|
87 | -v ) echo "$version" && exit ;;
|
---|
88 | run ) : ;;
|
---|
89 | * )
|
---|
90 | echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
---|
91 | exit 1
|
---|
92 | ;;
|
---|
93 | esac
|
---|
94 |
|
---|
95 | # If the user has not saved his configuration file, let's ask
|
---|
96 | # if he or she really wants to run this stuff
|
---|
97 | if [ $(ls -l --time-style='+%Y%m%d%H%M%S' configuration.old | cut -d' ' -f 6) \
|
---|
98 | -ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ]
|
---|
99 | then echo -n "Do you want to run jhalfs? yes/no (yes): "
|
---|
100 | read ANSWER
|
---|
101 | if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
|
---|
102 | echo "${nl_}Exiting gracefully.${nl_}"
|
---|
103 | exit
|
---|
104 | fi
|
---|
105 | fi
|
---|
106 |
|
---|
107 | # Change this to 0 to suppress almost all messages
|
---|
108 | VERBOSITY=1
|
---|
109 |
|
---|
110 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
111 | source configuration
|
---|
112 | [[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
---|
113 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
114 |
|
---|
115 | # These are boolean vars generated from Config.in.
|
---|
116 | # ISSUE: If a boolean parameter is not set to y(es) there
|
---|
117 | # is no variable defined by the menu app. This can
|
---|
118 | # cause a headache if you are not aware.
|
---|
119 | # The following variables MUST exist. If they don't, the
|
---|
120 | # default value is n(o).
|
---|
121 | RUNMAKE=${RUNMAKE:-n}
|
---|
122 | GETPKG=${GETPKG:-n}
|
---|
123 | COMPARE=${COMPARE:-n}
|
---|
124 | RUN_FARCE=${RUN_FARCE:-n}
|
---|
125 | RUN_ICA=${RUN_ICA:-n}
|
---|
126 | PKGMNGT=${PKGMNGT:-n}
|
---|
127 | WRAP_INSTALL=${WRAP_INSTALL:-n}
|
---|
128 | BOMB_TEST=${BOMB_TEST:-n}
|
---|
129 | STRIP=${STRIP:=n}
|
---|
130 | REPORT=${REPORT:=n}
|
---|
131 | VIMLANG=${VIMLANG:-n}
|
---|
132 | FULL_LOCALE=${FULL_LOCALE:-n}
|
---|
133 | GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
---|
134 | CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
---|
135 | REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
---|
136 | INSTALL_LOG=${INSTALL_LOG:-n}
|
---|
137 | CLEAN=${CLEAN:=n}
|
---|
138 | SET_SSP=${SET_SSP:=n}
|
---|
139 | SET_ASLR=${SET_ASLR:=n}
|
---|
140 | SET_PAX=${SET_PAX:=n}
|
---|
141 | SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
|
---|
142 | SET_WARNINGS=${SET_WARNINGS:=n}
|
---|
143 | SET_MISC=${SET_MISC:=n}
|
---|
144 | SET_BLOWFISH=${SET_BLOWFISH:=n}
|
---|
145 | UNICODE=${UNICODE:=n}
|
---|
146 |
|
---|
147 | if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
---|
148 | NO_PROGRESS="#"
|
---|
149 | fi
|
---|
150 |
|
---|
151 |
|
---|
152 | # Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
---|
153 | CWD=$(cd `dirname $0` && pwd)
|
---|
154 | if [[ $JHALFSDIR == $CWD ]]; then
|
---|
155 | echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
---|
156 | echo " Please move the source directory or change the build directory."
|
---|
157 | exit 2
|
---|
158 | fi
|
---|
159 |
|
---|
160 | # Book sources envars
|
---|
161 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
162 |
|
---|
163 | case $BRANCH_ID in
|
---|
164 | development )
|
---|
165 | case $PROGNAME in
|
---|
166 | clfs* ) TREE="" ;;
|
---|
167 | * ) TREE=trunk/BOOK ;;
|
---|
168 | esac
|
---|
169 | LFSVRS=development
|
---|
170 | ;;
|
---|
171 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
172 | echo " Please rerun make and fix the configuration."
|
---|
173 | exit 2 ;;
|
---|
174 | branch-* )
|
---|
175 | case $PROGNAME in
|
---|
176 | lfs )
|
---|
177 | LFSVRS=${BRANCH_ID}
|
---|
178 | TREE=branches/${BRANCH_ID#branch-}
|
---|
179 | if [ ${BRANCH_ID#branch-} = 6 ]; then
|
---|
180 | TREE=${TREE}/BOOK
|
---|
181 | fi
|
---|
182 | ;;
|
---|
183 | clfs* )
|
---|
184 | LFSVRS=${BRANCH_ID}
|
---|
185 | TREE=${BRANCH_ID#branch-}
|
---|
186 | ;;
|
---|
187 | esac
|
---|
188 | ;;
|
---|
189 | * )
|
---|
190 | case $PROGNAME in
|
---|
191 | lfs )
|
---|
192 | LFSVRS=${BRANCH_ID}
|
---|
193 | TREE=tags/${BRANCH_ID}
|
---|
194 | if (( ${BRANCH_ID:0:1} < 7 )) ; then
|
---|
195 | TREE=${TREE}/BOOK
|
---|
196 | fi
|
---|
197 | ;;
|
---|
198 | hlfs )
|
---|
199 | LFSVRS=${BRANCH_ID}
|
---|
200 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
201 | ;;
|
---|
202 | clfs* )
|
---|
203 | LFSVRS=${BRANCH_ID}
|
---|
204 | TREE=clfs-${BRANCH_ID}
|
---|
205 | ;;
|
---|
206 | * )
|
---|
207 | esac
|
---|
208 | ;;
|
---|
209 | esac
|
---|
210 |
|
---|
211 | # Set the document location...
|
---|
212 | BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS}
|
---|
213 |
|
---|
214 |
|
---|
215 | #--- Envars not sourced from configuration
|
---|
216 | case $PROGNAME in
|
---|
217 | clfs ) declare -r GIT="git://git.clfs.org/cross-lfs" ;;
|
---|
218 | clfs2 ) declare -r GIT="git://git.clfs.org/clfs-sysroot" ;;
|
---|
219 | clfs3 ) declare -r GIT="git://git.clfs.org/clfs-embedded" ;;
|
---|
220 | *) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
---|
221 | esac
|
---|
222 | declare -r LOG=000-masterscript.log
|
---|
223 | # Needed for fetching BLFS book sources when building CLFS
|
---|
224 | declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
---|
225 |
|
---|
226 | # Set true internal variables
|
---|
227 | COMMON_DIR="common"
|
---|
228 | PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
---|
229 | MODULE=$PACKAGE_DIR/master.sh
|
---|
230 | PKGMNGTDIR="pkgmngt"
|
---|
231 | # The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
---|
232 |
|
---|
233 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
234 | source $COMMON_DIR/common-functions
|
---|
235 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
236 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
237 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
238 | source $MODULE
|
---|
239 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
240 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
241 | #
|
---|
242 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
243 |
|
---|
244 |
|
---|
245 | #*******************************************************************#
|
---|
246 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
247 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
248 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
249 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
250 |
|
---|
251 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
252 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
253 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
254 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
255 |
|
---|
256 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
---|
257 | source $COMMON_DIR/libs/func_custom_pkgs
|
---|
258 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
259 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
260 |
|
---|
261 |
|
---|
262 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
263 |
|
---|
264 | [[ $VERBOSITY > 0 ]] && echo Checking tools required for jhalfs
|
---|
265 | check_alfs_tools
|
---|
266 |
|
---|
267 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
268 |
|
---|
269 | # blfs-tool envars
|
---|
270 | BLFS_TOOL=${BLFS_TOOL:-n}
|
---|
271 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
272 | [[ $VERBOSITY > 0 ]] && echo Checking supplementary tools for installing BLFS
|
---|
273 | check_blfs_tools
|
---|
274 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
275 | BLFS_SVN=${BLFS_SVN:-n}
|
---|
276 | BLFS_WORKING_COPY=${BLFS_WORKING_COPY:-n}
|
---|
277 | BLFS_BRANCH=${BLFS_BRANCH:-n}
|
---|
278 | if [[ "${BLFS_SVN}" = "y" ]]; then
|
---|
279 | BLFS_BRANCH_ID=development
|
---|
280 | BLFS_TREE=trunk/BOOK
|
---|
281 | elif [[ "${BLFS_WORKING_COPY}" = "y" ]]; then
|
---|
282 | [[ -d "$BLFS_WC_LOCATION" ]] &&
|
---|
283 | [[ -d "$BLFS_WC_LOCATION/postlfs" ]] || {
|
---|
284 | echo " BLFS tools: This is not a working copy: $BLFS_WC_LOCATION."
|
---|
285 | echo " Please rerun make and fix the configuration."
|
---|
286 | exit 2
|
---|
287 | }
|
---|
288 | BLFS_TREE=$(cd $BLFS_WC_LOCATION; svn info | grep '^URL' | sed 's@.*BLFS/@@')
|
---|
289 | BLFS_BRANCH_ID=$(echo $BLFS_TREE | sed -e 's@trunk/BOOK@development@' \
|
---|
290 | -e 's@branches/@branch-@' \
|
---|
291 | -e 's@tags/@@' \
|
---|
292 | -e 's@/BOOK@@')
|
---|
293 | elif [[ "${BLFS_BRANCH}" = "y" ]] ; then
|
---|
294 | case $BLFS_BRANCH_ID in
|
---|
295 | *EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
---|
296 | echo " Please rerun make and fix the configuration."
|
---|
297 | exit 2 ;;
|
---|
298 | branch-systemd ) BLFS_TREE=branches/systemd ;;
|
---|
299 | branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-}/BOOK ;;
|
---|
300 | 6.2* | 7.* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
---|
301 | * ) BLFS_TREE=tags/${BLFS_BRANCH_ID}/BOOK ;;
|
---|
302 | esac
|
---|
303 | fi
|
---|
304 | [[ $VERBOSITY > 0 ]] && echo -n "Loading blfs tools installation function..."
|
---|
305 | source $COMMON_DIR/libs/func_install_blfs
|
---|
306 | [[ $? > 0 ]] && echo "function module did not load.." && exit 1
|
---|
307 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
308 | fi
|
---|
309 |
|
---|
310 | ###################################
|
---|
311 | ### MAIN ###
|
---|
312 | ###################################
|
---|
313 |
|
---|
314 |
|
---|
315 | validate_config
|
---|
316 | echo "${SD_BORDER}${nl_}"
|
---|
317 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
318 | read ANSWER
|
---|
319 | if [ x$ANSWER != "xyes" ] ; then
|
---|
320 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
321 | exit
|
---|
322 | fi
|
---|
323 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
324 |
|
---|
325 | # Load additional modules or configuration files based on global settings
|
---|
326 | # compare module
|
---|
327 | if [[ "$COMPARE" = "y" ]]; then
|
---|
328 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
329 | source $COMMON_DIR/libs/func_compare.sh
|
---|
330 | [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
---|
331 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
332 | fi
|
---|
333 | #
|
---|
334 | # optimize module
|
---|
335 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
336 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
337 | source optimize/optimize_functions
|
---|
338 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
339 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
340 | #
|
---|
341 | # optimize configurations
|
---|
342 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
343 | source optimize/opt_config
|
---|
344 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
345 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
346 | # The number of parallel jobs is taken from configuration now
|
---|
347 | MAKEFLAGS="-j${N_PARALLEL}"
|
---|
348 | # Validate optimize settings, if required
|
---|
349 | validate_opt_settings
|
---|
350 | fi
|
---|
351 | #
|
---|
352 |
|
---|
353 | if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
---|
354 |
|
---|
355 | # If requested, clean the build directory
|
---|
356 | clean_builddir
|
---|
357 |
|
---|
358 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
359 | mkdir -p $JHALFSDIR
|
---|
360 | fi
|
---|
361 |
|
---|
362 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
363 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
364 | mkdir -p $BUILDDIR/sources
|
---|
365 | fi
|
---|
366 | #
|
---|
367 | # Create the log directory
|
---|
368 | if [[ ! -d $LOGDIR ]]; then
|
---|
369 | mkdir $LOGDIR
|
---|
370 | fi
|
---|
371 | >$LOGDIR/$LOG
|
---|
372 | #
|
---|
373 | # Copy common helper files
|
---|
374 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
|
---|
375 | # Copy needed stylesheets
|
---|
376 | cp $COMMON_DIR/{packages.xsl,chroot.xsl} $JHALFSDIR/
|
---|
377 | #
|
---|
378 | # Fix the XSL book parser
|
---|
379 | case $PROGNAME in
|
---|
380 | clfs* ) sed 's,FAKEDIR,'${BOOK}/BOOK',' ${PACKAGE_DIR}/${XSL} > $JHALFSDIR/${XSL} ;;
|
---|
381 | lfs | hlfs ) sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} ;;
|
---|
382 | * ) ;;
|
---|
383 | esac
|
---|
384 | export XSL=$JHALFSDIR/${XSL}
|
---|
385 | #
|
---|
386 |
|
---|
387 | # Copy packageManager.xml, if needed
|
---|
388 | [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] && {
|
---|
389 | cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/
|
---|
390 | cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
---|
391 | }
|
---|
392 | #
|
---|
393 | # Copy urls.xsl, if needed
|
---|
394 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
395 | #
|
---|
396 | # Create the test-log directory, if needed
|
---|
397 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
398 | #
|
---|
399 | # Create the installed-files directory, if needed
|
---|
400 | [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
---|
401 | #
|
---|
402 | # Prepare report creation, if needed
|
---|
403 | if [[ "$REPORT" = "y" ]]; then
|
---|
404 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
405 | # After making sure that all looks sane, dump the settings to a file
|
---|
406 | # This file will be used to create the REPORT header
|
---|
407 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
408 | fi
|
---|
409 | #
|
---|
410 | # Copy optimize files, if needed
|
---|
411 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
412 | #
|
---|
413 | # Copy compare files, if needed
|
---|
414 | if [[ "$COMPARE" = "y" ]]; then
|
---|
415 | mkdir -p $JHALFSDIR/extras
|
---|
416 | cp extras/* $JHALFSDIR/extras
|
---|
417 | fi
|
---|
418 | #
|
---|
419 | # Copy custom tools config files, if requested
|
---|
420 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
421 | echo "Copying custom tool scripts to $JHALFSDIR"
|
---|
422 | mkdir -p $JHALFSDIR/custom-commands
|
---|
423 | cp -f custom/config/* $JHALFSDIR/custom-commands
|
---|
424 | fi
|
---|
425 | #
|
---|
426 | # Install blfs-tool, if requested.
|
---|
427 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
428 | echo Installing BLFS book and tools
|
---|
429 | install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
---|
430 | [[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
---|
431 | fi
|
---|
432 | #
|
---|
433 |
|
---|
434 | # Download or updates the book source
|
---|
435 | get_book
|
---|
436 | extract_commands
|
---|
437 | echo "${SD_BORDER}${nl_}"
|
---|
438 |
|
---|
439 | fi
|
---|
440 |
|
---|
441 | # When regenerating the Makefile, we need to know also the
|
---|
442 | # canonical book version
|
---|
443 | if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
---|
444 | case $PROGNAME in
|
---|
445 | clfs* )
|
---|
446 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
447 | lfs)
|
---|
448 | if [[ "$INITSYS" = "sysv" ]] ; then
|
---|
449 | VERSION=$(grep 'ENTITY version ' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2)
|
---|
450 | else
|
---|
451 | VERSION=$(grep 'ENTITY versiond' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2)
|
---|
452 | fi
|
---|
453 | ;;
|
---|
454 | *)
|
---|
455 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
456 | esac
|
---|
457 | fi
|
---|
458 |
|
---|
459 | build_Makefile
|
---|
460 |
|
---|
461 | echo "${SD_BORDER}${nl_}"
|
---|
462 |
|
---|
463 | # Check for build prerequisites.
|
---|
464 | echo
|
---|
465 | cd $CWD
|
---|
466 | check_prerequisites
|
---|
467 | echo "${SD_BORDER}${nl_}"
|
---|
468 | # All is well, run the build (if requested)
|
---|
469 | run_make
|
---|