- Timestamp:
- 05/01/2006 11:10:53 AM (18 years ago)
- Branches:
- experimental
- Children:
- 65d83a6
- Parents:
- c58f330
- Location:
- common
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
common/common-functions
rc58f330 r3e7af38 506 506 development) 507 507 svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;; 508 alphabetical)509 svn co $SVN/${svn_root}/branches/$LFSVRS/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;510 udev_update)511 svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;512 508 esac 513 509 echo -ne "done\n" … … 526 522 } 527 523 528 529 #----------------------------#530 build_patches_file() { # Supply a suitably formated list of patches.531 #----------------------------#532 local saveIFS=$IFS533 local IFS534 535 rm -f patches536 537 LOC_add_patches_entry() {538 for f in `grep "/$1-" patcheslist_.wget`; do539 basename $f | sed "s|${2}|\&${1}-version;|" >> patches540 done541 }542 543 case ${PROGNAME} in544 hlfs)545 echo -n "Creating the HLFS ${L_arrow}${BOLD}$MODEL${R_arrow} specific patches file"546 xsltproc --nonet \547 --xinclude \548 --stringparam model $MODEL \549 -o patcheslist_.wget \550 patcheslist.xsl \551 $BOOK/chapter04/patches.xml552 #> /dev/null 2>&1553 554 # .... U G L Y .... what to do with the grsecurity patch to the kernel..555 for f in `grep "/grsecurity-" patcheslist_.wget`; do556 basename $f >> patches557 done558 ;;559 560 clfs) # Pull out a list of arch specific patches561 echo -n "Creating CLFS ${L_arrow}${BOLD}$ARCH${R_arrow} specific patches file"562 xsltproc -xinclude \563 -o patcheslist_.wget \564 patcheslist.xsl \565 $BOOK/materials/${ARCH}-chapter.xml566 ;;567 *) return568 esac569 570 571 IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only572 for f in `cat packages`; do573 IFS=$saveIFS # Restore the system defaults574 LOC_add_patches_entry \575 `echo $f | sed -e 's/-version//' \576 -e 's/-file.*//' \577 -e 's/"//g' \578 -e 's/uclibc/uClibc/'`579 done580 581 rm -f patcheslist_.wget582 583 echo " ...OK"584 }585 586 587 524 #----------------------------# 588 525 extract_commands() { # 589 526 #----------------------------# 590 local saveIFS=$IFS591 527 592 528 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail. … … 652 588 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 653 589 ;; 654 *) exit 1 590 *) exit 1 ;; 655 591 esac 656 592 … … 660 596 chmod -R +x $JHALFSDIR/${PROGNAME}-commands 661 597 662 # Grab the patches and package names. 663 for i in patches packages ; do 664 rm -f $i 665 done 666 # 598 # Create the packages file. We need it for proper Makefile creation 599 rm -f packages 667 600 case "${PROGNAME}" in 668 601 clfs) 669 ################################ 670 # A LOCAL function 671 # xx_.wget contains arch specific files but in URL format 672 # Build a file with only arch specific files.. small ugly.. 673 LOC_add_packages_entry() { 674 local fileMATCH aFILE 675 676 # Deal with a non-standard format 677 if [[ "$1" = "clfs-bootscripts" ]]; then 678 set -- "bootscripts-cross-lfs" $2 679 fi 680 fileMATCH="/$1" 681 682 # format.. Filename-Version or FilenameVersion 683 for aFILE in `grep ${fileMATCH}-*[[:digit:]] packageslist_.wget`; do 684 # Block vim-x.x-lang file, will add it later based on config flag 685 if [[ ! "${aFILE}" =~ "vim-$2-lang" ]]; then 686 echo "$1-version \"$2\"" >> packages 687 fi 688 done 689 } 690 ################################# 691 692 # We only want a list arch specific files.. 693 # Unfortunately this script produces URL's which must be converted to a std format 694 echo -n "Creating CLFS ${L_arrow}${BOLD}${ARCH}${R_arrow} specific packages file" 695 xsltproc -xinclude \ 696 -o packageslist_.wget \ 697 packageslist.xsl \ 698 $BOOK/materials/${ARCH}-chapter.xml 699 700 # This has the correct format but contains packages from every book 602 echo -n "Creating <${PROGNAME}> specific packages file" 701 603 grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \ 702 604 -e 's@">@"@' \ 703 -e '/generic/d' > packages.tmp 704 # This variable is necessary to make sure the `cat $JHALFSDIR/packages` 705 # separates each iteration by lines. 706 # Modify the 'internal field separator' to break on 'LF' only 707 IFS=$'\x0A' 708 for f in `cat packages.tmp`; do 709 IFS=$saveIFS # Restore the system defaults 710 LOC_add_packages_entry \ 711 `echo $f | sed -e 's/-version//' \ 712 -e 's/-file.*//' \ 713 -e 's/"//g'` 714 done 715 716 rm -f packageslist_.wget packages.tmp 717 605 -e '/generic/d' > packages 718 606 echo " ...OK" 719 607 ;; … … 732 620 -e 's@">@"@' \ 733 621 -e '/generic/d' >> packages 734 echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages735 echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@'` >> packages736 622 echo " ...OK" 737 623 ;; 738 esac739 740 # Download the vim-lang package if it must be installed741 if [ "$VIMLANG" = "1" ] && [ ! "$PROGNAME" = "hlfs" ] ; then742 echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages743 fi744 745 # Create the patches file746 case "${PROGNAME}" in747 hlfs)748 build_patches_file ;;749 clfs )750 build_patches_file ;;751 lfs)752 grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches753 ;;754 blfs) ;;755 *) exit 1756 624 esac 757 625 … … 762 630 763 631 #----------------------------# 764 download() { # Download file, write name to MISSING_FILES.DMP if an error 765 #----------------------------# 766 cd $BUILDDIR/sources 767 768 # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn} 769 # that don't conform to norms in the URL scheme. 770 DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'` 771 772 # If the file exists in the archive copy it to the $BUILDDIR/sources dir 773 # MD5SUM is assumed to be correct from previous download 774 if [ ! -z ${SRC_ARCHIVE} ] && 775 [ -d ${SRC_ARCHIVE} ] && 776 [ -f ${SRC_ARCHIVE}/$2 ]; then 777 cp ${SRC_ARCHIVE}/$2 . 778 echo "$2: -- ok" 779 return 780 fi 781 782 # Find the md5 sum for this package. 783 if [ $2 != MD5SUMS ] ; then 784 set +e 785 MD5=`grep " $2" MD5SUMS` 786 if [ $? -ne 0 ]; then 787 set -e 788 echo "${RED}$2 not found in MD5SUMS${OFF}" 789 echo "$2 not found in MD5SUMS" >> MISSING_FILES.DMP 790 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 IFS=$saveIFS # Restore the system defaults 656 657 # Skip some packages if they aren't needed 658 case $line in 659 */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* ) 660 [[ "$TEST" = "0" ]] && continue 661 ;; 662 */vim-*-lang* ) 663 [[ "$VIMLANG" = "0" ]] && continue 664 ;; 665 esac 666 667 URL1=`echo $line | cut -d" " -f1` # Upstream URL 668 URL2=`echo $line | cut -d" " -f2` # Fallback URL 669 FILE=`basename $URL2` # File name 670 671 # If the file exists in the archive copy it to the $BUILDDIR/sources dir 672 # MD5SUM is assumed to be correct from previous download 673 if [ ! -z ${SRC_ARCHIVE} ] && 674 [ -d ${SRC_ARCHIVE} ] && 675 [ -f ${SRC_ARCHIVE}/$FILE ]; then 676 cp ${SRC_ARCHIVE}/$FILE . 677 echo "$FILE: -- copied from $SRC_ARCHIVE" 678 fi 679 680 # Find the md5 sum for this package. 681 set +e 682 MD5=`grep " $FILE" MD5SUMS` 683 if [ $? -ne 0 ]; then 684 set -e 685 echo "${RED}$FILE not found in MD5SUMS${OFF}" 686 echo "$FILE not found in MD5SUMS" >> MISSING_FILES.DMP 791 687 fi 792 688 set -e 689 690 if [ ! -f $FILE ] ; then 691 wget $URL1 || wget $URL2 692 elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then 693 wget -N $URL1 || wget -N $URL2 694 fi 695 696 if ! echo "$MD5" | md5sum -c - ; then 697 echo "${RED}$FILE not match MD5SUMS value${OFF}" 698 echo "$FILE not match MD5SUMS value" >> MISSING_FILES.DMP 699 fi 700 echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION 701 702 # Copy the freshly downloaded file 703 # to the source archive. 704 if [ ! -z ${SRC_ARCHIVE} ] && 705 [ -d ${SRC_ARCHIVE} ] && 706 [ -w ${SRC_ARCHIVE} ] && 707 [ ! -f ${SRC_ARCHIVE}/$FILE ] ; then 708 echo "Store file:<$FILE> in package archive" 709 cp -v $FILE ${SRC_ARCHIVE} 710 fi 711 712 done 713 714 if [[ -s MISSING_FILES.DMP ]]; then 715 echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n" 716 fi 717 793 718 fi 794 795 if [ ! -f $2 ] ; then 796 case $DL in 797 wgetFTP ) wget --passive $FTP/$DIR/$2 ;; 798 wget ) wget $HTTP/$DIR/$2 ;; 799 curl ) `curl -# $FTP/$DIR/$2 -o $2` ;; 800 * ) echo "$DL not supported at this time." ;; 801 esac 802 elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then 803 case $DL in 804 wgetFTP ) wget --passive -c $FTP/$DIR/$2 ;; 805 wget ) wget -c $HTTP/$DIR/$2 ;; 806 curl ) `curl -# -C - $FTP/$DIR/$2 -o $2` ;; 807 * ) echo "$DL not supported at this time." ;; 808 esac 809 fi 810 811 if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then 812 exit 1 813 fi 814 if [ $2 != MD5SUMS ] ; then 815 echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION 816 fi 817 818 # If we make it this far we should copy the freshly downloaded file 819 # to the source archive. 820 if [ ! -z ${SRC_ARCHIVE} ] && 821 [ -d ${SRC_ARCHIVE} ] && 822 [ -w ${SRC_ARCHIVE} ] && 823 [ $2 != MD5SUMS ]; then 824 echo "Store file:<$2> in package archive" 825 cp -v $2 ${SRC_ARCHIVE} 826 fi 827 828 } 829 830 831 #----------------------------# 832 get_sources() { 833 #----------------------------# 834 835 # Test if the packages must be downloaded 836 if [ "$HPKG" = "1" ] ; then 837 838 # This variable is necessary to make sure the `cat $JHALFSDIR/packages` 839 # separates each iteration by lines. 840 # Modify the 'internal field separator' to break on 'LF' only 841 IFS=$'\x0A' 842 843 if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi 844 cd $BUILDDIR/sources 845 if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi 846 if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi 847 if [ -f MISSING_FILES.DMP ] ; then rm MISSING_FILES.DMP ; fi 848 849 download "" MD5SUMS 850 851 # Iterate through each package and grab it, along with any patches it needs. 852 for i in `cat $JHALFSDIR/packages` ; do 853 PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'` 854 855 # There are some entities that aren't valid packages. 856 if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi 857 858 VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'` 859 case $PKG in 860 tcl) FILE="$PKG$VRS-src.tar.bz2" ;; 861 vim-lang) PKG="vim" 862 FILE="vim-$VRS-lang.tar.bz2" ;; 863 udev-config) PKG="udev" 864 FILE="$VRS" ;; 865 *) FILE="$PKG-$VRS.tar.bz2" ;; 866 esac 867 download $PKG $FILE 868 869 # Download any associated patches 870 for patch in `grep "&$PKG-version" $JHALFSDIR/patches` ; do 871 PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'` 872 download $PKG $PATCH 873 done 874 done 875 if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then 876 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" 877 fi 878 fi 879 } 880 719 } 720 721 722 #----------------------------# 723 create_urls() { # 724 #----------------------------# 725 cd $JHALFSDIR 726 727 case ${PROGNAME} in 728 clfs) 729 echo -n "Creating CLFS <${ARCH}> specific URLs file" 730 xsltproc --nonet --xinclude \ 731 --stringparam server $SERVER \ 732 -o $BUILDDIR/sources/urls.lst urls.xsl \ 733 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 734 echo " ...OK" 735 ;; 736 hlfs) 737 echo -n "Creating HLFS <${MODEL}> specific URLs file" 738 xsltproc --nonet --xinclude \ 739 --stringparam server $SERVER \ 740 --stringparam model $MODEL \ 741 -o $BUILDDIR/sources/urls.lst urls.xsl \ 742 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 743 echo " ...OK" 744 ;; 745 lfs) 746 echo -n "Creating LFS specific URLs file" 747 xsltproc --nonet --xinclude \ 748 --stringparam server $SERVER \ 749 -o ../sources/urls.lst urls.xsl \ 750 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 751 echo " ...OK" 752 ;; 753 esac 754 755 cd $BUILDDIR/sources 756 } -
common/config
rc58f330 r3e7af38 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
rc58f330 r3e7af38 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"
Note:
See TracChangeset
for help on using the changeset viewer.