source: common/libs/func_install_blfs@ 78d4779

2.4 ablfs-more legacy trunk
Last change on this file since 78d4779 was 78d4779, checked in by Pierre Labastie <pierre@…>, 8 years ago

Tidy is not needed anymore for BLFS tools.

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