source: common/common-functions@ d66cbc2

experimental
Last change on this file since d66cbc2 was d66cbc2, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Removed unused function.

  • Property mode set to 100644
File size: 23.4 KB
Line 
1#!/bin/bash
2
3# $Id$
4
5set -e
6
7
8no_empty_builddir() {
9 'clear'
10cat <<- -EOF-
11${DD_BORDER}
12
13${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
14 Looks like the \$BUILDDIR directory contains subdirectories
15 from a previous HLFS build.
16
17 Please format the partition mounted on \$BUILDDIR or set
18 a different build directory before running jhalfs-X.
19${OFF}
20${DD_BORDER}
21-EOF-
22 exit
23}
24
25
26HEADER="# This file is automatically generated by jhalfs-X
27# DO NOT EDIT THIS FILE MANUALLY
28#
29# Generated on `date \"+%F %X %Z\"`"
30
31
32#------------------------------------------------------#
33# NEW Makefile scripting functions #
34#------------------------------------------------------#
35
36
37unset get_package_tarball_name
38#----------------------------------#
39get_package_tarball_name() { #
40#----------------------------------#
41 local script_name=$1
42
43 # The use of 'head' is necessary to limit the return value to the FIRST match..
44 # hopefully this will not cause problems.
45 #
46 case $script_name in
47 tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
48 linux-headers) echo $(grep "^linux-headers.*.bz2" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
49 *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
50 esac
51
52}
53
54
55unset wrt_RunaAsRoot
56#----------------------------------#
57wrt_RunAsRoot() { # Some scripts must be run as root..
58#----------------------------------#
59 local ENV_MOUNT
60 local this_script=$1
61 local file=$2
62
63 case ${PROGNAME} in
64 lfs ) MOUNT_ENV="LFS" ;;
65 blfs ) MOUNT_ENV="BLFS" ;;
66 clfs ) MOUNT_ENV="CLFS" ;;
67 clfs2 ) MOUNT_ENV="CLFS" ;;
68 hlfs ) MOUNT_ENV="HLFS" ;;
69 *) echo "undefined progname $PROGNAME"; exit 1
70 esac
71
72(
73cat << EOF
74 @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
75 \$(PRT_DU_CR) >>logs/\$@
76EOF
77) >> $MKFILE.tmp
78}
79
80
81#----------------------------------#
82wrt_report() { #
83#----------------------------------#
84(
85cat << EOF
86
87create-sbu_du-report: $PREV
88 @\$(call echo_message, Building)
89 @./create-sbu_du-report.sh logs $VERSION
90 @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report)
91 @touch \$@
92EOF
93) >> $MKFILE.tmp
94}
95
96
97#------------------------------------------------------#
98#------------------------------------------------------#
99
100#----------------------------------#
101ROOT_RunAsRoot() { #
102#----------------------------------#
103 local file=$1
104(
105cat << EOF
106 @( time { source envars && \$(CMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
107 \$(PRT_DU_CR) >>logs/$this_script
108EOF
109) >> $MKFILE.tmp
110}
111
112#----------------------------------#
113ROOT_Unpack() { # An alias, for clairity
114#----------------------------------#
115 local FILE=$1
116 local optSAVE_PREVIOUS=$2
117
118 if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
119(
120cat << EOF
121 @\$(call remove_existing_dirs,$FILE)
122EOF
123) >> $MKFILE.tmp
124 fi
125
126(
127cat << EOF
128 @\$(call unpack,$FILE)
129 @\$(call get_pkg_root_LUSER)
130EOF
131) >> $MKFILE.tmp
132}
133
134#------------------------------------------------------#
135#------------------------------------------------------#
136
137#----------------------------------#
138LUSER_wrt_target() { # Create target and initialize log file
139#----------------------------------#
140 local i=$1
141 local PREV=$2
142(
143cat << EOF
144
145$i: $PREV
146 @\$(call echo_message, Building)
147 @./progress_bar.sh \$@ \$\$PPID &
148 @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" >logs/\$@
149EOF
150) >> $MKFILE.tmp
151}
152
153
154#----------------------------------#
155LUSER_wrt_RunAsUser() { # Execute script inside time { }, footer to log file
156#----------------------------------#
157 local file=$1
158
159(
160cat << EOF
161 @( time { source ~/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\
162 \$(PRT_DU) >> logs/\$@
163EOF
164) >> $MKFILE.tmp
165}
166
167
168#----------------------------------#
169LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
170#----------------------------------#
171 local FILE=$1
172 local optSAVE_PREVIOUS=$2
173
174 if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
175(
176cat << EOF
177 @\$(call remove_existing_dirs,$FILE)
178EOF
179) >> $MKFILE.tmp
180 fi
181
182(
183cat << EOF
184 @\$(call unpack,$FILE)
185 @\$(call get_pkg_root_LUSER)
186EOF
187) >> $MKFILE.tmp
188
189}
190
191
192#----------------------------------#
193LUSER_wrt_CopyFstab() { #
194#----------------------------------#
195(
196cat << EOF
197 @( time { cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@
198EOF
199) >> $MKFILE.tmp
200}
201
202
203#----------------------------------#
204LUSER_wrt_test_log() { # Initialize testsuite log file
205#----------------------------------#
206 local TESTLOGFILE=$1
207(
208cat << EOF
209 @echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
210 echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE
211EOF
212) >> $MKFILE.tmp
213}
214
215
216#----------------------------------#
217LUSER_RemoveBuildDirs() { #
218#----------------------------------#
219 local name=$1
220(
221cat << EOF
222 @\$(call remove_build_dirs,$name)
223EOF
224) >> $MKFILE.tmp
225}
226
227#-----------------------------------------------------------------#
228#-----------------------------------------------------------------#
229
230#----------------------------------#
231CHROOT_wrt_target() { # Create target and initialize log file
232#----------------------------------#
233 local i=$1
234 local PREV=$2
235 case $i in
236 iteration* ) local LOGFILE="${this_script}.log" ;;
237 * ) local LOGFILE="${this_script}" ;;
238 esac
239(
240cat << EOF
241
242$i: $PREV
243 @\$(call echo_message, Building)
244 @./progress_bar.sh \$@ \$\$PPID &
245 @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" >logs/$LOGFILE
246EOF
247) >> $MKFILE.tmp
248}
249
250
251#----------------------------------#
252CHROOT_Unpack() { #
253#----------------------------------#
254 local FILE=$1
255 local optSAVE_PREVIOUS=$2
256
257 if [ "${optSAVE_PREVIOUS}" != "1" ]; then
258(
259cat << EOF
260 @\$(call remove_existing_dirs2,$FILE)
261EOF
262) >> $MKFILE.tmp
263 fi
264(
265cat << EOF
266 @\$(call unpack3,$FILE)
267 @\$(call get_pkg_root2)
268EOF
269) >> $MKFILE.tmp
270}
271
272
273#----------------------------------#
274CHROOT_wrt_test_log() { #
275#----------------------------------#
276 local TESTLOGFILE=$1
277(
278cat << EOF
279 @echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\
280 echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE
281EOF
282) >> $MKFILE.tmp
283}
284
285
286#----------------------------------#
287CHROOT_wrt_RunAsRoot() { #
288#----------------------------------#
289 local file=$1
290(
291cat << EOF
292 @( time { source envars && \$(crCMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
293 \$(PRT_DU_CR) >>logs/$this_script
294EOF
295) >> $MKFILE.tmp
296
297}
298
299
300#----------------------------------#
301CHROOT_wrt_CopyFstab() { #
302#----------------------------------#
303(
304cat << EOF
305 @( time { cp -v /sources/fstab /etc/fstab >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script}
306EOF
307) >> $MKFILE.tmp
308}
309
310
311#----------------------------------#
312CHROOT_wrt_RemoveBuildDirs() { #
313#----------------------------------#
314 local name=$1
315(
316cat << EOF
317 @\$(call remove_build_dirs2,$name)
318EOF
319) >> $MKFILE.tmp
320}
321
322
323unset wrt_touch
324#----------------------------------#
325wrt_touch() { #
326#----------------------------------#
327(
328cat << EOF
329 @\$(call housekeeping)
330EOF
331) >> $MKFILE.tmp
332}
333
334#------------------------------------------------------#
335# END Makefile scripting functions #
336#------------------------------------------------------#
337
338
339
340#----------------------------#
341run_make() { #
342#----------------------------#
343 # Test if make must be run.
344 if [ "$RUNMAKE" = "y" ] ; then
345 # Test to make sure we're running the build as root
346 if [ "$UID" != "0" ] ; then
347 echo "You must be logged in as root to successfully build the system."
348 exit 1
349 fi
350 # Build the system
351 if [ -e $MKFILE ] ; then
352 echo -ne "Building the system...\n"
353 cd $JHALFSDIR && make
354 echo -ne "done\n"
355 fi
356 fi
357}
358
359
360#----------------------------#
361clean_builddir() { #
362#----------------------------#
363 # Test if the clean must be done.
364 if [ "${CLEAN}" = "y" ]; then
365 # Test to make sure we're running the clean as root
366 if [ "$UID" != "0" ] ; then
367 echo "You must be logged in as root to clean the build directory."
368 exit 1
369 fi
370 # Test to make sure that the build directory was populated by jhalfs
371 if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
372 echo "Looks like $BUILDDIR was not populated by a previous jhalfs-X run."
373 exit 1
374 else
375 # Clean the build directory
376 echo -ne "Cleaning $BUILDDIR...\n"
377 rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
378 echo -ne "Cleaning $JHALFSDIR...\n"
379 rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,*logs,Makefile,*.xsl,makefile-functions,pkg_tarball_list,*.config,*.sh}
380 echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
381 rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
382 echo -ne "done\n"
383 fi
384 fi
385}
386
387#----------------------------#
388get_book() { #
389#----------------------------#
390 cd $JHALFSDIR
391
392 if [ -z $WORKING_COPY ] ; then
393 # Check for Subversion instead of just letting the script hit 'svn' and fail.
394 test `type -p svn` || eval "echo \"This feature requires Subversion.\"
395 exit 1"
396 echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
397
398 case $PROGNAME in
399 lfs) svn_root="LFS" ;;
400 hlfs) svn_root="HLFS" ;;
401 clfs) svn_root="cross-lfs" ;;
402 clfs2) svn_root="cross-lfs" ;;
403 *) echo "BOOK not defined in function <get_book>"
404 exit 1 ;;
405 esac
406 # Grab a fresh book if it's missing, otherwise, update it from the
407 # repo. If we've already extracted the commands, move on to getting the
408 # sources.
409 if [ -d ${PROGNAME}-$LFSVRS ] ; then
410 cd ${PROGNAME}-$LFSVRS
411 if LC_ALL=C svn up | grep -q At && \
412 test -d $JHALFSDIR/${PROGNAME}-commands && \
413 test -f $JHALFSDIR/pkg_tarball_list ; then
414 # Set the canonical book version
415 echo -ne "done\n"
416 cd $JHALFSDIR
417 case $PROGNAME in
418 clfs | clfs2)
419 VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
420 *)
421 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
422 esac
423 get_sources
424 else
425 echo -ne "done\n"
426 extract_commands
427 fi
428 else
429 svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
430 echo -ne "done\n"
431 extract_commands
432 fi
433
434 else
435 echo -ne "Using $BOOK as book's sources ...\n"
436 extract_commands
437 fi
438 echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
439}
440
441#----------------------------#
442extract_commands() { #
443#----------------------------#
444
445 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
446 test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
447 exit 1"
448
449 cd $JHALFSDIR
450 case $PROGNAME in
451 clfs | clfs2 )
452 VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
453 *)
454 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
455 esac
456
457 # Start clean
458 if [ -d ${PROGNAME}-commands ]; then
459 rm -rf ${PROGNAME}-commands
460 mkdir -v ${PROGNAME}-commands
461 fi
462 echo -n "Extracting commands for"
463
464 # Dump the commands in shell script form from the HLFS book.
465 case ${PROGNAME} in
466 clfs)
467 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
468 xsltproc --nonet \
469 --xinclude \
470 --stringparam method $METHOD \
471 --stringparam testsuite $TEST \
472 --stringparam bomb-testsuite $BOMB_TEST \
473 --stringparam vim-lang $VIMLANG \
474 --stringparam timezone $TIMEZONE \
475 --stringparam page $PAGE \
476 --stringparam lang $LANG \
477 --stringparam keymap $KEYMAP \
478 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
479 ;;
480
481 clfs2)
482 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
483 xsltproc --nonet \
484 --xinclude \
485 --stringparam vim-lang $VIMLANG \
486 --stringparam timezone $TIMEZONE \
487 --stringparam page $PAGE \
488 --stringparam lang $LANG \
489 --stringparam keymap $KEYMAP \
490 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
491 ;;
492 hlfs)
493 echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
494 xsltproc --nonet \
495 --xinclude \
496 --stringparam model $MODEL \
497 --stringparam testsuite $TEST \
498 --stringparam bomb-testsuite $BOMB_TEST \
499 --stringparam timezone $TIMEZONE \
500 --stringparam page $PAGE \
501 --stringparam lang $LANG \
502 --stringparam lc_all $LC_ALL \
503 --stringparam keymap $KEYMAP \
504 --stringparam grsecurity_host $GRSECURITY_HOST \
505 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
506 ;;
507 lfs)
508 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
509 xsltproc --nonet \
510 --xinclude \
511 --stringparam testsuite $TEST \
512 --stringparam bomb-testsuite $BOMB_TEST \
513 --stringparam vim-lang $VIMLANG \
514 --stringparam timezone $TIMEZONE \
515 --stringparam page $PAGE \
516 --stringparam lang $LANG \
517 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
518 ;;
519 *) exit 1 ;;
520 esac
521
522 [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
523
524 echo " ...OK"
525
526 # Make the scripts executable.
527 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
528
529 # Create the packages file. We need it for proper Makefile creation
530 create_package_list
531
532 # Done. Moving on...
533 get_sources
534
535}
536
537#----------------------------#
538create_package_list() { #
539#----------------------------#
540
541 # Create the packages file. We need it for proper Makefile creation
542 rm -f pkg_tarball_list
543 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
544 case ${PROGNAME} in
545 clfs | clfs2)
546 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
547 $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
548 ;;
549 hlfs)
550 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
551 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
552 ;;
553 lfs)
554 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
555 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
556 ;;
557 esac
558
559 if [[ "${BLFS_TOOL}" = "y" ]] ; then
560(
561cat << EOF
562$LIBXML_PKG
563$LIBXSLT_PKG
564$DBXSL_PKG
565$LINKS_PKG
566$SUDO_PKG
567$WGET_PKG
568$SVN_PKG
569$GPM_PKG
570EOF
571) >> pkg_tarball_list
572 fi
573
574 echo " ...OK"
575
576}
577
578
579#----------------------------#
580get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
581#----------------------------#
582 local saveIFS=$IFS
583 local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
584
585 # Test if the packages must be downloaded
586 [ ! "$GETPKG" = "y" ] && return
587
588 gs_wrt_message(){
589 echo "${RED}$1${OFF}"
590 echo "$1" >> MISSING_FILES.DMP
591 }
592 # Housekeeping
593 [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
594 cd $BUILDDIR/sources
595 [[ -f MD5SUMS ]] && rm MD5SUMS
596 [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
597 [[ -f urls.lst ]] && rm urls.lst
598
599 # Generate URLs file
600 create_urls
601
602 IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
603 for line in `cat urls.lst`; do
604 IFS=$saveIFS # Restore the system defaults
605
606 # Skip some packages if they aren't needed
607 case $line in
608 */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
609 [[ "$TEST" = "0" ]] && continue
610 ;;
611 */vim-*-lang* )
612 [[ "$VIMLANG" = "0" ]] && continue
613 ;;
614 *linux/linux-* )
615 [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
616 [[ "$GETKERNEL" = "n" ]] && continue
617 ;;
618 esac
619
620 # Locations
621 URL1=`echo $line | cut -d" " -f2` # Preferred URL
622 URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
623 FILE=`basename $URL1` # File name
624 BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
625
626 # Validation pair
627 MD5="$BOOKMD5 $FILE"
628 HAVEMD5=1
629
630 set -e
631 # If the file exists in the archive copy it to the
632 # $BUILDDIR/sources dir. MD5SUM will be validated later.
633 if [ ! -z ${SRC_ARCHIVE} ] &&
634 [ -d ${SRC_ARCHIVE} ] &&
635 [ -f ${SRC_ARCHIVE}/$FILE ]; then
636 cp ${SRC_ARCHIVE}/$FILE .
637 echo "$FILE: -- copied from $SRC_ARCHIVE"
638 fromARCHIVE=1
639 else
640 echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
641 fromARCHIVE=0
642 # If the file does not exist yet in /sources download a fresh one
643 if [ ! -f $FILE ] ; then
644 if ! wget $URL1 && ! wget $URL2 ; then
645 gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
646 continue
647 fi
648 fi
649 fi
650
651 # IF the md5sum does not match the existing files
652 if ! echo "$MD5" | md5sum -c - >/dev/null ; then
653 [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
654 [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
655 # Remove the old file and download a new one
656 rm -fv $FILE
657 # Force storage in SRC_ARCHIVE
658 fromARCHIVE=0;
659 # Try to retrieve again the file. Servers in reverse order.
660 if ! wget $URL2 && ! wget $URL1 ; then
661 gs_wrt_message "$FILE not found on the servers.. SKIPPING"
662 continue
663 fi
664 fi
665
666 # Validate the MD5SUM one last time
667 if ! echo "$MD5" | md5sum -c - >/dev/null ; then
668 gs_wrt_message "$FILE does not match MD5SUMS value"
669 # Force generation of MD5SUM
670 HAVEMD5=0
671 fi
672
673 # Generate a fresh MD5SUM for this file
674 if [[ "$HAVEMD5" = "0" ]] ; then
675 echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
676 echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
677 fi
678
679 # Good or bad we write the original md5sum to a file
680 echo "$MD5" >> MD5SUMS
681
682 # Copy the freshly downloaded file
683 # to the source archive.
684 if [ ! -z ${SRC_ARCHIVE} ] &&
685 [ -d ${SRC_ARCHIVE} ] &&
686 [ -w ${SRC_ARCHIVE} ] &&
687 [ "$fromARCHIVE" = "0" ] ; then
688 echo "Storing file:<$FILE> in the package archive"
689 cp -f $FILE ${SRC_ARCHIVE}
690 fi
691
692 done
693
694 if [[ -s MISSING_FILES.DMP ]]; then
695 echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
696 # Do not allow the automatic execution of the Makefile.
697 echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
698 RUNMAKE="n"
699 fi
700}
701
702#----------------------------#
703create_urls() { #
704#----------------------------#
705 cd $JHALFSDIR
706
707 case ${PROGNAME} in
708 clfs)
709 echo -n "Creating CLFS <${ARCH}> specific URLs file"
710 xsltproc --nonet --xinclude \
711 --stringparam server $SERVER \
712 -o $BUILDDIR/sources/urls.lst urls.xsl \
713 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
714 echo " ...OK"
715 ;;
716 clfs2)
717 echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
718 xsltproc --nonet --xinclude \
719 --stringparam server $SERVER \
720 -o $BUILDDIR/sources/urls.lst urls.xsl \
721 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
722 echo " ...OK"
723 ;;
724 hlfs)
725 echo -n "Creating HLFS <${MODEL}> specific URLs file"
726 xsltproc --nonet --xinclude \
727 --stringparam server $SERVER \
728 --stringparam model $MODEL \
729 -o $BUILDDIR/sources/urls.lst urls.xsl \
730 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
731 echo " ...OK"
732 ;;
733 lfs)
734 echo -n "Creating LFS specific URLs file"
735 xsltproc --nonet --xinclude \
736 --stringparam server $SERVER \
737 -o ../sources/urls.lst urls.xsl \
738 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
739 echo " ...OK"
740 ;;
741 esac
742
743 cd $BUILDDIR/sources
744
745 if [[ "${BLFS_TOOL}" = "y" ]]; then
746 add_blfs_deps_urls
747 fi
748
749}
750
751#----------------------------# Hardcoded URLs and MD5.
752add_blfs_deps_urls() { # No easy way to extract it.
753#----------------------------# Some FTP mirrors may not work
754
755 local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
756
757 if [[ "${DEP_LIBXML}" = "y" ]] ; then
758 echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst
759 fi
760
761 if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
762 echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
763 fi
764
765 if [[ "${DEP_DBXSL}" = "y" ]] ; then
766 echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
767 fi
768
769 if [[ "${DEP_LINKS}" = "y" ]] ; then
770 echo "${LINKS_URL} ${BLFS_SERVER}links/${LINKS_PKG} ${LINKS_MD5}" >> urls.lst
771 fi
772
773 if [[ "${DEP_SUDO}" = "y" ]] ; then
774 echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
775 echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst
776 fi
777
778 if [[ "${DEP_WGET}" = "y" ]] ; then
779 echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst
780 fi
781
782 if [[ "${DEP_SVN}" = "y" ]] ; then
783 echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
784 fi
785
786 if [[ "${DEP_GPM}" = "y" ]] ; then
787 echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
788 echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst
789 echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst
790 fi
791
792}
793
794#----------------------------# Maybe there is a better way to do this, but this
795copy_blfs_deps_scripts() { # method avoid to place the test on all
796#----------------------------# $PROGNAME/master.sh scripts.
797
798 mkdir -p ${PROGNAME}-commands/blfs-tool-deps
799
800 if [[ "${DEP_LIBXML}" = "y" ]] ; then
801 mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps
802 fi
803
804 if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
805 mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
806 fi
807
808 if [[ "${DEP_DBXSL}" = "y" ]] ; then
809 mv blfs-tool-deps/903-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
810 fi
811
812 if [[ "${DEP_LINKS}" = "y" ]] ; then
813 mv blfs-tool-deps/905-links ${PROGNAME}-commands/blfs-tool-deps
814 fi
815
816 if [[ "${DEP_SUDO}" = "y" ]] ; then
817 mv blfs-tool-deps/906-sudo ${PROGNAME}-commands/blfs-tool-deps
818 fi
819
820 if [[ "${DEP_WGET}" = "y" ]] ; then
821 mv blfs-tool-deps/907-wget ${PROGNAME}-commands/blfs-tool-deps
822 fi
823
824 if [[ "${DEP_SVN}" = "y" ]] ; then
825 mv blfs-tool-deps/908-subversion ${PROGNAME}-commands/blfs-tool-deps
826 fi
827
828 if [[ "${DEP_GPM}" = "y" ]] ; then
829 mv blfs-tool-deps/904-gpm ${PROGNAME}-commands/blfs-tool-deps
830 fi
831
832 rm -rf blfs-tool-deps
833
834}
Note: See TracBrowser for help on using the repository browser.