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