source: common/libs/func_install_blfs@ 7bbcce3

new_features
Last change on this file since 7bbcce3 was 316db229, checked in by Pierre Labastie <pierre@…>, 8 years ago

Install the wrap and pack functions whan installing BLFS tools

  • Property mode set to 100644
File size: 6.7 KB
RevLine 
[e576789]1#!/bin/bash
2
3# $Id$
4
5#----------------------------# Prepare BLFS_ROOT and extract
6install_blfs_tools() { # the scriptlets to build
7#----------------------------# the dependency tools
8set -e
9# Install the files
10[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
11cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
12cp -r menu ${BUILDDIR}${BLFS_ROOT}
13cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
14cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
[316db229]15if [ "$WRAP_INSTALL" = y ]; then
16 sed -e 's/PKGDIR/UNPACKDIR/' \
17 -e 's/PKG_DEST/PKG_DIR/' \
18 $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
19fi
[e576789]20
21# Clean-up
22make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
23rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
24rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
25rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
26rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
27
28# Set some harcoded envars to their proper values
29sed -i s@tracking-dir@$TRACKING_DIR@ \
30 ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
31sed -i s@trunk/BOOK@$BLFS_TREE@ \
32 ${BUILDDIR}${BLFS_ROOT}/Makefile
33
[854854e]34# If we have a working copy, copy it:
35if [[ "$BLFS_WORKING_COPY" = "y" ]]; then
[382b083]36echo "copying the local BLFS working copy (may take some time)"
[e58cf153]37# -r: recursive; -u: only if newer; -T: otherwise, would copy to a subdirectory
[382b083]38# of blfs-xml, if blfs-xml already exists; --preserve=timestamps: if the local
39# book has already been validated, tmp is posterior to the others, and
40# validation will not be done again.
41 cp -ruT --preserve=timestamps $BLFS_WC_LOCATION \
42 ${BUILDDIR}${BLFS_ROOT}/blfs-xml
[854854e]43fi
44# Downloads the book if necessary, initialize the tracking file and the
45# package database.
[e576789]46# sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs
47# has to be created
48sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
49 $BUILDDIR$BLFS_ROOT/packages.xml
50
51# Because the BLFS Makefile is supposed to be used in chroot (or booted)
52# mode, the tracking file has wrong path for DTD. Change it:
53sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
54
55# Manually build a 'configuration' file
56if [ "$DEP_LIBXML" = y ]; then
57 LINE_LIBXML='CONFIG_libxml2=y'
58else
59 LINE_LIBXML='#CONFIG_libxml2 is not set'
60fi
61if [ "$DEP_LIBXSLT" = y ]; then
62 LINE_LIBXSLT='CONFIG_libxslt=y'
63else
64 LINE_LIBXSLT='#CONFIG_libxslt is not set'
65fi
[c1626d8]66# DocBook is a rec dep of libxslt
67# if [ "$DEP_DBXML" = y ]; then
68# LINE_DBXML='CONFIG_DocBook=y'
69# else
70# LINE_DBXML='#CONFIG_DocBook is not set'
71# fi
[e576789]72if [ "$DEP_LYNX" = y ]; then
73 LINE_LYNX='CONFIG_lynx=y'
74else
75 LINE_LYNX='#CONFIG_lynx is not set'
76fi
77if [ "$DEP_SUDO" = y ]; then
78 LINE_SUDO='CONFIG_sudo=y'
79else
80 LINE_SUDO='#CONFIG_sudo is not set'
81fi
82if [ "$DEP_WGET" = y ]; then
83 LINE_WGET='CONFIG_wget=y'
84else
85 LINE_WGET='#CONFIG_wget is not set'
86fi
87if [ "$DEP_GPM" = y ]; then
88 LINE_GPM='CONFIG_gpm=y'
89else
90 LINE_GPM='#CONFIG_gpm is not set'
91fi
92if [ "$DEP_SVN" = y ]; then
93 LINE_SVN='CONFIG_subversion=y'
94else
95 LINE_SVN='#CONFIG_subversion is not set'
96fi
97if [ "$DEP_OPENSSL" = y ]; then
98 LINE_OPENSSL='CONFIG_openssl=y'
99else
100 LINE_OPENSSL='#CONFIG_openssl is not set'
101fi
102if [ "$DEP_PYTHON" = y ]; then
103 LINE_PYTHON='CONFIG_python2=y'
104else
105 LINE_PYTHON='#CONFIG_python2 is not set'
106fi
107
108cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
[1f25a75]109$LINE_OPENSSL
[e576789]110$LINE_PYTHON
111$LINE_LIBXML
112$LINE_LIBXSLT
113$LINE_TIDY
114$LINE_WGET
115$LINE_SVN
116$LINE_GPM
117$LINE_LYNX
118$LINE_SUDO
119MAIL_SERVER=sendmail
120optDependency=2
121SUDO=n
[316db229]122WRAP_INSTALL=$WRAP_INSTALL
[e576789]123EOF
124
125# Generates the scripts for the blfs tools dependencies (in ./scripts)
126yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
127
128# Move the scriptlets where they should be
129sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
130mv scripts $BUILDDIR$BLFS_ROOT
131
[39da010]132# The book instructions for CA certificates contains downloading
133# instructions, which should not be used here, so:
134if test -f $BUILDDIR$BLFS_ROOT/scripts/*cacerts; then
[4a03ca1]135 sed -i '/URL=/,/^wget/d' $BUILDDIR$BLFS_ROOT/scripts/*cacerts
[39da010]136fi
137
[e576789]138# Generates a list containing download and copying instructions for tarballs
139echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
[39da010]140sed -n -e '/PACKAGE=/,/^fi/p' \
141 -e '/|[ ]*md5sum/p' \
[e576789]142 -e '/PACKAGE1=/,/^fi/p' \
143 -e '/PATCH=/,/^fi/p' \
[bbcdeab]144 -e '/URL=/,/^fi/p' \
[e576789]145 $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
146chmod u+x $BUILDDIR$BLFS_ROOT/download_script
147
148# Downloads (or copy) to build_dir/sources
149pushd $BUILDDIR/sources
150# Remove `unpacked' files if some have been left
151sudo find . -name unpacked -exec rm \{\} \;
152FTP_SERVER=$SERVER/pub/blfs/ SRC_ARCHIVE=$SRC_ARCHIVE $BUILDDIR$BLFS_ROOT/download_script
153popd
154rm -v $BUILDDIR$BLFS_ROOT/download_script
155
156# Suppresses unneeded parts of the scriptlets
[c1626d8]157if [ "$DEP_LIBXSLT" = y ]; then
[cbca63a]158 # libxslt pulls docbook-xsl in, which populates the catalog with annoying
159 # **EDITME** references. Fortunately, those lines are regognizable because
160 # they occur between lines containing '/etc/xml/catalog' at the end of the
161 # line (without '&&'). I have not found a simple way to delete lines
162 # between 2 addresses, excluding either the first or the last one. So use
163 # a loop for accumulating lines and deleting at the end.
164 # Sorry for sed synthax.
[c1626d8]165 sed -i '\@^[[:space:]]*/etc/xml/catalog$@{
166n
167:a
168\@/etc/xml/catalog$@bb
169N
170ba
171:b
172d}' \
173 $BUILDDIR$BLFS_ROOT/scripts/*docbook-xsl
174fi
[e576789]175if [ "$DEP_SUDO" = y ]; then
[cbca63a]176 sed -i '/cat.*pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
[e576789]177fi
178if [ "$DEP_SVN" = y ]; then
179 sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
180fi
181if [ "$DEP_LYNX" = y ]; then
182 if [ "$DEP_OPENSSL" = y -o "$DEP_WGET" = y ]; then
183 sed -i -e 's/configure/& --with-ssl/' \
184 -e '/make$/i echo "#define USE_OPENSSL_INCL 1" >> lynx_cfg.h &&' \
185 $BUILDDIR$BLFS_ROOT/scripts/*lynx
186 fi
187fi
188# At last generates the build Makefile
189mkdir -p $BUILDDIR$BLFS_ROOT/work
190pushd $BUILDDIR$BLFS_ROOT/work
191../gen-makefile.sh
[cbca63a]192# The generated Makefile updates the tracking file after each package
193# installation, using libxslt, which is not installed yet. So move
194# updating to the end of the process, adding an 'update' target
[e576789]195sed -i -e '/xsltproc/,+6d' \
196 -e '/^all/s@$@ update@' \
197 -e 's/touch/@touch/' Makefile
198cat >> Makefile << EOF
199update:
200 @echo Updating the tracking file
201 @for file in *-*; do \\
202 xsltproc --stringparam packages ../packages.xml \\
203 --stringparam package \$\${file##*z-} \\
204 -o track.tmp \\
205 ../xsl/bump.xsl \$(TRACKING_FILE); \\
206 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
207 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
208 rm track.tmp; \\
209 done
210 @touch \$@
211 @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
212 @echo --------------------------------------------------------------------------------\$(WHITE)
213EOF
214popd
215}
Note: See TracBrowser for help on using the repository browser.