source: common/libs/func_install_blfs@ 532ede6

2.4 ablfs-more legacy new_features trunk
Last change on this file since 532ede6 was 382b083, checked in by Pierre Labastie <pierre@…>, 11 years ago

Changes in func_install_blfs:

  • Add --preserve-timestamps when copying the local BLFS book working copy so that if the book has already been validated it is not validated again
  • Some scriptlet changes are not needed anymore
  • Property mode set to 100644
File size: 5.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 \
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
43sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
44 $BUILDDIR$BLFS_ROOT/packages.xml
45
46# Because the BLFS Makefile is supposed to be used in chroot (or booted)
47# mode, the tracking file has wrong path for DTD. Change it:
48sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
49
50# Manually build a 'configuration' file
51if [ "$DEP_LIBXML" = y ]; then
52 LINE_LIBXML='CONFIG_libxml2=y'
53else
54 LINE_LIBXML='#CONFIG_libxml2 is not set'
55fi
56if [ "$DEP_LIBXSLT" = y ]; then
57 LINE_LIBXSLT='CONFIG_libxslt=y'
58else
59 LINE_LIBXSLT='#CONFIG_libxslt is not set'
60fi
61if [ "$DEP_TIDY" = y ]; then
62 LINE_TIDY='CONFIG_html-tidy=y'
63else
64 LINE_TIDY='#CONFIG_html-tidy is not set'
65fi
66if [ "$DEP_DBXML" = y ]; then
67 LINE_DBXML='CONFIG_DocBook=y'
68else
69 LINE_DBXML='#CONFIG_DocBook is not set'
70fi
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
108$LINE_PYTHON
109$LINE_LIBXML
110$LINE_LIBXSLT
111$LINE_TIDY
112$LINE_DBXML
113$LINE_OPENSSL
114$LINE_WGET
115$LINE_SVN
116$LINE_GPM
117$LINE_LYNX
118$LINE_SUDO
119MAIL_SERVER=sendmail
120optDependency=2
121SUDO=n
122EOF
123
124# Generates the scripts for the blfs tools dependencies (in ./scripts)
125yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
126
127# Move the scriptlets where they should be
128sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
129mv scripts $BUILDDIR$BLFS_ROOT
130
131# Generates a list containing download and copying instructions for tarballs
132echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
133sed -n -e '/PACKAGE=/,/md5sum/p' \
134 -e '/PACKAGE1=/,/^fi/p' \
135 -e '/PATCH=/,/^fi/p' \
[bbcdeab]136 -e '/URL=/,/^fi/p' \
[e576789]137 $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
138chmod u+x $BUILDDIR$BLFS_ROOT/download_script
139
140# Downloads (or copy) to build_dir/sources
141pushd $BUILDDIR/sources
142# Remove `unpacked' files if some have been left
143sudo find . -name unpacked -exec rm \{\} \;
144FTP_SERVER=$SERVER/pub/blfs/ SRC_ARCHIVE=$SRC_ARCHIVE $BUILDDIR$BLFS_ROOT/download_script
145popd
146rm -v $BUILDDIR$BLFS_ROOT/download_script
147
148# Suppresses unneeded parts of the scriptlets
149if [ "$DEP_SUDO" = y ]; then
150 sed -i '/pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
151fi
152if [ "$DEP_SVN" = y ]; then
153 sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
154fi
155if [ "$DEP_LYNX" = y ]; then
156 if [ "$DEP_OPENSSL" = y -o "$DEP_WGET" = y ]; then
157 sed -i -e 's/configure/& --with-ssl/' \
158 -e '/make$/i echo "#define USE_OPENSSL_INCL 1" >> lynx_cfg.h &&' \
159 $BUILDDIR$BLFS_ROOT/scripts/*lynx
160 fi
161fi
162# At last generates the build Makefile
163mkdir -p $BUILDDIR$BLFS_ROOT/work
164pushd $BUILDDIR$BLFS_ROOT/work
165../gen-makefile.sh
166sed -i -e '/xsltproc/,+6d' \
167 -e '/^all/s@$@ update@' \
168 -e 's/touch/@touch/' Makefile
169cat >> Makefile << EOF
170update:
171 @echo Updating the tracking file
172 @for file in *-*; do \\
173 xsltproc --stringparam packages ../packages.xml \\
174 --stringparam package \$\${file##*z-} \\
175 -o track.tmp \\
176 ../xsl/bump.xsl \$(TRACKING_FILE); \\
177 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
178 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
179 rm track.tmp; \\
180 done
181 @touch \$@
182 @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
183 @echo --------------------------------------------------------------------------------\$(WHITE)
184EOF
185popd
186}
Note: See TracBrowser for help on using the repository browser.