[7ea25e4] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | #----------------------------# Prepare BLFS_ROOT and extract
|
---|
| 6 | install_blfs_tools() { # the scriptlets to build
|
---|
| 7 | #----------------------------# the dependency tools
|
---|
| 8 | # Install the files
|
---|
| 9 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
|
---|
| 10 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
| 11 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
| 12 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
| 13 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
| 14 |
|
---|
| 15 | # Clean-up
|
---|
| 16 | make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
|
---|
| 17 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
| 18 | rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
|
---|
| 19 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
| 20 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
| 21 |
|
---|
| 22 | # Set some harcoded envars to their proper values
|
---|
| 23 | sed -i s@tracking-dir@$TRACKING_DIR@ \
|
---|
| 24 | ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
|
---|
| 25 |
|
---|
| 26 | # Downloads the book, initialize the tracking file and the package database
|
---|
[81cd513] | 27 | # sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs
|
---|
| 28 | # has to be created
|
---|
| 29 | sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
|
---|
[7ea25e4] | 30 | $BUILDDIR$BLFS_ROOT/packages.xml
|
---|
| 31 |
|
---|
| 32 | # Because the BLFS Makefile is supposed to be used in chroot (or booted)
|
---|
| 33 | # mode, the tracking file has wrong path for DTD. Change it:
|
---|
[5573313] | 34 | sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
|
---|
[7ea25e4] | 35 |
|
---|
| 36 | # Manually build a 'configuration' file
|
---|
| 37 | if [ "$DEP_LIBXML" = y ]; then
|
---|
| 38 | LINE_LIBXML='CONFIG_libxml2=y'
|
---|
| 39 | else
|
---|
| 40 | LINE_LIBXML='#CONFIG_libxml2 is not set'
|
---|
| 41 | fi
|
---|
| 42 | if [ "$DEP_LIBXSLT" = y ]; then
|
---|
| 43 | LINE_LIBXSLT='CONFIG_libxslt=y'
|
---|
| 44 | else
|
---|
| 45 | LINE_LIBXSLT='#CONFIG_libxslt is not set'
|
---|
| 46 | fi
|
---|
| 47 | if [ "$DEP_TIDY" = y ]; then
|
---|
| 48 | LINE_TIDY='CONFIG_html-tidy=y'
|
---|
| 49 | else
|
---|
| 50 | LINE_TIDY='#CONFIG_html-tidy is not set'
|
---|
| 51 | fi
|
---|
| 52 | if [ "$DEP_DBXML" = y ]; then
|
---|
| 53 | LINE_DBXML='CONFIG_DocBook=y'
|
---|
| 54 | else
|
---|
| 55 | LINE_DBXML='#CONFIG_DocBook is not set'
|
---|
| 56 | fi
|
---|
| 57 | if [ "$DEP_LYNX" = y ]; then
|
---|
| 58 | LINE_LYNX='CONFIG_lynx=y'
|
---|
| 59 | else
|
---|
| 60 | LINE_LYNX='#CONFIG_lynx is not set'
|
---|
| 61 | fi
|
---|
| 62 | if [ "$DEP_SUDO" = y ]; then
|
---|
| 63 | LINE_SUDO='CONFIG_sudo=y'
|
---|
| 64 | else
|
---|
| 65 | LINE_SUDO='#CONFIG_sudo is not set'
|
---|
| 66 | fi
|
---|
| 67 | if [ "$DEP_WGET" = y ]; then
|
---|
| 68 | LINE_WGET='CONFIG_wget=y'
|
---|
| 69 | else
|
---|
| 70 | LINE_WGET='#CONFIG_wget is not set'
|
---|
| 71 | fi
|
---|
| 72 | if [ "$DEP_GPM" = y ]; then
|
---|
| 73 | LINE_GPM='CONFIG_gpm=y'
|
---|
| 74 | else
|
---|
| 75 | LINE_GPM='#CONFIG_gpm is not set'
|
---|
| 76 | fi
|
---|
| 77 | if [ "$DEP_SVN" = y ]; then
|
---|
| 78 | LINE_SVN='CONFIG_subversion=y'
|
---|
| 79 | else
|
---|
| 80 | LINE_SVN='#CONFIG_subversion is not set'
|
---|
| 81 | fi
|
---|
| 82 |
|
---|
| 83 | cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
|
---|
| 84 | $LINE_LIBXML
|
---|
| 85 | $LINE_LIBXSLT
|
---|
| 86 | $LINE_WGET
|
---|
| 87 | $LINE_TIDY
|
---|
| 88 | $LINE_DBXML
|
---|
| 89 | $LINE_SVN
|
---|
| 90 | $LINE_GPM
|
---|
| 91 | $LINE_LYNX
|
---|
| 92 | $LINE_SUDO
|
---|
| 93 | MAIL_SERVER=sendmail
|
---|
| 94 | optDependency=2
|
---|
| 95 | SUDO=n
|
---|
| 96 | EOF
|
---|
| 97 |
|
---|
| 98 | # Generates the scripts for the blfs tools dependencies (in ./scripts)
|
---|
| 99 | yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
|
---|
| 100 |
|
---|
| 101 | # Move the scriptlets where they should be
|
---|
| 102 | rm -rf $BUILDDIR$BLFS_ROOT/scripts
|
---|
| 103 | mv scripts $BUILDDIR$BLFS_ROOT
|
---|
| 104 |
|
---|
| 105 | # Generates a list containing download and copying instructions for tarballs
|
---|
| 106 | echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 107 | sed -n -e '/PACKAGE=/,/md5sum/p' \
|
---|
| 108 | -e '/PACKAGE1=/,/^fi/p' \
|
---|
| 109 | -e '/PATCH=/,/^fi/p' \
|
---|
| 110 | -e '/URL=/,/unpacked/p' \
|
---|
| 111 | $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 112 | chmod u+x $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 113 |
|
---|
| 114 | # Downloads (or copy) to build_dir/sources
|
---|
| 115 | pushd $BUILDDIR/sources
|
---|
| 116 | FTP_SERVER=$SERVER/pub/blfs/ SRC_ARCHIVE=$SRC_ARCHIVE $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 117 | # The blfs-bootscripts package is at the wrong location
|
---|
| 118 | mkdir -p blfs-bootscripts
|
---|
| 119 | mv blfs-bootscripts*tar* blfs-bootscripts
|
---|
| 120 | popd
|
---|
| 121 | rm -v $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 122 |
|
---|
| 123 | # Suppresses unneeded parts of the scriptlets
|
---|
| 124 | if [ "$DEP_WGET" = y ]; then
|
---|
| 125 | sed -i s'/-ssl=.*/out-ssl/' $BUILDDIR$BLFS_ROOT/scripts/*wget
|
---|
| 126 | fi
|
---|
| 127 | if [ "$DEP_SUDO" = y ]; then
|
---|
| 128 | sed -i '/pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
|
---|
| 129 | fi
|
---|
| 130 | if [ "$DEP_SVN" = y ]; then
|
---|
| 131 | sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
|
---|
| 132 | fi
|
---|
| 133 |
|
---|
| 134 | # At last generates the build Makefile
|
---|
| 135 | mkdir -p $BUILDDIR$BLFS_ROOT/work
|
---|
| 136 | pushd $BUILDDIR$BLFS_ROOT/work
|
---|
| 137 | ../gen-makefile.sh
|
---|
| 138 | sed -i -e '/xsltproc/,+6d' \
|
---|
| 139 | -e '/^all/s@$@ update@' \
|
---|
| 140 | -e 's/touch/@touch/' Makefile
|
---|
| 141 | cat >> Makefile << EOF
|
---|
| 142 | update:
|
---|
| 143 | @echo Updating the tracking file
|
---|
| 144 | @for file in *-*; do \\
|
---|
| 145 | xsltproc --stringparam packages ../packages.xml \\
|
---|
| 146 | --stringparam package \$\${file##*z-} \\
|
---|
| 147 | -o track.tmp \\
|
---|
| 148 | ../xsl/bump.xsl \$(TRACKING_FILE); \\
|
---|
| 149 | sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
|
---|
| 150 | xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
|
---|
| 151 | rm track.tmp; \\
|
---|
| 152 | done
|
---|
| 153 | @touch \$@
|
---|
| 154 | @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
|
---|
| 155 | @echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 156 | EOF
|
---|
| 157 | popd
|
---|
| 158 | }
|
---|