source: blfs-tool@ 3c5ca23

experimental
Last change on this file since 3c5ca23 was cfdc0f1, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Started blfs-tool support.

  • Property mode set to 100755
File size: 3.7 KB
RevLine 
[25b52e2]1#!/bin/bash
[00f4966]2# $Id$
3
[25b52e2]4set -e
5
[2fedf49]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
[25b52e2]35
[00f4966]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() {
[9e627f6]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#####
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
[2fedf49]66# envars not sourced from configuration file
67COMMON_DIR="common"
[2b0f8a5]68VERBOSITY=1
[00f4966]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
[2fedf49]75[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
76source $COMMON_DIR/func_validate_configs.sh
77[[ $? > 0 ]] && echo " function module did not load.." && exit 2
78[[ $VERBOSITY > 0 ]] && echo "OK"
79[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
80
81# Be sure that we have a configuration file
[00f4966]82[[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1
83
[2fedf49]84# Set default book version
85BRANCH_ID=${BRANCH_ID:=development}
86
87# Set the SVN tree
88case $BRANCH_ID in
[cfdc0f1]89 development ) TREE=trunk/BOOK ;;
90 *EDIT* ) echo " You forgot to set the branch or stable book version."
91 echo " Please rerun make and fix the configuration."
92 exit 2 ;;
93 branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;;
94 * ) TREE=tags/${BRANCH_ID}/BOOK ;;
[2fedf49]95esac
[00f4966]96
[2fedf49]97# For consistency with other books
98validate_config
99echo "${SD_BORDER}${nl_}"
100echo -n "Are you happy with these settings? yes/no (no): "
101read ANSWER
102if [ x$ANSWER != "xyes" ] ; then
103 echo "${nl_}Fix the configuration options and rerun the script.${nl_}"
104 exit 1
[00f4966]105fi
[2fedf49]106echo "${nl_}${SD_BORDER}${nl_}"
[00f4966]107
[2fedf49]108# Install the files
[00f4966]109[[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT
110
111cp -r BLFS/* $BLFS_ROOT
[e557f50]112cp -r menu $BLFS_ROOT
[2fedf49]113cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT
[e557f50]114cp README.BLFS $BLFS_ROOT
[00f4966]115
[2fedf49]116# Start the work
[00f4966]117cd $BLFS_ROOT
118
[2fedf49]119# Clean-up
120rm -rf libs/.svn
[350c9cb]121rm -rf menu/.svn
[963169f]122rm -rf menu/lxdialog/.svn
[480390a]123
[2fedf49]124
[cac94f6]125# Set some harcoded envars to their proper values
[2d0a2e5]126sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh libs/book.xsl
[bc40917]127sed -i 's,tracking-dir,'$TRACKING_DIR',' update_book.sh gen-makefile.sh
[00f4966]128
[bc40917]129# Fetch book sources and create packages and meta-packages dependencies files
[2fedf49]130if [[ -d $BLFS_XML ]] ; then
131 ./update_book.sh
132else
[ecfb828]133 ./update_book.sh get $BLFS_XML $TREE
[2fedf49]134fi
135
[1f7e45f]136# Run the menuconfig interface
137make
[00f4966]138
Note: See TracBrowser for help on using the repository browser.