Add a script to install the blfs tools to an already running system

This commit is contained in:
Pierre Labastie 2012-03-22 21:04:08 +00:00
parent dcb29a9834
commit f3fb6ce378
2 changed files with 102 additions and 2 deletions

View file

@ -13,7 +13,7 @@ $Id$
change based on what dependencies will be used, etc.
That being said, the goal of the blfs-tool is to help you solve package
dependencies, create build scripts and a Makefile. Few of the auto-generated
dependencies, create build scripts and a Makefile. Not all the auto-generated
build scripts and Makefile will work "as is", thus, as a general rule,
you will need to review and edit the scripts while reading the book.
@ -61,6 +61,7 @@ $Id$
3.2 BLFS_TOOL INSTALLATION::
3.2.1 Normal install
The tools are installed just after the building of xLFS, if the
appropriate options have been selected in the building menu, as per
jhalfs README. If you forgot to select the options and xLFS has been
@ -98,7 +99,16 @@ $Id$
database and the tracking file.
envars.conf envars needed when running the target build scripts
Several files are generated during the process:
3.2.2 Install to an already running LFS/BLFS system
If you forgot to install the tools when building xLFS, or want to try
the tools, you can just run the install-blfs-tools.sh script. It will
create the above hierarchy in your home directory and intialize the
tracking file. You have first to make sure that the tracking dir exists
and is writable by the user. You may also populate it with (empty) files
whose names are of the form package-version, for installed packages, so
that they are included into the tracking file.
3.3.3 Working files
Several files are generated during the process:
packages.xml auto-generated packages database
Config.in input file for the menu driven choices

90
install-blfs-tools.sh Executable file
View file

@ -0,0 +1,90 @@
#!/bin/bash
# $Id$
set -e
# VT100 colors
declare -r BLACK=$'\e[1;30m'
declare -r DK_GRAY=$'\e[0;30m'
declare -r RED=$'\e[31m'
declare -r GREEN=$'\e[32m'
declare -r YELLOW=$'\e[33m'
declare -r BLUE=$'\e[34m'
declare -r MAGENTA=$'\e[35m'
declare -r CYAN=$'\e[36m'
declare -r WHITE=$'\e[37m'
declare -r OFF=$'\e[0m'
declare -r BOLD=$'\e[1m'
declare -r REVERSE=$'\e[7m'
declare -r HIDDEN=$'\e[8m'
declare -r tab_=$'\t'
declare -r nl_=$'\n'
declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
# bold yellow > < pair
declare -r R_arrow=$'\e[1;33m>\e[0m'
declare -r L_arrow=$'\e[1;33m<\e[0m'
VERBOSITY=1
COMMON_DIR="common"
BLFS_TOOL='y'
BUILDDIR=$(cd ~;pwd)
BLFS_ROOT="/blfs_root"
TRACKING_DIR="/var/lib/jhalfs/BLFS"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
#*******************************************************************#
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
source $COMMON_DIR/libs/func_check_version.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
# blfs-tool envars
BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
case $BLFS_BRANCH_ID in
development ) BLFS_TREE=trunk/BOOK ;;
branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
* ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
esac
# Check for build prerequisites.
echo
check_prerequisites
echo "${SD_BORDER}${nl_}"
# Install the files
[[ $VERBOSITY > 0 ]] && echo -n Populating the ${BUILDDIR}${BLFS_ROOT} directory
[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
cp -r menu ${BUILDDIR}${BLFS_ROOT}
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
[[ $VERBOSITY > 0 ]] && echo "... OK"
[[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
# Clean-up
make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
# Set some harcoded envars to their proper values
sed -i s@tracking-dir@$TRACKING_DIR@ \
${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
[[ $VERBOSITY > 0 ]] && echo "... OK"
[[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)"
make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$TRACKING_DIR \
$BUILDDIR$BLFS_ROOT/packages.xml
[[ $VERBOSITY > 0 ]] && echo "... OK"