source: common/libs/func_install_blfs@ 26e6739

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

Add a forgotten switch REV=$INITSYS to the make command in BLFS tools,
so that the systemd revision be used when the LFS revision is systemd

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