[3c10176] | 1 | #!/bin/bash
|
---|
| 2 | #####
|
---|
| 3 | #
|
---|
| 4 | # Parse the XML documents to create a 'package' book
|
---|
| 5 | #
|
---|
| 6 | # $Id$
|
---|
| 7 | #####
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | #----------------------------#
|
---|
| 11 | generate_TARGET_xml() { #
|
---|
| 12 | #----------------------------#
|
---|
| 13 | : <<inline_doc
|
---|
| 14 | function: Generate the XML document for the TARGET package
|
---|
| 15 | input vars: nothing
|
---|
| 16 | externals: vars: TARGET
|
---|
| 17 | modifies: nothing
|
---|
| 18 | returns: nothing
|
---|
| 19 | output: file: $TARGET-index.xml
|
---|
| 20 | on error: nothing
|
---|
| 21 | on success: nothing
|
---|
| 22 | inline_doc
|
---|
| 23 |
|
---|
| 24 | local
|
---|
[249874a] | 25 | echo -en "\n\tGenerating $TARGET-index.xml ..."
|
---|
[3c10176] | 26 |
|
---|
| 27 | #---------------------
|
---|
| 28 | # Header to $TARGET-index.xml
|
---|
| 29 | {
|
---|
| 30 | cat << EOF
|
---|
| 31 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[16938b0] | 32 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 33 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
|
---|
[3c10176] | 34 |
|
---|
| 35 | <book>
|
---|
| 36 |
|
---|
| 37 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/book/bookinfo.xml"/>
|
---|
| 38 |
|
---|
| 39 | <preface>
|
---|
| 40 | <?dbhtml filename="preface.html" dir="preface"?>
|
---|
| 41 |
|
---|
| 42 | <title>Preface</title>
|
---|
| 43 |
|
---|
| 44 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/locale-issues.xml"/>
|
---|
| 45 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/bootscripts.xml"/>
|
---|
| 46 |
|
---|
| 47 | </preface>
|
---|
| 48 |
|
---|
| 49 | <chapter>
|
---|
| 50 | <?dbhtml filename="chapter.html" dir="installing"?>
|
---|
| 51 |
|
---|
| 52 | <title>Installing $TARGET in Dependencies Build Order</title>
|
---|
| 53 |
|
---|
| 54 | EOF
|
---|
| 55 | } > $TARGET-index.xml
|
---|
| 56 |
|
---|
| 57 | #---------------------
|
---|
| 58 | # Dump $TARGET-index.xml.tmp in reverse order.
|
---|
| 59 | tac $TARGET-index.xml.tmp >> $TARGET-index.xml
|
---|
| 60 | rm $TARGET-index.xml.tmp
|
---|
| 61 |
|
---|
| 62 | #---------------------
|
---|
| 63 | # Footer of $TARGET-index.xml
|
---|
| 64 | {
|
---|
| 65 | cat << EOF
|
---|
| 66 |
|
---|
| 67 | </chapter>
|
---|
| 68 |
|
---|
| 69 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/creat-comm.xml"/>
|
---|
| 70 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/ac-free-lic.xml"/>
|
---|
| 71 |
|
---|
| 72 | <index/>
|
---|
| 73 |
|
---|
| 74 | </book>
|
---|
| 75 |
|
---|
| 76 | EOF
|
---|
| 77 | } >> $TARGET-index.xml
|
---|
| 78 |
|
---|
| 79 | echo "done"
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | #-------------------------#
|
---|
| 84 | generate_target_book() { #
|
---|
| 85 | #-------------------------#
|
---|
| 86 | : <<inline_doc
|
---|
| 87 | function: Create an HTML document of the requested TARGET.
|
---|
| 88 | input vars: nothing
|
---|
| 89 | externals: vars: TARGET
|
---|
| 90 | BLFS_XML
|
---|
| 91 | MAIL_SERVER
|
---|
| 92 | X11
|
---|
| 93 | modifies: nothing
|
---|
| 94 | returns: nothing
|
---|
| 95 | output: file: NUMEROUS FILES
|
---|
| 96 | on error: nothing
|
---|
| 97 | on success: nothing
|
---|
| 98 | inline_doc
|
---|
| 99 |
|
---|
| 100 | local filename # output filename
|
---|
[249874a] | 101 | echo -en "\n\tGenerating <$TARGET> HTML book from <$BLFS_XML> xml files ..."
|
---|
[3c10176] | 102 | xsltproc --xinclude --nonet \
|
---|
| 103 | --stringparam mail_server $MAIL_SERVER \
|
---|
| 104 | --stringparam xwindow $X11 \
|
---|
| 105 | --stringparam base.dir HTML/ \
|
---|
| 106 | ../libs/book.xsl \
|
---|
| 107 | $TARGET-index.xml > xsltproc.log 2>&1
|
---|
| 108 | mkdir HTML/{stylesheets,images}
|
---|
[76d58bc] | 109 | cp ../$BLFS_XML/stylesheets/lfs-xsl/*.css HTML/stylesheets
|
---|
[3c10176] | 110 | cp ../$BLFS_XML/images/*.png HTML/images
|
---|
| 111 | cd HTML
|
---|
| 112 | sed -i -e "s@../stylesheets@stylesheets@g" *.html
|
---|
| 113 | sed -i -e "s@../images@images@g" *.html
|
---|
| 114 | for filename in `find . -name "*.html"` ; do
|
---|
| 115 | tidy -config ../../$BLFS_XML/tidy.conf $filename || true
|
---|
| 116 | sh ../../$BLFS_XML/obfuscate.sh $filename
|
---|
| 117 | sed -i -e "s@text/html@application/xhtml+xml@g" $filename
|
---|
| 118 | done
|
---|
| 119 | cd ..
|
---|
| 120 | echo "done"
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | #-------------------------#
|
---|
| 125 | create_build_scripts() { #
|
---|
| 126 | #-------------------------#
|
---|
| 127 | : <<inline_doc
|
---|
| 128 | function: Create shell scripts of the requested TARGET.
|
---|
[c0bc66d] | 129 | input vars: $1 use sudo n/y
|
---|
[3c10176] | 130 | externals: TARGET
|
---|
| 131 | modifies: nothing
|
---|
| 132 | returns: nothing
|
---|
| 133 | output: file: NUMEROUS FILES
|
---|
| 134 | on error: nothing
|
---|
| 135 | on success: nothing
|
---|
| 136 | inline_doc
|
---|
| 137 |
|
---|
| 138 | # Log separator
|
---|
| 139 | echo -e "\n\tScripts generation depuration and errors:\n" >> xsltproc.log
|
---|
| 140 |
|
---|
[249874a] | 141 | echo -en "\n\tGenerating the build scripts ..."
|
---|
[3c10176] | 142 | xsltproc --xinclude --nonet \
|
---|
[c0bc66d] | 143 | --stringparam sudo $SUDO \
|
---|
[3c10176] | 144 | -o ./scripts/ ../libs/scripts.xsl \
|
---|
| 145 | $TARGET-index.xml >> xsltproc.log 2>&1
|
---|
| 146 | # Make the scripts executable.
|
---|
| 147 | chmod -R +x scripts
|
---|
[f4ed135] | 148 | cd ..
|
---|
| 149 | echo -e "done\n"
|
---|
[3c10176] | 150 |
|
---|
| 151 | }
|
---|