source: common/libs/func_install_blfs@ 970f2dc

ablfs
Last change on this file since 970f2dc was 5573313, checked in by Pierre Labastie <pierre@…>, 13 years ago

Add comments to BLFS/Makefile
Use /bin/echo to write the initial instpkg.xml. Hopefully, the behavior
of /bin/echo is independant on the shell
Add a sudo to a sed in finc_install_blfs (needed in some cases)

  • Property mode set to 100644
File size: 4.5 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
8# Install the files
9[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
10cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
11cp -r menu ${BUILDDIR}${BLFS_ROOT}
12cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
13cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
14
15# Clean-up
16make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
17rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
18rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
19rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
20rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
21
22# Set some harcoded envars to their proper values
23sed -i s@tracking-dir@$TRACKING_DIR@ \
24 ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
25
26# Downloads the book, initialize the tracking file and the package database
27# sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs
28# has to be created
29sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
30 $BUILDDIR$BLFS_ROOT/packages.xml
31
32# Because the BLFS Makefile is supposed to be used in chroot (or booted)
33# mode, the tracking file has wrong path for DTD. Change it:
34sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
35
36# Manually build a 'configuration' file
37if [ "$DEP_LIBXML" = y ]; then
38 LINE_LIBXML='CONFIG_libxml2=y'
39else
40 LINE_LIBXML='#CONFIG_libxml2 is not set'
41fi
42if [ "$DEP_LIBXSLT" = y ]; then
43 LINE_LIBXSLT='CONFIG_libxslt=y'
44else
45 LINE_LIBXSLT='#CONFIG_libxslt is not set'
46fi
47if [ "$DEP_TIDY" = y ]; then
48 LINE_TIDY='CONFIG_html-tidy=y'
49else
50 LINE_TIDY='#CONFIG_html-tidy is not set'
51fi
52if [ "$DEP_DBXML" = y ]; then
53 LINE_DBXML='CONFIG_DocBook=y'
54else
55 LINE_DBXML='#CONFIG_DocBook is not set'
56fi
57if [ "$DEP_LYNX" = y ]; then
58 LINE_LYNX='CONFIG_lynx=y'
59else
60 LINE_LYNX='#CONFIG_lynx is not set'
61fi
62if [ "$DEP_SUDO" = y ]; then
63 LINE_SUDO='CONFIG_sudo=y'
64else
65 LINE_SUDO='#CONFIG_sudo is not set'
66fi
67if [ "$DEP_WGET" = y ]; then
68 LINE_WGET='CONFIG_wget=y'
69else
70 LINE_WGET='#CONFIG_wget is not set'
71fi
72if [ "$DEP_GPM" = y ]; then
73 LINE_GPM='CONFIG_gpm=y'
74else
75 LINE_GPM='#CONFIG_gpm is not set'
76fi
77if [ "$DEP_SVN" = y ]; then
78 LINE_SVN='CONFIG_subversion=y'
79else
80 LINE_SVN='#CONFIG_subversion is not set'
81fi
82
83cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
84$LINE_LIBXML
85$LINE_LIBXSLT
86$LINE_WGET
87$LINE_TIDY
88$LINE_DBXML
89$LINE_SVN
90$LINE_GPM
91$LINE_LYNX
92$LINE_SUDO
93MAIL_SERVER=sendmail
94optDependency=2
95SUDO=n
96EOF
97
98# Generates the scripts for the blfs tools dependencies (in ./scripts)
99yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
100
101# Move the scriptlets where they should be
102rm -rf $BUILDDIR$BLFS_ROOT/scripts
103mv scripts $BUILDDIR$BLFS_ROOT
104
105# Generates a list containing download and copying instructions for tarballs
106echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
107sed -n -e '/PACKAGE=/,/md5sum/p' \
108 -e '/PACKAGE1=/,/^fi/p' \
109 -e '/PATCH=/,/^fi/p' \
110 -e '/URL=/,/unpacked/p' \
111 $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
112chmod u+x $BUILDDIR$BLFS_ROOT/download_script
113
114# Downloads (or copy) to build_dir/sources
115pushd $BUILDDIR/sources
116FTP_SERVER=$SERVER/pub/blfs/ SRC_ARCHIVE=$SRC_ARCHIVE $BUILDDIR$BLFS_ROOT/download_script
117# The blfs-bootscripts package is at the wrong location
118mkdir -p blfs-bootscripts
119mv blfs-bootscripts*tar* blfs-bootscripts
120popd
121rm -v $BUILDDIR$BLFS_ROOT/download_script
122
123# Suppresses unneeded parts of the scriptlets
124if [ "$DEP_WGET" = y ]; then
125 sed -i s'/-ssl=.*/out-ssl/' $BUILDDIR$BLFS_ROOT/scripts/*wget
126fi
127if [ "$DEP_SUDO" = y ]; then
128 sed -i '/pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
129fi
130if [ "$DEP_SVN" = y ]; then
131 sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
132fi
133
134# At last generates the build Makefile
135mkdir -p $BUILDDIR$BLFS_ROOT/work
136pushd $BUILDDIR$BLFS_ROOT/work
137../gen-makefile.sh
138sed -i -e '/xsltproc/,+6d' \
139 -e '/^all/s@$@ update@' \
140 -e 's/touch/@touch/' Makefile
141cat >> Makefile << EOF
142update:
143 @echo Updating the tracking file
144 @for file in *-*; do \\
145 xsltproc --stringparam packages ../packages.xml \\
146 --stringparam package \$\${file##*z-} \\
147 -o track.tmp \\
148 ../xsl/bump.xsl \$(TRACKING_FILE); \\
149 sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
150 xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
151 rm track.tmp; \\
152 done
153 @touch \$@
154 @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
155 @echo --------------------------------------------------------------------------------\$(WHITE)
156EOF
157popd
158}
Note: See TracBrowser for help on using the repository browser.