source: common/libs/func_install_blfs@ 506120ee

ablfs-more legacy trunk
Last change on this file since 506120ee was 340c27e, checked in by Pierre Labastie <pierre@…>, 7 years ago

common/libs/func_install_blfs:
Honour-variables-set-in-jhalfs

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