1 | #!/bin/bash
|
---|
2 | # $Id$
|
---|
3 | set -e
|
---|
4 |
|
---|
5 | # VT100 colors
|
---|
6 | declare -r BLACK=$'\e[1;30m'
|
---|
7 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
8 |
|
---|
9 | declare -r RED=$'\e[31m'
|
---|
10 | declare -r GREEN=$'\e[32m'
|
---|
11 | declare -r YELLOW=$'\e[33m'
|
---|
12 | declare -r BLUE=$'\e[34m'
|
---|
13 | declare -r MAGENTA=$'\e[35m'
|
---|
14 | declare -r CYAN=$'\e[36m'
|
---|
15 | declare -r WHITE=$'\e[37m'
|
---|
16 |
|
---|
17 | declare -r OFF=$'\e[0m'
|
---|
18 | declare -r BOLD=$'\e[1m'
|
---|
19 | declare -r REVERSE=$'\e[7m'
|
---|
20 | declare -r HIDDEN=$'\e[8m'
|
---|
21 |
|
---|
22 | declare -r tab_=$'\t'
|
---|
23 | declare -r nl_=$'\n'
|
---|
24 |
|
---|
25 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
26 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
27 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
28 |
|
---|
29 | # bold yellow > < pair
|
---|
30 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
31 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
32 |
|
---|
33 | VERBOSITY=1
|
---|
34 |
|
---|
35 | COMMON_DIR="common"
|
---|
36 | BLFS_TOOL='y'
|
---|
37 | BUILDDIR=$(cd ~;pwd)
|
---|
38 | BLFS_ROOT="/blfs_root"
|
---|
39 | TRACKING_DIR="/var/lib/jhalfs/BLFS"
|
---|
40 |
|
---|
41 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
42 |
|
---|
43 | #*******************************************************************#
|
---|
44 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
45 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
46 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
47 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
48 |
|
---|
49 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
50 |
|
---|
51 | # blfs-tool envars
|
---|
52 | BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
---|
53 | case $BLFS_BRANCH_ID in
|
---|
54 | development ) BLFS_TREE=trunk/BOOK ;;
|
---|
55 | branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
|
---|
56 | * ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
---|
57 | esac
|
---|
58 |
|
---|
59 | # Check for build prerequisites.
|
---|
60 | echo
|
---|
61 | check_prerequisites
|
---|
62 | echo "${SD_BORDER}${nl_}"
|
---|
63 |
|
---|
64 | # Install the files
|
---|
65 | [[ $VERBOSITY > 0 ]] && echo -n Populating the ${BUILDDIR}${BLFS_ROOT} directory
|
---|
66 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
|
---|
67 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
68 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
69 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
70 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
71 | [[ $VERBOSITY > 0 ]] && echo "... OK"
|
---|
72 | [[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
|
---|
73 |
|
---|
74 | # Clean-up
|
---|
75 | make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
|
---|
76 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
77 | rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
|
---|
78 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
79 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
80 |
|
---|
81 | # Set some harcoded envars to their proper values
|
---|
82 | sed -i s@tracking-dir@$TRACKING_DIR@ \
|
---|
83 | ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
|
---|
84 | [[ $VERBOSITY > 0 ]] && echo "... OK"
|
---|
85 |
|
---|
86 | [[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)"
|
---|
87 | make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$TRACKING_DIR \
|
---|
88 | $BUILDDIR$BLFS_ROOT/packages.xml
|
---|
89 | [[ $VERBOSITY > 0 ]] && echo "... OK"
|
---|
90 |
|
---|