- Timestamp:
- 04/30/2006 07:42:10 PM (18 years ago)
- Branches:
- 1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
- Children:
- 799b0d1
- Parents:
- c03b616
- Location:
- common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
common/common-functions
rc03b616 r15cad16 522 522 } 523 523 524 525 #----------------------------#526 build_patches_file() { # Supply a suitably formated list of patches.527 #----------------------------#528 local saveIFS=$IFS529 local IFS530 531 rm -f patches532 533 LOC_add_patches_entry() {534 for f in `grep "/$1-" patcheslist_.wget`; do535 basename $f | sed "s|${2}|\&${1}-version;|" >> patches536 done537 }538 539 case ${PROGNAME} in540 hlfs)541 echo -n "Creating the HLFS ${L_arrow}${BOLD}$MODEL${R_arrow} specific patches file"542 xsltproc --nonet \543 --xinclude \544 --stringparam model $MODEL \545 -o patcheslist_.wget \546 patcheslist.xsl \547 $BOOK/chapter04/patches.xml548 #> /dev/null 2>&1549 550 # .... U G L Y .... what to do with the grsecurity patch to the kernel..551 for f in `grep "/grsecurity-" patcheslist_.wget`; do552 basename $f >> patches553 done554 ;;555 556 clfs) # Pull out a list of arch specific patches557 echo -n "Creating CLFS ${L_arrow}${BOLD}$ARCH${R_arrow} specific patches file"558 xsltproc -xinclude \559 -o patcheslist_.wget \560 patcheslist.xsl \561 $BOOK/materials/${ARCH}-chapter.xml562 ;;563 *) return564 esac565 566 567 IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only568 for f in `cat packages`; do569 IFS=$saveIFS # Restore the system defaults570 LOC_add_patches_entry \571 `echo $f | sed -e 's/-version//' \572 -e 's/-file.*//' \573 -e 's/"//g' \574 -e 's/uclibc/uClibc/'`575 done576 577 rm -f patcheslist_.wget578 579 echo " ...OK"580 }581 582 583 524 #----------------------------# 584 525 extract_commands() { # 585 526 #----------------------------# 586 local saveIFS=$IFS587 527 588 528 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail. … … 648 588 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 649 589 ;; 650 *) exit 1 590 *) exit 1 ;; 651 591 esac 652 592 … … 656 596 chmod -R +x $JHALFSDIR/${PROGNAME}-commands 657 597 658 # Grab the patches and package names. 659 for i in patches packages ; do 660 rm -f $i 661 done 662 # 598 # Create the packages file. We need it for proper Makefile creation 599 rm -f packages 663 600 case "${PROGNAME}" in 664 601 clfs) 665 ################################ 666 # A LOCAL function 667 # xx_.wget contains arch specific files but in URL format 668 # Build a file with only arch specific files.. small ugly.. 669 LOC_add_packages_entry() { 670 local fileMATCH aFILE 671 672 # Deal with a non-standard format 673 if [[ "$1" = "clfs-bootscripts" ]]; then 674 set -- "bootscripts-cross-lfs" $2 675 fi 676 fileMATCH="/$1" 677 678 # format.. Filename-Version or FilenameVersion 679 for aFILE in `grep ${fileMATCH}-*[[:digit:]] packageslist_.wget`; do 680 # Block vim-x.x-lang file, will add it later based on config flag 681 if [[ ! "${aFILE}" =~ "vim-$2-lang" ]]; then 682 echo "$1-version \"$2\"" >> packages 683 fi 684 done 685 } 686 ################################# 687 688 # We only want a list arch specific files.. 689 # Unfortunately this script produces URL's which must be converted to a std format 690 echo -n "Creating CLFS ${L_arrow}${BOLD}${ARCH}${R_arrow} specific packages file" 691 xsltproc -xinclude \ 692 -o packageslist_.wget \ 693 packageslist.xsl \ 694 $BOOK/materials/${ARCH}-chapter.xml 695 696 # This has the correct format but contains packages from every book 602 echo -n "Creating <${PROGNAME}> specific packages file" 697 603 grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \ 698 604 -e 's@">@"@' \ 699 -e '/generic/d' > packages.tmp 700 # This variable is necessary to make sure the `cat $JHALFSDIR/packages` 701 # separates each iteration by lines. 702 # Modify the 'internal field separator' to break on 'LF' only 703 IFS=$'\x0A' 704 for f in `cat packages.tmp`; do 705 IFS=$saveIFS # Restore the system defaults 706 LOC_add_packages_entry \ 707 `echo $f | sed -e 's/-version//' \ 708 -e 's/-file.*//' \ 709 -e 's/"//g'` 710 done 711 712 rm -f packageslist_.wget packages.tmp 713 605 -e '/generic/d' > packages 714 606 echo " ...OK" 715 607 ;; … … 728 620 -e 's@">@"@' \ 729 621 -e '/generic/d' >> packages 730 echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages731 echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@'` >> packages732 622 echo " ...OK" 733 623 ;; 734 esac735 736 # Download the vim-lang package if it must be installed737 if [ "$VIMLANG" = "1" ] && [ ! "$PROGNAME" = "hlfs" ] ; then738 echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages739 fi740 741 # Create the patches file742 case "${PROGNAME}" in743 hlfs)744 build_patches_file ;;745 clfs )746 build_patches_file ;;747 lfs)748 grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches749 ;;750 blfs) ;;751 *) exit 1752 624 esac 753 625 … … 758 630 759 631 #----------------------------# 760 download() { # Download file, write name to MISSING_FILES.DMP if an error 761 #----------------------------# 762 cd $BUILDDIR/sources 763 764 # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn} 765 # that don't conform to norms in the URL scheme. 766 DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'` 767 768 # If the file exists in the archive copy it to the $BUILDDIR/sources dir 769 # MD5SUM is assumed to be correct from previous download 770 if [ ! -z ${SRC_ARCHIVE} ] && 771 [ -d ${SRC_ARCHIVE} ] && 772 [ -f ${SRC_ARCHIVE}/$2 ]; then 773 cp ${SRC_ARCHIVE}/$2 . 774 echo "$2: -- ok" 775 return 776 fi 777 778 # Find the md5 sum for this package. 779 if [ $2 != MD5SUMS ] ; then 780 set +e 781 MD5=`grep " $2" MD5SUMS` 782 if [ $? -ne 0 ]; then 783 set -e 784 echo "${RED}$2 not found in MD5SUMS${OFF}" 785 echo "$2 not found in MD5SUMS" >> MISSING_FILES.DMP 786 return 632 get_sources() { # Download file, write name to MISSING_FILES.DMP if an error 633 #----------------------------# 634 local saveIFS=$IFS 635 local IFS line URL1 URL2 FILE MD5 636 637 # Test if the packages must be downloaded 638 if [ "$GETPKG" = "1" ] ; then 639 640 [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources 641 cd $BUILDDIR/sources 642 [[ -f MD5SUMS ]] && rm MD5SUMS 643 [[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION 644 [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP 645 [[ -f urls.lst ]] && rm urls.lst 646 647 # Download a fresh MD5SUMS file 648 wget $SERVER/pub/lfs/conglomeration/MD5SUMS 649 650 # Generate URLs file 651 create_urls 652 653 IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only 654 for line in `cat urls.lst`; do 655 656 IFS=$saveIFS # Restore the system defaults 657 URL1=`echo $line | cut -d" " -f1` # Upstream URL 658 URL2=`echo $line | cut -d" " -f2` # Fallback URL 659 FILE=`basename $URL2` # File name 660 661 # If the file exists in the archive copy it to the $BUILDDIR/sources dir 662 # MD5SUM is assumed to be correct from previous download 663 if [ ! -z ${SRC_ARCHIVE} ] && 664 [ -d ${SRC_ARCHIVE} ] && 665 [ -f ${SRC_ARCHIVE}/$FILE ]; then 666 cp ${SRC_ARCHIVE}/$FILE . 667 echo "$FILE: -- copied from $SRC_ARCHIVE" 668 fi 669 670 # Find the md5 sum for this package. 671 set +e 672 MD5=`grep " $FILE" MD5SUMS` 673 if [ $? -ne 0 ]; then 674 set -e 675 echo "${RED}$FILE not found in MD5SUMS${OFF}" 676 echo "$FILE not found in MD5SUMS" >> MISSING_FILES.DMP 787 677 fi 788 678 set -e 679 680 if [ ! -f $FILE ] ; then 681 wget $URL1 || wget $URL2 682 elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then 683 wget -N $URL1 || wget -N $URL2 684 fi 685 686 if ! echo "$MD5" | md5sum -c - ; then 687 exit 1 688 fi 689 echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION 690 691 # Copy the freshly downloaded file 692 # to the source archive. 693 if [ ! -z ${SRC_ARCHIVE} ] && 694 [ -d ${SRC_ARCHIVE} ] && 695 [ -w ${SRC_ARCHIVE} ] && 696 [ ! -f ${SRC_ARCHIVE}/$FILE ] ; then 697 echo "Store file:<$FILE> in package archive" 698 cp -v $FILE ${SRC_ARCHIVE} 699 fi 700 701 done 702 789 703 fi 790 791 if [ ! -f $2 ] ; then 792 case $DL in 793 wgetFTP ) wget --passive $FTP/$DIR/$2 ;; 794 wget ) wget $HTTP/$DIR/$2 ;; 795 curl ) `curl -# $FTP/$DIR/$2 -o $2` ;; 796 * ) echo "$DL not supported at this time." ;; 797 esac 798 elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then 799 case $DL in 800 wgetFTP ) wget --passive -c $FTP/$DIR/$2 ;; 801 wget ) wget -c $HTTP/$DIR/$2 ;; 802 curl ) `curl -# -C - $FTP/$DIR/$2 -o $2` ;; 803 * ) echo "$DL not supported at this time." ;; 804 esac 805 fi 806 807 if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then 808 exit 1 809 fi 810 if [ $2 != MD5SUMS ] ; then 811 echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION 812 fi 813 814 # If we make it this far we should copy the freshly downloaded file 815 # to the source archive. 816 if [ ! -z ${SRC_ARCHIVE} ] && 817 [ -d ${SRC_ARCHIVE} ] && 818 [ -w ${SRC_ARCHIVE} ] && 819 [ $2 != MD5SUMS ]; then 820 echo "Store file:<$2> in package archive" 821 cp -v $2 ${SRC_ARCHIVE} 822 fi 823 824 } 825 826 827 #----------------------------# 828 get_sources() { 829 #----------------------------# 830 831 # Test if the packages must be downloaded 832 if [ "$HPKG" = "1" ] ; then 833 834 # This variable is necessary to make sure the `cat $JHALFSDIR/packages` 835 # separates each iteration by lines. 836 # Modify the 'internal field separator' to break on 'LF' only 837 IFS=$'\x0A' 838 839 if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi 840 cd $BUILDDIR/sources 841 if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi 842 if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi 843 if [ -f MISSING_FILES.DMP ] ; then rm MISSING_FILES.DMP ; fi 844 845 download "" MD5SUMS 846 847 # Iterate through each package and grab it, along with any patches it needs. 848 for i in `cat $JHALFSDIR/packages` ; do 849 PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'` 850 851 # There are some entities that aren't valid packages. 852 if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi 853 854 VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'` 855 case $PKG in 856 tcl) FILE="$PKG$VRS-src.tar.bz2" ;; 857 vim-lang) PKG="vim" 858 FILE="vim-$VRS-lang.tar.bz2" ;; 859 udev-config) PKG="udev" 860 FILE="$VRS" ;; 861 *) FILE="$PKG-$VRS.tar.bz2" ;; 862 esac 863 download $PKG $FILE 864 865 # Download any associated patches 866 for patch in `grep "&$PKG-version" $JHALFSDIR/patches` ; do 867 PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'` 868 download $PKG $PATCH 869 done 870 done 871 if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then 872 echo -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n" 873 fi 874 fi 875 } 876 704 } 705 706 707 #----------------------------# 708 create_urls() { # 709 #----------------------------# 710 cd $JHALFSDIR 711 712 case ${PROGNAME} in 713 clfs) 714 echo -n "Creating CLFS <${ARCH}> specific URLs file" 715 xsltproc --nonet --xinclude \ 716 --stringparam server $SERVER \ 717 -o $BUILDDIR/sources/urls.lst urls.xsl \ 718 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 719 echo " ...OK" 720 ;; 721 hlfs) 722 echo -n "Creating HLFS <${MODEL}> specific URLs file" 723 xsltproc --nonet --xinclude \ 724 --stringparam server $SERVER \ 725 --stringparam model $MODEL \ 726 -o $BUILDDIR/sources/urls.lst urls.xsl \ 727 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 728 echo " ...OK" 729 ;; 730 lfs) 731 echo -n "Creating LFS specific URLs file" 732 xsltproc --nonet --xinclude \ 733 --stringparam server $SERVER \ 734 -o ../sources/urls.lst urls.xsl \ 735 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 736 echo " ...OK" 737 ;; 738 esac 739 740 cd $BUILDDIR/sources 741 } -
common/config
rc03b616 r15cad16 8 8 declare -r SVN="svn://svn.linuxfromscratch.org" 9 9 declare -r LOG=000-masterscript.log 10 declare -r HTTP=http://ftp.lfs-matrix.net/pub/lfs/conglomeration11 10 12 11 #--- Mount point for the build 13 12 BUILDDIR=/mnt/build_dir 14 13 14 #=== Getting packages === 15 #--- Download the source packages 0(no)/1(yes) 16 GETPKG=0 17 15 18 #--- The local repository for packages/file 16 # Used only if HPKG = 119 # Used only if GETPKG = 1 17 20 # Any missing file will be downloaded and archived here, 18 21 # if the user has the right priviledges. 19 22 SRC_ARCHIVE=$SRC_ARCHIVE 20 23 21 #--- Download the source packages 0(no)/1(yes) 22 HPKG=0 24 # --- Server used as fallback if the file isn't found in 25 # SRC_ARCHIVE and/or can't be dowloaded from upstream 26 SERVER=ftp://ftp.lfs-matrix.net 23 27 28 #=== Build options === 24 29 #--- Run the makefile at the end 0(no)/1(yes) 25 30 # In BLFS the Makefile can't be run automatically -
common/func_validate_configs.sh
rc03b616 r15cad16 85 85 86 86 # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables 87 local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG DEPEND TEST"88 local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL"89 local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD ARCH TARGET TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"90 local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG"87 local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG DEPEND TEST" 88 local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL" 89 local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG" 90 local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG" 91 91 92 92 local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' … … 178 178 179 179 # Validate general parameters.. 180 HPKG)validate_against_str "x0x x1x" ;;180 GETPKG) validate_against_str "x0x x1x" ;; 181 181 RUNMAKE) validate_against_str "x0x x1x" ;; 182 182 REPORT) validate_against_str "x0x x1x" -
common/urls.xsl
rc03b616 r15cad16 45 45 <xsl:value-of select="@url"/> 46 46 </xsl:if> 47 <!-- Using a tab character as fields separator --> 48 <xsl:text> </xsl:text> 47 <xsl:text> </xsl:text> 49 48 <xsl:value-of select="$server"/> 50 49 <xsl:text>/pub/lfs/conglomeration/</xsl:text>
Note:
See TracChangeset
for help on using the changeset viewer.