[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
|
---|
| 41 | if [[ "$-" =~ "e" ]]; then
|
---|
| 42 | echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
| 43 | fi
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | see_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 | #####
|
---|
| 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 | PROGNAME=$(basename $0)
|
---|
| 68 | COMMON_DIR="common"
|
---|
| 69 | VERBOSITY=1
|
---|
[00f4966] | 70 |
|
---|
| 71 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
| 72 | source configuration
|
---|
| 73 | [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
---|
| 74 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 75 |
|
---|
[2fedf49] | 76 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
| 77 | source $COMMON_DIR/func_validate_configs.sh
|
---|
| 78 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
| 79 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
| 80 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
| 81 |
|
---|
| 82 | # Be sure that we have a configuration file
|
---|
[00f4966] | 83 | [[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1
|
---|
| 84 |
|
---|
[2fedf49] | 85 | # Set default book version
|
---|
| 86 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
| 87 |
|
---|
| 88 | # Set the SVN tree
|
---|
| 89 | case $BRANCH_ID in
|
---|
| 90 | dev* | SVN | trunk ) TREE=trunk/BOOK ;;
|
---|
| 91 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
| 92 | echo " Please rerun make and fix the configuration."
|
---|
| 93 | exit 2
|
---|
| 94 | ;;
|
---|
| 95 | branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;;
|
---|
| 96 | * ) TREE=tags/${BRANCH_ID}/BOOK ;;
|
---|
| 97 | esac
|
---|
[00f4966] | 98 |
|
---|
[2fedf49] | 99 | # For consistency with other books
|
---|
| 100 | validate_config
|
---|
| 101 | echo "${SD_BORDER}${nl_}"
|
---|
| 102 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
| 103 | read ANSWER
|
---|
| 104 | if [ x$ANSWER != "xyes" ] ; then
|
---|
| 105 | echo "${nl_}Fix the configuration options and rerun the script.${nl_}"
|
---|
| 106 | exit 1
|
---|
[00f4966] | 107 | fi
|
---|
[2fedf49] | 108 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
[00f4966] | 109 |
|
---|
[2fedf49] | 110 | # Install the files
|
---|
[00f4966] | 111 | [[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT
|
---|
| 112 |
|
---|
| 113 | cp -r BLFS/* $BLFS_ROOT
|
---|
[2fedf49] | 114 | cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT
|
---|
[00f4966] | 115 | # cp -r menu $BLFS_ROOT
|
---|
| 116 |
|
---|
[2fedf49] | 117 | # Start the work
|
---|
[00f4966] | 118 | cd $BLFS_ROOT
|
---|
| 119 |
|
---|
[2fedf49] | 120 | # Clean-up
|
---|
| 121 | rm -rf libs/.svn
|
---|
[480390a] | 122 | #rm -rf menu/.svn
|
---|
| 123 | #rm -rf lxdialog/.svn
|
---|
| 124 |
|
---|
[2fedf49] | 125 |
|
---|
| 126 | # Fix BLFS_XML harcoded values
|
---|
[00f4966] | 127 | sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh
|
---|
| 128 | sed -i 's,blfs-xml,'$BLFS_XML',' libs/book.xsl
|
---|
| 129 |
|
---|
[2fedf49] | 130 | # Fetch book sources and create packages and GNOME/KDE dependencies files
|
---|
| 131 | if [[ -d $BLFS_XML ]] ; then
|
---|
| 132 | ./update_book.sh
|
---|
| 133 | else
|
---|
| 134 | ./update_book.sh $BLFS_XML get $TREE
|
---|
| 135 | fi
|
---|
| 136 |
|
---|
| 137 | # Generate Config.in and run the menuconfig interfaz
|
---|
| 138 | # ./gen_config.sh
|
---|
[00f4966] | 139 | # make
|
---|
| 140 |
|
---|