source: common/libs/func_install_blfs@ 90f5b6d

ablfs-more legacy trunk
Last change on this file since 90f5b6d was 90f5b6d, checked in by Pierre Labastie <pierre@…>, 5 years ago

Remove obsolete blfs_tools dependencies

  • Property mode set to 100644
File size: 8.1 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} ]] && {
11 sudo mkdir -pv ${BUILDDIR}${BLFS_ROOT}
12 sudo chown $USER:$USER ${BUILDDIR}${BLFS_ROOT}
13}
14cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
15cp -r menu ${BUILDDIR}${BLFS_ROOT}
16cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
17cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
18if [ "$WRAP_INSTALL" = y ]; then
19 sed -e 's/PKGDIR/JH_UNPACKDIR/' \
20 -e 's/PKG_DEST/JH_PKG_DIR/' \
21 $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
22fi
23
24# Clean-up
25make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
26rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
27rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
28rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
29rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
30
31# Set some harcoded envars to their proper values
32sed -i s@tracking-dir@$TRACKING_DIR@ \
33 ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
34sed -i s@trunk/BOOK@$BLFS_TREE@ \
35 ${BUILDDIR}${BLFS_ROOT}/Makefile
36
37# If we have a working copy, copy it:
38if [[ "$BLFS_WORKING_COPY" = "y" ]]; then
39echo "copying the local BLFS working copy (may take some time)"
40# -r: recursive; -u: only if newer; -T: otherwise, would copy to a subdirectory
41# of blfs-xml, if blfs-xml already exists; --preserve=timestamps: if the local
42# book has already been validated, tmp is posterior to the others, and
43# validation will not be done again.
44 cp -ruT --preserve=timestamps $BLFS_WC_LOCATION \
45 ${BUILDDIR}${BLFS_ROOT}/$BLFS_XML
46fi
47
48# Copy the LFS book. Note that now, the book is downloaded before running
49# the BLFS tools.
50cp -ruT --preserve=timestamps $BOOK \
51 ${BUILDDIR}${BLFS_ROOT}/$LFS_XML
52
53# Downloads the book if necessary, initialize the tracking file and the
54# package database.
55# sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs
56# has to be created
57sudo make -j1 -C $BUILDDIR$BLFS_ROOT \
58 REV=$INITSYS \
59 TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
60 LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML \
61 LFS-SVN=$SVN_2/LFS/$TREE \
62 BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
63 SVN=$SVN_2/BLFS/$BLFS_TREE \
64 $BUILDDIR$BLFS_ROOT/packages.xml
65
66# Because the BLFS Makefile is supposed to be used in chroot (or booted)
67# mode, the tracking file has wrong path for DTD. Change it:
68sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
69
70# Manually build a 'configuration' file
71if [ "$DEP_LIBXML" = y ]; then
72 LINE_LIBXML='CONFIG_libxml2=y'
73else
74 LINE_LIBXML='#CONFIG_libxml2 is not set'
75fi
76if [ "$DEP_LIBXSLT" = y ]; then
77 LINE_LIBXSLT='CONFIG_libxslt=y'
78else
79 LINE_LIBXSLT='#CONFIG_libxslt is not set'
80fi
81# DocBook is a rec dep of libxslt
82# if [ "$DEP_DBXML" = y ]; then
83# LINE_DBXML='CONFIG_DocBook=y'
84# else
85# LINE_DBXML='#CONFIG_DocBook is not set'
86# fi
87if [ "$DEP_LYNX" = y ]; then
88 LINE_LYNX='CONFIG_lynx=y'
89else
90 LINE_LYNX='#CONFIG_lynx is not set'
91fi
92if [ "$DEP_SUDO" = y ]; then
93 LINE_SUDO='CONFIG_sudo=y'
94else
95 LINE_SUDO='#CONFIG_sudo is not set'
96fi
97if [ "$DEP_WGET" = y ]; then
98 LINE_WGET='CONFIG_wget=y'
99else
100 LINE_WGET='#CONFIG_wget is not set'
101fi
102if [ "$DEP_GPM" = y ]; then
103 LINE_GPM='CONFIG_gpm=y'
104else
105 LINE_GPM='#CONFIG_gpm is not set'
106fi
107if [ "$DEP_SVN" = y ]; then
108 LINE_SVN='CONFIG_subversion=y'
109else
110 LINE_SVN='#CONFIG_subversion is not set'
111fi
112
113cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
114$LINE_LIBXML
115$LINE_LIBXSLT
116$LINE_WGET
117$LINE_SVN
118$LINE_GPM
119$LINE_LYNX
120$LINE_SUDO
121MAIL_SERVER=sendmail
122optDependency=2
123SUDO=n
124LANGUAGE=$LANG
125WRAP_INSTALL=$WRAP_INSTALL
126DEL_LA_FILES=$DEL_LA_FILES
127STATS=n
128EOF
129
130# Generates the scripts for the blfs tools dependencies (in ./scripts)
131yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
132
133# Move the scriptlets where they should be
134sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
135mv scripts $BUILDDIR$BLFS_ROOT
136
137# Generates a list containing download and copying instructions for tarballs
138echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
139sed -n -e '/PACKAGE=/,/^fi/{/^fi/a\
140cp $PACKAGE $JH_SRC_ARCHIVE
141p}' \
142 -e '/|[ ]*md5sum/p' \
143 -e '/PACKAGE1=/,/^fi/{/^fi/a\
144cp $PACKAGE1 $JH_SRC_ARCHIVE
145p}' \
146 -e '/PATCH=/,/^fi/{/^fi/a\
147cp $PATCH $JH_SRC_ARCHIVE
148p}' \
149 -e '/URL=/,/^fi/{/^fi/a\
150cp $BOOTPACKG $JH_SRC_ARCHIVE
151p}' \
152 $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
153chmod u+x $BUILDDIR$BLFS_ROOT/download_script
154
155# Downloads (or copy) to build_dir/sources
156pushd $BUILDDIR/sources
157# Remove `unpacked' files if some have been left
158sudo find . -name unpacked -exec rm \{\} \;
159if [ "$GETPKG" = "y" ]; then
160 JH_FTP_SERVER=$SERVER/pub/blfs/ \
161 JH_SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \
162 $BUILDDIR$BLFS_ROOT/download_script
163else # Save the download script in case the user wants to run it later
164 cp $BUILDDIR$BLFS_ROOT/download_script .
165fi
166popd
167rm -v $BUILDDIR$BLFS_ROOT/download_script
168
169# Suppresses unneeded parts of the scriptlets
170if [ "$DEP_LIBXSLT" = y ]; then
171 # libxslt pulls docbook-xsl in, which populates the catalog with annoying
172 # **EDITME** references. Fortunately, those lines are regognizable because
173 # they occur between lines containing '/etc/xml/catalog' at the end of the
174 # line (without '&&'). I have not found a simple way to delete lines
175 # between 2 addresses, excluding either the first or the last one. So use
176 # a loop for accumulating lines and deleting at the end.
177 # Sorry for sed syntax.
178 sed -i '\@^[[:space:]]*/etc/xml/catalog$@{
179n
180:a
181\@/etc/xml/catalog$@bb
182N
183ba
184:b
185d}' \
186 $BUILDDIR$BLFS_ROOT/scripts/*docbook-xsl
187fi
188if [ "$DEP_SUDO" = y ]; then
189 sed -i '/cat.*pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
190fi
191if [ "$DEP_SVN" = y ]; then
192 sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
193fi
194# At last generates the build Makefile
195mkdir -p $BUILDDIR$BLFS_ROOT/work
196pushd $BUILDDIR$BLFS_ROOT/work
197../gen-makefile.sh
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
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 pack in \$\$(grep '<productname' ../$LFS_XML/tmp/lfs-full.xml | \\
208 sed 's/.*>\([^<]*\)<.*/\1/' | \\
209 sort | uniq); do \\
210 if [ "x\$\$pack" = xtcl -o \\
211 "x\$\$pack" = xexpect -o \\
212 "x\$\$pack" = xdejagnu ]; then continue; \\
213 fi; \\
214 VERSION=\$\$(grep -A1 ">\$\$pack</product" \\
215 ../$LFS_XML/tmp/lfs-full.xml | \\
216 head -n2| \\
217 sed -n '2s/.*>\([^<]*\)<.*/\1/p'); \\
218 xsltproc --stringparam packages ../packages.xml \\
219 --stringparam package \$\$pack \\
220 --stringparam version \$\$VERSION \\
221 -o track.tmp \\
222 ../xsl/bump.xsl \$(TRACKING_FILE); \\
223 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
224 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
225 rm track.tmp; \\
226 done; \\
227 VERSION=\$\$(grep 'echo.*lfs-release' ../$LFS_XML/tmp/lfs-full.xml | \\
228 sed 's/.*echo[ ]*\([^ ]*\).*/\1/'); \\
229 xsltproc --stringparam packages ../packages.xml \\
230 --stringparam package LFS-Release \\
231 --stringparam version \$\$VERSION \\
232 -o track.tmp \\
233 ../xsl/bump.xsl \$(TRACKING_FILE); \\
234 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
235 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
236 rm track.tmp; \\
237 for file in *-*; do \\
238 xsltproc --stringparam packages ../packages.xml \\
239 --stringparam package \$\${file##*z-} \\
240 -o track.tmp \\
241 ../xsl/bump.xsl \$(TRACKING_FILE); \\
242 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
243 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
244 rm track.tmp; \\
245 done
246 @touch \$@
247 @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
248 @echo --------------------------------------------------------------------------------\$(WHITE)
249EOF
250popd
251}
Note: See TracBrowser for help on using the repository browser.