6 Installs a set-up to build BLFS packages.
7 You can set these variables:
8 TRACKING_DIR : where the installed package file is kept.
9 (default /var/lib/jhalfs/BLFS)
10 BLFS_ROOT : where the installed tools will be installed, relative to $HOME.
11 Must start with a '/' (default /blfs_root)
12 BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
14 INITSYS : which book do you want? 'sysv' or 'systemd' (default sysv)
16 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
17 use jhalfs, or forgot to include the jhalfs-blfs tools:
18 (as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
19 (as user) INITSYS=<your system> ./install-blfs-tools.sh
20 2 - To install with only user privileges (default to sysv):
21 TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
23 This script can also be called automatically after running make in this
24 directory. The parameters will then be taken from the configuration file.
29 declare -r BLACK
=$
'\e[1;30m'
30 declare -r DK_GRAY
=$
'\e[0;30m'
32 declare -r RED
=$
'\e[31m'
33 declare -r GREEN
=$
'\e[32m'
34 declare -r YELLOW
=$
'\e[33m'
35 declare -r BLUE
=$
'\e[34m'
36 declare -r MAGENTA
=$
'\e[35m'
37 declare -r CYAN
=$
'\e[36m'
38 declare -r WHITE
=$
'\e[37m'
40 declare -r OFF
=$
'\e[0m'
41 declare -r BOLD
=$
'\e[1m'
42 declare -r REVERSE
=$
'\e[7m'
43 declare -r HIDDEN
=$
'\e[8m'
48 declare -r DD_BORDER
="${BOLD}==============================================================================${OFF}"
49 declare -r SD_BORDER
="${BOLD}------------------------------------------------------------------------------${OFF}"
50 declare -r STAR_BORDER
="${BOLD}******************************************************************************${OFF}"
51 declare -r dotSTR
=".................." # Format display of parameters and versions
53 # bold yellow > < pair
54 declare -r R_arrow
=$
'\e[1;33m>\e[0m'
55 declare -r L_arrow
=$
'\e[1;33m<\e[0m'
58 # Take parameters from "configuration" if $1="auto"
59 if [ "$1" = auto
]; then
60 [[ $VERBOSITY > 0 ]] && echo -n "Loading configuration ... "
62 [[ $?
> 0 ]] && echo -e "\nconfiguration could not be loaded" && exit 2
63 [[ $VERBOSITY > 0 ]] && echo "OK"
66 if [ "$BOOK_BLFS" = y
]; then
67 ## Read variables and sanity checks
68 [[ "$relSVN" = y
]] && BLFS_BRANCH_ID
=development
69 [[ "$BRANCH" = y
]] && BLFS_BRANCH_ID
=$BRANCH_ID
70 [[ "$WORKING_COPY" = y
]] && BLFS_BOOK
=$BOOK
71 [[ "$BRANCH_ID" = "**EDIT ME**" ]] &&
72 echo You have not
set the book version or branch
&& exit 1
73 [[ "$BOOK" = "**EDIT ME**" ]] &&
74 echo You have not
set the working copy location
&& exit 1
81 BLFS_ROOT
="${BLFS_ROOT:=/blfs_root}"
82 TRACKING_DIR
="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
83 INITSYS
="${INITSYS:=sysv}"
84 BLFS_BRANCH_ID
=${BLFS_BRANCH_ID:=development}
85 BLFS_XML
=${BLFS_XML:=blfs-xml}
87 # Validate the configuration:
88 PARAMS
="BLFS_ROOT TRACKING_DIR INITSYS BLFS_XML"
89 if [ "$WORKING_COPY" = y
]; then
90 PARAMS
="$PARAMS WORKING_COPY BOOK"
92 PARAMS
="$PARAMS BLFS_BRANCH_ID"
94 # Format for displaying parameters:
95 declare -r PARAM_VALS
='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
97 for config_param
in $PARAMS; do
98 echo -e "`eval echo $PARAM_VALS`"
101 echo "${SD_BORDER}${nl_}"
102 echo -n "Are you happy with these settings? yes/no (no): "
104 if [ x
$ANSWER != "xyes" ] ; then
105 echo "${nl_}Rerun make and fix your settings.${nl_}"
108 [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
110 #*******************************************************************#
111 [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
112 source $COMMON_DIR/libs
/func_check_version.sh
113 [[ $?
> 0 ]] && echo " function module did not load.." && exit 2
114 [[ $VERBOSITY > 0 ]] && echo "OK"
116 [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
118 case $BLFS_BRANCH_ID in
119 development
) BLFS_TREE
=trunk
/BOOK
;;
120 branch-
* ) BLFS_TREE
=branches
/${BLFS_BRANCH_ID#branch-} ;;
121 * ) BLFS_TREE
=tags
/${BLFS_BRANCH_ID} ;;
124 # Check for build prerequisites.
128 echo "${SD_BORDER}${nl_}"
131 [[ $VERBOSITY > 0 ]] && echo -n Populating the
${BUILDDIR}${BLFS_ROOT} directory
132 [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
133 rm -rf ${BUILDDIR}${BLFS_ROOT}/*
134 cp -r BLFS
/* ${BUILDDIR}${BLFS_ROOT}
135 cp -r menu
${BUILDDIR}${BLFS_ROOT}
136 cp $COMMON_DIR/progress_bar.sh
${BUILDDIR}${BLFS_ROOT}
137 cp README.BLFS
${BUILDDIR}${BLFS_ROOT}
138 [[ $VERBOSITY > 0 ]] && echo "... OK"
141 [[ $VERBOSITY > 0 ]] && echo Cleaning the
${BUILDDIR}${BLFS_ROOT} directory
142 make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
143 rm -rf ${BUILDDIR}${BLFS_ROOT}/libs
/.svn
144 rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl
/.svn
145 rm -rf ${BUILDDIR}${BLFS_ROOT}/menu
/.svn
146 rm -rf ${BUILDDIR}${BLFS_ROOT}/menu
/lxdialog
/.svn
147 # We do not want to keep an old version of the book:
148 rm -rf ${BUILDDIR}${BLFS_ROOT}/$BLFS_XML
150 # Set some harcoded envars to their proper values
151 sed -i s@tracking-dir@
$TRACKING_DIR@ \
152 ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
154 # Ensures the tracking directory exists.
155 # Throws an error if it does not exist and the user does not
156 # have write permission to create it.
157 # If it exists, does nothing.
158 mkdir
-p $TRACKING_DIR
159 [[ $VERBOSITY > 0 ]] && echo "... OK"
161 [[ $VERBOSITY > 0 ]] &&
162 echo "Retrieving and validating the book (may take some time)"
164 [[ -z "$BLFS_BOOK" ]] ||
165 [[ $BLFS_BOOK = $BUILDDIR$BLFS_ROOT/$BLFS_XML ]] ||
166 cp -a $BLFS_BOOK $BUILDDIR$BLFS_ROOT/$BLFS_XML
168 make -j1 -C $BUILDDIR$BLFS_ROOT \
169 TRACKING_DIR
=$TRACKING_DIR \
171 BLFS_XML
=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
172 SVN
=svn
://svn.linuxfromscratch.org
/BLFS
/$BLFS_TREE \
173 $BUILDDIR$BLFS_ROOT/packages.xml
174 [[ $VERBOSITY > 0 ]] && echo "... OK"