1 | #!/bin/bash
|
---|
2 | # $Id$
|
---|
3 |
|
---|
4 | set -e
|
---|
5 |
|
---|
6 |
|
---|
7 | #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
---|
8 | #-----------------------#
|
---|
9 | simple_error() { # Basic error trap.... JUST DIE
|
---|
10 | #-----------------------#
|
---|
11 | # If +e then disable text output
|
---|
12 | if [[ "$-" =~ "e" ]]; then
|
---|
13 | echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
14 | fi
|
---|
15 | }
|
---|
16 |
|
---|
17 | see_ya() {
|
---|
18 | echo -e "\n\t${BOLD}Goodbye and thank you for choosing ${L_arrow}jhalfs${R_arrow}\n"
|
---|
19 | }
|
---|
20 | ##### Simple error TRAPS
|
---|
21 | # ctrl-c SIGINT
|
---|
22 | # ctrl-y
|
---|
23 | # ctrl-z SIGTSTP
|
---|
24 | # SIGHUP 1 HANGUP
|
---|
25 | # SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
---|
26 | # SIGQUIT 3
|
---|
27 | # SIGKILL 9 KILL
|
---|
28 | # SIGTERM 15 TERMINATION
|
---|
29 | # SIGSTOP 17,18,23 STOP THE PROCESS
|
---|
30 | #####
|
---|
31 | set -e
|
---|
32 | trap see_ya 0
|
---|
33 | trap simple_error ERR
|
---|
34 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
35 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
36 |
|
---|
37 | VERBOSITY=1
|
---|
38 |
|
---|
39 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
40 | source configuration
|
---|
41 | [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
|
---|
42 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
43 |
|
---|
44 | [[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1
|
---|
45 |
|
---|
46 | TREE=trunk/BOOK
|
---|
47 |
|
---|
48 | if [[ ! -z ${BRANCH_ID} ]]; then
|
---|
49 | case $BRANCH_ID in
|
---|
50 | dev* | SVN | trunk ) TREE=trunk/BOOK ;;
|
---|
51 | branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;;
|
---|
52 | * ) TREE=tags/${BRANCH_ID}/BOOK ;;
|
---|
53 | esac
|
---|
54 | fi
|
---|
55 |
|
---|
56 | [[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT
|
---|
57 |
|
---|
58 | cp -r BLFS/* $BLFS_ROOT
|
---|
59 | cp common/progress_bar.sh $BLFS_ROOT
|
---|
60 | # cp -r menu $BLFS_ROOT
|
---|
61 |
|
---|
62 | cd $BLFS_ROOT
|
---|
63 |
|
---|
64 | sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh
|
---|
65 | sed -i 's,blfs-xml,'$BLFS_XML',' libs/book.xsl
|
---|
66 |
|
---|
67 | ./update_book.sh $BLFS_XML get $TREE
|
---|
68 | # make
|
---|
69 |
|
---|