[25b52e2] | 1 | #!/bin/bash
|
---|
[00f4966] | 2 | # $Id$
|
---|
| 3 |
|
---|
[25b52e2] | 4 | set -e
|
---|
| 5 |
|
---|
[2fedf49] | 6 | # From common/common-functions
|
---|
| 7 | # VT100 colors
|
---|
| 8 | declare -r BLACK=$'\e[1;30m'
|
---|
| 9 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
| 10 |
|
---|
| 11 | declare -r RED=$'\e[31m'
|
---|
| 12 | declare -r GREEN=$'\e[32m'
|
---|
| 13 | declare -r YELLOW=$'\e[33m'
|
---|
| 14 | declare -r BLUE=$'\e[34m'
|
---|
| 15 | declare -r MAGENTA=$'\e[35m'
|
---|
| 16 | declare -r CYAN=$'\e[36m'
|
---|
| 17 | declare -r WHITE=$'\e[37m'
|
---|
| 18 |
|
---|
| 19 | declare -r OFF=$'\e[0m'
|
---|
| 20 | declare -r BOLD=$'\e[1m'
|
---|
| 21 | declare -r REVERSE=$'\e[7m'
|
---|
| 22 | declare -r HIDDEN=$'\e[8m'
|
---|
| 23 |
|
---|
| 24 | declare -r tab_=$'\t'
|
---|
| 25 | declare -r nl_=$'\n'
|
---|
| 26 |
|
---|
| 27 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
| 28 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
| 29 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
| 30 |
|
---|
| 31 | # bold yellow > < pair
|
---|
| 32 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
| 33 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
| 34 |
|
---|
[25b52e2] | 35 |
|
---|
[00f4966] | 36 | #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
---|
| 37 | #-----------------------#
|
---|
| 38 | simple_error() { # Basic error trap.... JUST DIE
|
---|
| 39 | #-----------------------#
|
---|
| 40 | # If +e then disable text output
|
---|
[9c9775f] | 41 | if [[ "$-" =~ e ]]; then
|
---|
[00f4966] | 42 | echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
| 43 | fi
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | see_ya() {
|
---|
[be22162] | 47 | echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\n"
|
---|
[00f4966] | 48 | }
|
---|
| 49 | ##### Simple error TRAPS
|
---|
| 50 | # ctrl-c SIGINT
|
---|
| 51 | # ctrl-y
|
---|
| 52 | # ctrl-z SIGTSTP
|
---|
| 53 | # SIGHUP 1 HANGUP
|
---|
| 54 | # SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
---|
| 55 | # SIGQUIT 3
|
---|
| 56 | # SIGKILL 9 KILL
|
---|
| 57 | # SIGTERM 15 TERMINATION
|
---|
| 58 | # SIGSTOP 17,18,23 STOP THE PROCESS
|
---|
| 59 | #####
|
---|
| 60 | set -e
|
---|
| 61 | trap see_ya 0
|
---|
| 62 | trap simple_error ERR
|
---|
| 63 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
| 64 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
| 65 |
|
---|
[2fedf49] | 66 | # envars not sourced from configuration file
|
---|
| 67 | COMMON_DIR="common"
|
---|
[2b0f8a5] | 68 | VERBOSITY=1
|
---|
[00f4966] | 69 |
|
---|
| 70 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
| 71 | source configuration
|
---|
| 72 | [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
---|
| 73 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 74 |
|
---|
[4abc9ec] | 75 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
[9c9775f] | 76 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
[4abc9ec] | 77 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 78 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 79 |
|
---|
[2fedf49] | 80 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
[9c9775f] | 81 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
[2fedf49] | 82 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 83 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 84 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 85 |
|
---|
| 86 | # Be sure that we have a configuration file
|
---|
[00f4966] | 87 | [[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1
|
---|
| 88 |
|
---|
[2fedf49] | 89 | # Set default book version
|
---|
| 90 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
| 91 |
|
---|
| 92 | # Set the SVN tree
|
---|
| 93 | case $BRANCH_ID in
|
---|
[cfdc0f1] | 94 | development ) TREE=trunk/BOOK ;;
|
---|
| 95 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
| 96 | echo " Please rerun make and fix the configuration."
|
---|
| 97 | exit 2 ;;
|
---|
[9c9775f] | 98 | branch-* ) TREE=branches/${BRANCH_ID#branch-} ;;
|
---|
| 99 | * ) TREE=tags/${BRANCH_ID} ;;
|
---|
[2fedf49] | 100 | esac
|
---|
[00f4966] | 101 |
|
---|
[4abc9ec] | 102 | # Check for minimun dependencies versions
|
---|
| 103 | xsltprocVer=`xsltproc -V | head -n1 `
|
---|
| 104 | libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
|
---|
| 105 | libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
|
---|
| 106 | tidyVer=`tidy -V | cut -d " " -f9`
|
---|
| 107 |
|
---|
| 108 | # Version numbers are packed strings not xx.yy.zz format.
|
---|
| 109 | check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
|
---|
| 110 | check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
|
---|
| 111 | check_version "2004" "${tidyVer}" "TIDY"
|
---|
| 112 |
|
---|
| 113 | XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
| 114 | <?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
|
---|
[9c9775f] | 115 | <!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
|
---|
| 116 | 'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
|
---|
[4abc9ec] | 117 | <article>
|
---|
| 118 | <title>Test file</title>
|
---|
| 119 | <sect1>
|
---|
| 120 | <title>Some title</title>
|
---|
| 121 | <para>Some text</para>
|
---|
| 122 | </sect1>
|
---|
| 123 | </article>"
|
---|
| 124 |
|
---|
| 125 | if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
|
---|
[9c9775f] | 126 | check_version "4.5" "4.5" "DocBook XML DTD"
|
---|
[4abc9ec] | 127 | else
|
---|
[9c9775f] | 128 | echo "Warning: not found a working DocBook XML DTD 4.5 installation"
|
---|
[4abc9ec] | 129 | exit 2
|
---|
| 130 | fi
|
---|
| 131 |
|
---|
[9c9775f] | 132 | # if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
|
---|
| 133 | # check_version "1.69.1" "1.69.1" "DocBook XSL"
|
---|
| 134 | # else
|
---|
| 135 | # echo "Warning: not found a working DocBook XSL 1.69.1 installation"
|
---|
| 136 | # exit 2
|
---|
| 137 | # fi
|
---|
[4abc9ec] | 138 |
|
---|
| 139 | echo "${SD_BORDER}${nl_}"
|
---|
| 140 |
|
---|
[2fedf49] | 141 | # For consistency with other books
|
---|
| 142 | validate_config
|
---|
| 143 | echo "${SD_BORDER}${nl_}"
|
---|
| 144 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
| 145 | read ANSWER
|
---|
| 146 | if [ x$ANSWER != "xyes" ] ; then
|
---|
[2ee1d11] | 147 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
[2fedf49] | 148 | exit 1
|
---|
[00f4966] | 149 | fi
|
---|
[2fedf49] | 150 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
[00f4966] | 151 |
|
---|
[2fedf49] | 152 | # Install the files
|
---|
[00f4966] | 153 | [[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT
|
---|
| 154 |
|
---|
| 155 | cp -r BLFS/* $BLFS_ROOT
|
---|
[e557f50] | 156 | cp -r menu $BLFS_ROOT
|
---|
[2fedf49] | 157 | cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT
|
---|
[e557f50] | 158 | cp README.BLFS $BLFS_ROOT
|
---|
[00f4966] | 159 |
|
---|
[2fedf49] | 160 | # Start the work
|
---|
[00f4966] | 161 | cd $BLFS_ROOT
|
---|
| 162 |
|
---|
[2fedf49] | 163 | # Clean-up
|
---|
| 164 | rm -rf libs/.svn
|
---|
[350c9cb] | 165 | rm -rf menu/.svn
|
---|
[963169f] | 166 | rm -rf menu/lxdialog/.svn
|
---|
[480390a] | 167 |
|
---|
[2fedf49] | 168 |
|
---|
[cac94f6] | 169 | # Set some harcoded envars to their proper values
|
---|
[2d0a2e5] | 170 | sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh libs/book.xsl
|
---|
[bc40917] | 171 | sed -i 's,tracking-dir,'$TRACKING_DIR',' update_book.sh gen-makefile.sh
|
---|
[00f4966] | 172 |
|
---|
[bc40917] | 173 | # Fetch book sources and create packages and meta-packages dependencies files
|
---|
[2fedf49] | 174 | if [[ -d $BLFS_XML ]] ; then
|
---|
| 175 | ./update_book.sh
|
---|
| 176 | else
|
---|
[ecfb828] | 177 | ./update_book.sh get $BLFS_XML $TREE
|
---|
[2fedf49] | 178 | fi
|
---|
| 179 |
|
---|
[1f7e45f] | 180 | # Run the menuconfig interface
|
---|
[9c9775f] | 181 | make -B
|
---|
[00f4966] | 182 |
|
---|