source: common/libs/func_install_blfs@ 1e686d1

ablfs-more legacy trunk
Last change on this file since 1e686d1 was ea0be93, checked in by Pierre Labastie <pierre@…>, 4 years ago

Now that tcl, expect, and dejagnu are only in lfs, update instpkg.xml
with those packages after installing lfs, or when updating lfs

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