2006-05-18 20:41:43 +02:00
|
|
|
#!/bin/bash
|
2006-08-13 16:38:12 +02:00
|
|
|
# $Id$
|
|
|
|
|
2006-05-18 20:41:43 +02:00
|
|
|
set -e
|
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# From common/common-functions
|
|
|
|
# VT100 colors
|
|
|
|
declare -r BLACK=$'\e[1;30m'
|
|
|
|
declare -r DK_GRAY=$'\e[0;30m'
|
|
|
|
|
|
|
|
declare -r RED=$'\e[31m'
|
|
|
|
declare -r GREEN=$'\e[32m'
|
|
|
|
declare -r YELLOW=$'\e[33m'
|
|
|
|
declare -r BLUE=$'\e[34m'
|
|
|
|
declare -r MAGENTA=$'\e[35m'
|
|
|
|
declare -r CYAN=$'\e[36m'
|
|
|
|
declare -r WHITE=$'\e[37m'
|
|
|
|
|
|
|
|
declare -r OFF=$'\e[0m'
|
|
|
|
declare -r BOLD=$'\e[1m'
|
|
|
|
declare -r REVERSE=$'\e[7m'
|
|
|
|
declare -r HIDDEN=$'\e[8m'
|
|
|
|
|
|
|
|
declare -r tab_=$'\t'
|
|
|
|
declare -r nl_=$'\n'
|
|
|
|
|
|
|
|
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
|
|
|
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
|
|
|
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
|
|
|
|
|
|
|
# bold yellow > < pair
|
|
|
|
declare -r R_arrow=$'\e[1;33m>\e[0m'
|
|
|
|
declare -r L_arrow=$'\e[1;33m<\e[0m'
|
|
|
|
|
2006-05-18 20:41:43 +02:00
|
|
|
|
2006-08-13 16:38:12 +02:00
|
|
|
#>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
|
|
|
#-----------------------#
|
|
|
|
simple_error() { # Basic error trap.... JUST DIE
|
|
|
|
#-----------------------#
|
|
|
|
# If +e then disable text output
|
2006-10-24 04:49:37 +02:00
|
|
|
if [[ "$-" =~ e ]]; then
|
2006-08-13 16:38:12 +02:00
|
|
|
echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
see_ya() {
|
2007-08-30 19:41:40 +02:00
|
|
|
echo -e "\n${L_arrow}${BOLD}jhalfs branch-2.3.x${R_arrow} exit${OFF}\n"
|
2006-08-13 16:38:12 +02:00
|
|
|
}
|
|
|
|
##### Simple error TRAPS
|
|
|
|
# ctrl-c SIGINT
|
|
|
|
# ctrl-y
|
|
|
|
# ctrl-z SIGTSTP
|
|
|
|
# SIGHUP 1 HANGUP
|
|
|
|
# SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
|
|
|
# SIGQUIT 3
|
|
|
|
# SIGKILL 9 KILL
|
|
|
|
# SIGTERM 15 TERMINATION
|
|
|
|
# SIGSTOP 17,18,23 STOP THE PROCESS
|
|
|
|
#####
|
|
|
|
set -e
|
|
|
|
trap see_ya 0
|
|
|
|
trap simple_error ERR
|
|
|
|
trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
|
|
|
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# envars not sourced from configuration file
|
|
|
|
COMMON_DIR="common"
|
2006-08-29 20:16:27 +02:00
|
|
|
VERBOSITY=1
|
2006-08-13 16:38:12 +02:00
|
|
|
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
|
|
|
source configuration
|
|
|
|
[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
2006-11-11 18:21:38 +01:00
|
|
|
source $COMMON_DIR/libs/func_check_version.sh
|
2006-10-02 21:32:06 +02:00
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
2006-11-11 18:21:38 +01:00
|
|
|
source $COMMON_DIR/libs/func_validate_configs.sh
|
2006-08-14 22:19:15 +02:00
|
|
|
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
|
|
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
# Be sure that we have a configuration file
|
2006-08-13 16:38:12 +02:00
|
|
|
[[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1
|
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# Set default book version
|
|
|
|
BRANCH_ID=${BRANCH_ID:=development}
|
|
|
|
|
|
|
|
# Set the SVN tree
|
|
|
|
case $BRANCH_ID in
|
2006-08-29 20:18:06 +02:00
|
|
|
development ) TREE=trunk/BOOK ;;
|
|
|
|
*EDIT* ) echo " You forgot to set the branch or stable book version."
|
|
|
|
echo " Please rerun make and fix the configuration."
|
|
|
|
exit 2 ;;
|
2007-02-15 20:33:25 +01:00
|
|
|
branch-* ) TREE=branches/${BRANCH_ID#branch-} ;;
|
|
|
|
* ) TREE=tags/${BRANCH_ID} ;;
|
2006-08-14 22:19:15 +02:00
|
|
|
esac
|
2006-08-13 16:38:12 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
# Check for minimun dependencies versions
|
|
|
|
xsltprocVer=`xsltproc -V | head -n1 `
|
|
|
|
libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
|
|
|
|
libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
|
|
|
|
tidyVer=`tidy -V | cut -d " " -f9`
|
|
|
|
|
|
|
|
# Version numbers are packed strings not xx.yy.zz format.
|
|
|
|
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
|
|
|
|
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
|
|
|
|
check_version "2004" "${tidyVer}" "TIDY"
|
|
|
|
|
|
|
|
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
|
|
|
|
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
|
2007-04-13 21:26:35 +02:00
|
|
|
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
|
|
|
|
'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd'>
|
2006-10-02 21:32:06 +02:00
|
|
|
<article>
|
|
|
|
<title>Test file</title>
|
|
|
|
<sect1>
|
|
|
|
<title>Some title</title>
|
|
|
|
<para>Some text</para>
|
|
|
|
</sect1>
|
|
|
|
</article>"
|
|
|
|
|
|
|
|
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
|
2007-04-13 21:26:35 +02:00
|
|
|
check_version "4.5" "4.5" "DocBook XML DTD"
|
2006-10-02 21:32:06 +02:00
|
|
|
else
|
2007-04-13 21:26:35 +02:00
|
|
|
echo "Warning: not found a working DocBook XML DTD 4.5 installation"
|
2006-10-02 21:32:06 +02:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2007-07-24 23:14:48 +02:00
|
|
|
# if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
|
|
|
|
# check_version "1.69.1" "1.69.1" "DocBook XSL"
|
|
|
|
# else
|
|
|
|
# echo "Warning: not found a working DocBook XSL 1.69.1 installation"
|
|
|
|
# exit 2
|
|
|
|
# fi
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# For consistency with other books
|
|
|
|
validate_config
|
|
|
|
echo "${SD_BORDER}${nl_}"
|
|
|
|
echo -n "Are you happy with these settings? yes/no (no): "
|
|
|
|
read ANSWER
|
|
|
|
if [ x$ANSWER != "xyes" ] ; then
|
2006-10-07 20:53:15 +02:00
|
|
|
echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
2006-08-14 22:19:15 +02:00
|
|
|
exit 1
|
2006-08-13 16:38:12 +02:00
|
|
|
fi
|
2006-08-14 22:19:15 +02:00
|
|
|
echo "${nl_}${SD_BORDER}${nl_}"
|
2006-08-13 16:38:12 +02:00
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# Install the files
|
2006-08-13 16:38:12 +02:00
|
|
|
[[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT
|
|
|
|
|
|
|
|
cp -r BLFS/* $BLFS_ROOT
|
2006-08-24 22:38:22 +02:00
|
|
|
cp -r menu $BLFS_ROOT
|
2006-08-14 22:19:15 +02:00
|
|
|
cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT
|
2006-08-24 22:38:22 +02:00
|
|
|
cp README.BLFS $BLFS_ROOT
|
2006-08-13 16:38:12 +02:00
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# Start the work
|
2006-08-13 16:38:12 +02:00
|
|
|
cd $BLFS_ROOT
|
|
|
|
|
2006-08-14 22:19:15 +02:00
|
|
|
# Clean-up
|
|
|
|
rm -rf libs/.svn
|
2006-08-24 22:38:22 +02:00
|
|
|
rm -rf menu/.svn
|
|
|
|
rm -rf menu/lxdialog/.svn
|
2006-08-14 22:19:15 +02:00
|
|
|
|
2006-08-13 16:38:12 +02:00
|
|
|
|
2006-08-24 22:38:22 +02:00
|
|
|
# Set some harcoded envars to their proper values
|
|
|
|
sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh libs/book.xsl
|
|
|
|
sed -i 's,tracking-dir,'$TRACKING_DIR',' update_book.sh gen-makefile.sh
|
|
|
|
|
|
|
|
# Fetch book sources and create packages and meta-packages dependencies files
|
2006-08-14 22:19:15 +02:00
|
|
|
if [[ -d $BLFS_XML ]] ; then
|
|
|
|
./update_book.sh
|
|
|
|
else
|
2006-08-24 22:38:22 +02:00
|
|
|
./update_book.sh get $BLFS_XML $TREE
|
2006-08-14 22:19:15 +02:00
|
|
|
fi
|
|
|
|
|
2006-08-24 22:38:22 +02:00
|
|
|
# Run the menuconfig interface
|
2007-07-06 02:59:01 +02:00
|
|
|
make -B
|
2006-08-13 16:38:12 +02:00
|
|
|
|