source: common/libs/func_install_blfs@ f769d1f

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

Fix installation of BLFS tools for recent book instructions

  • Property mode set to 100644
File size: 7.0 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
[c785566]48sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
49 REV=$INITSYS \
50 TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
51 $BUILDDIR$BLFS_ROOT/packages.xml
[e576789]52
53# Because the BLFS Makefile is supposed to be used in chroot (or booted)
54# mode, the tracking file has wrong path for DTD. Change it:
55sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
56
57# Manually build a 'configuration' file
58if [ "$DEP_LIBXML" = y ]; then
59 LINE_LIBXML='CONFIG_libxml2=y'
60else
61 LINE_LIBXML='#CONFIG_libxml2 is not set'
62fi
63if [ "$DEP_LIBXSLT" = y ]; then
64 LINE_LIBXSLT='CONFIG_libxslt=y'
65else
66 LINE_LIBXSLT='#CONFIG_libxslt is not set'
67fi
[c1626d8]68# DocBook is a rec dep of libxslt
69# if [ "$DEP_DBXML" = y ]; then
70# LINE_DBXML='CONFIG_DocBook=y'
71# else
72# LINE_DBXML='#CONFIG_DocBook is not set'
73# fi
[e576789]74if [ "$DEP_LYNX" = y ]; then
75 LINE_LYNX='CONFIG_lynx=y'
76else
77 LINE_LYNX='#CONFIG_lynx is not set'
78fi
79if [ "$DEP_SUDO" = y ]; then
80 LINE_SUDO='CONFIG_sudo=y'
81else
82 LINE_SUDO='#CONFIG_sudo is not set'
83fi
84if [ "$DEP_WGET" = y ]; then
85 LINE_WGET='CONFIG_wget=y'
86else
87 LINE_WGET='#CONFIG_wget is not set'
88fi
89if [ "$DEP_GPM" = y ]; then
90 LINE_GPM='CONFIG_gpm=y'
91else
92 LINE_GPM='#CONFIG_gpm is not set'
93fi
94if [ "$DEP_SVN" = y ]; then
95 LINE_SVN='CONFIG_subversion=y'
96else
97 LINE_SVN='#CONFIG_subversion is not set'
98fi
99if [ "$DEP_OPENSSL" = y ]; then
100 LINE_OPENSSL='CONFIG_openssl=y'
101else
102 LINE_OPENSSL='#CONFIG_openssl is not set'
103fi
104if [ "$DEP_PYTHON" = y ]; then
105 LINE_PYTHON='CONFIG_python2=y'
106else
107 LINE_PYTHON='#CONFIG_python2 is not set'
108fi
109
110cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
[1f25a75]111$LINE_OPENSSL
[e576789]112$LINE_PYTHON
113$LINE_LIBXML
114$LINE_LIBXSLT
115$LINE_WGET
116$LINE_SVN
117$LINE_GPM
118$LINE_LYNX
119$LINE_SUDO
120MAIL_SERVER=sendmail
121optDependency=2
122SUDO=n
[316db229]123WRAP_INSTALL=$WRAP_INSTALL
[e576789]124EOF
125
126# Generates the scripts for the blfs tools dependencies (in ./scripts)
127yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
128
129# Move the scriptlets where they should be
130sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
131mv scripts $BUILDDIR$BLFS_ROOT
132
133# Generates a list containing download and copying instructions for tarballs
134echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
[39da010]135sed -n -e '/PACKAGE=/,/^fi/p' \
136 -e '/|[ ]*md5sum/p' \
[e576789]137 -e '/PACKAGE1=/,/^fi/p' \
138 -e '/PATCH=/,/^fi/p' \
[bbcdeab]139 -e '/URL=/,/^fi/p' \
[e576789]140 $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
141chmod u+x $BUILDDIR$BLFS_ROOT/download_script
142
143# Downloads (or copy) to build_dir/sources
144pushd $BUILDDIR/sources
145# Remove `unpacked' files if some have been left
146sudo find . -name unpacked -exec rm \{\} \;
[f769d1f]147if [ "$GETPKG" = "y" ]; then
148 FTP_SERVER=$SERVER/pub/blfs/ \
149 SRC_ARCHIVE=$SRC_ARCHIVE \
150 $BUILDDIR$BLFS_ROOT/download_script
151else # Save the download script in case the user wants to run it later
152 cp $BUILDDIR$BLFS_ROOT/download_script .
153fi
[e576789]154popd
155rm -v $BUILDDIR$BLFS_ROOT/download_script
156
157# Suppresses unneeded parts of the scriptlets
[c1626d8]158if [ "$DEP_LIBXSLT" = y ]; then
[cbca63a]159 # libxslt pulls docbook-xsl in, which populates the catalog with annoying
160 # **EDITME** references. Fortunately, those lines are regognizable because
161 # they occur between lines containing '/etc/xml/catalog' at the end of the
162 # line (without '&&'). I have not found a simple way to delete lines
163 # between 2 addresses, excluding either the first or the last one. So use
164 # a loop for accumulating lines and deleting at the end.
165 # Sorry for sed synthax.
[c1626d8]166 sed -i '\@^[[:space:]]*/etc/xml/catalog$@{
167n
168:a
169\@/etc/xml/catalog$@bb
170N
171ba
172:b
173d}' \
174 $BUILDDIR$BLFS_ROOT/scripts/*docbook-xsl
175fi
[e576789]176if [ "$DEP_SUDO" = y ]; then
[cbca63a]177 sed -i '/cat.*pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
[e576789]178fi
179if [ "$DEP_SVN" = y ]; then
180 sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
181fi
182if [ "$DEP_LYNX" = y ]; then
183 if [ "$DEP_OPENSSL" = y -o "$DEP_WGET" = y ]; then
[f769d1f]184 sed -e 's/configure/& --with-ssl/' \
185 -i $BUILDDIR$BLFS_ROOT/scripts/*lynx
[e576789]186 fi
187fi
[f769d1f]188# The book instructions for CA certificates suppose that the cerdata.txt
189# file is in the same directory as make-ca.sh-<version>. This is not the
190# case with our default instructions. Just remove the "cd $UNPACKDIR" here.
191if test -f $BUILDDIR$BLFS_ROOT/scripts/*cacerts; then
192 sed -i '/cd \$UNPACKDIR/d' $BUILDDIR$BLFS_ROOT/scripts/*cacerts
193fi
[e576789]194# At last generates the build Makefile
195mkdir -p $BUILDDIR$BLFS_ROOT/work
196pushd $BUILDDIR$BLFS_ROOT/work
197../gen-makefile.sh
[cbca63a]198# The generated Makefile updates the tracking file after each package
199# installation, using libxslt, which is not installed yet. So move
200# updating to the end of the process, adding an 'update' target
[e576789]201sed -i -e '/xsltproc/,+6d' \
202 -e '/^all/s@$@ update@' \
203 -e 's/touch/@touch/' Makefile
204cat >> Makefile << EOF
205update:
206 @echo Updating the tracking file
207 @for file in *-*; do \\
208 xsltproc --stringparam packages ../packages.xml \\
209 --stringparam package \$\${file##*z-} \\
210 -o track.tmp \\
211 ../xsl/bump.xsl \$(TRACKING_FILE); \\
212 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
213 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
214 rm track.tmp; \\
215 done
216 @touch \$@
217 @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
218 @echo --------------------------------------------------------------------------------\$(WHITE)
219EOF
220popd
221}
Note: See TracBrowser for help on using the repository browser.