source: common/libs/func_install_blfs@ 4cd2611

2.4
Last change on this file since 4cd2611 was 61b7c59, checked in by Pierre Labastie <pierre@…>, 7 years ago

Typos and remove a now useless instruction

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