source: blfs-tool@ c1e07c3

2.0
Last change on this file since c1e07c3 was c1e07c3, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Fixed version string.

  • Property mode set to 100755
File size: 5.3 KB
RevLine 
[8419a04]1#!/bin/bash
[d3ce173]2# $Id$
3
[8419a04]4set -e
5
[c59f9a0]6# From common/common-functions
7# VT100 colors
8declare -r BLACK=$'\e[1;30m'
9declare -r DK_GRAY=$'\e[0;30m'
10
11declare -r RED=$'\e[31m'
12declare -r GREEN=$'\e[32m'
13declare -r YELLOW=$'\e[33m'
14declare -r BLUE=$'\e[34m'
15declare -r MAGENTA=$'\e[35m'
16declare -r CYAN=$'\e[36m'
17declare -r WHITE=$'\e[37m'
18
19declare -r OFF=$'\e[0m'
20declare -r BOLD=$'\e[1m'
21declare -r REVERSE=$'\e[7m'
22declare -r HIDDEN=$'\e[8m'
23
24declare -r tab_=$'\t'
25declare -r nl_=$'\n'
26
27declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
28declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
29declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
30
31# bold yellow > < pair
32declare -r R_arrow=$'\e[1;33m>\e[0m'
33declare -r L_arrow=$'\e[1;33m<\e[0m'
34
[8419a04]35
[d3ce173]36#>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
37#-----------------------#
38simple_error() { # Basic error trap.... JUST DIE
39#-----------------------#
40 # If +e then disable text output
41 if [[ "$-" =~ "e" ]]; then
42 echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
43 fi
44}
45
46see_ya() {
[c1e07c3]47 echo -e "\n${L_arrow}${BOLD}jhalfs 2.0${R_arrow} exit${OFF}\n"
[d3ce173]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#####
60set -e
61trap see_ya 0
62trap simple_error ERR
63trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
64#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
65
[c59f9a0]66# envars not sourced from configuration file
67COMMON_DIR="common"
[4da2512]68VERBOSITY=1
[d3ce173]69
70[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
71source configuration
72[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
73[[ $VERBOSITY > 0 ]] && echo "OK"
74
[045b2dc]75[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
76source $COMMON_DIR/func_check_version.sh
77[[ $? > 0 ]] && echo " function module did not load.." && exit 2
78[[ $VERBOSITY > 0 ]] && echo "OK"
79
[c59f9a0]80[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
81source $COMMON_DIR/func_validate_configs.sh
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
[d3ce173]87[[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1
88
[c59f9a0]89# Set default book version
90BRANCH_ID=${BRANCH_ID:=development}
91
92# Set the SVN tree
93case $BRANCH_ID in
[4965fa8]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 ;;
98 branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;;
99 * ) TREE=tags/${BRANCH_ID}/BOOK ;;
[c59f9a0]100esac
[d3ce173]101
[045b2dc]102# Check for minimun dependencies versions
103xsltprocVer=`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.
109check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
110check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
111check_version "2004" "${tidyVer}" "TIDY"
112
113XML_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'?>
115<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
116 'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
117<article>
118 <title>Test file</title>
119 <sect1>
120 <title>Some title</title>
121 <para>Some text</para>
122 </sect1>
123</article>"
124
125if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
126 check_version "4.4" "4.4" "DocBook XML DTD"
127else
128 echo "Warning: not found a working DocBook XML DTD 4.4 installation"
129 exit 2
130fi
131
132if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
133 check_version "1.69.1" "1.69.1" "DocBook XSL"
134else
135 echo "Warning: not found a working DocBook XSL 1.69.1 installation"
136 exit 2
137fi
138
139echo "${SD_BORDER}${nl_}"
140
[c59f9a0]141# For consistency with other books
142validate_config
143echo "${SD_BORDER}${nl_}"
144echo -n "Are you happy with these settings? yes/no (no): "
145read ANSWER
146if [ x$ANSWER != "xyes" ] ; then
[8b61744]147 echo "${nl_}Rerun make to fix the configuration options.${nl_}"
[c59f9a0]148 exit 1
[d3ce173]149fi
[c59f9a0]150echo "${nl_}${SD_BORDER}${nl_}"
[d3ce173]151
[c59f9a0]152# Install the files
[d3ce173]153[[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT
154
155cp -r BLFS/* $BLFS_ROOT
[f4ed135]156cp -r menu $BLFS_ROOT
[c59f9a0]157cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT
[f4ed135]158cp README.BLFS $BLFS_ROOT
[d3ce173]159
[c59f9a0]160# Start the work
[d3ce173]161cd $BLFS_ROOT
162
[c59f9a0]163# Clean-up
164rm -rf libs/.svn
[f4ed135]165rm -rf menu/.svn
166rm -rf menu/lxdialog/.svn
[c59f9a0]167
[d3ce173]168
[f4ed135]169# Set some harcoded envars to their proper values
170sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh libs/book.xsl
171sed -i 's,tracking-dir,'$TRACKING_DIR',' update_book.sh gen-makefile.sh
172
173# Fetch book sources and create packages and meta-packages dependencies files
[c59f9a0]174if [[ -d $BLFS_XML ]] ; then
175 ./update_book.sh
176else
[f4ed135]177 ./update_book.sh get $BLFS_XML $TREE
[c59f9a0]178fi
179
[f4ed135]180# Run the menuconfig interface
181make
[d3ce173]182
Note: See TracBrowser for help on using the repository browser.