source: install-blfs-tools.sh@ 89cb93b

ablfs
Last change on this file since 89cb93b was f3fb6ce, checked in by Pierre Labastie <pierre@…>, 13 years ago

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

  • Property mode set to 100755
File size: 2.8 KB
RevLine 
[f3fb6ce]1#!/bin/bash
2# $Id$
3set -e
4
5# VT100 colors
6declare -r BLACK=$'\e[1;30m'
7declare -r DK_GRAY=$'\e[0;30m'
8
9declare -r RED=$'\e[31m'
10declare -r GREEN=$'\e[32m'
11declare -r YELLOW=$'\e[33m'
12declare -r BLUE=$'\e[34m'
13declare -r MAGENTA=$'\e[35m'
14declare -r CYAN=$'\e[36m'
15declare -r WHITE=$'\e[37m'
16
17declare -r OFF=$'\e[0m'
18declare -r BOLD=$'\e[1m'
19declare -r REVERSE=$'\e[7m'
20declare -r HIDDEN=$'\e[8m'
21
22declare -r tab_=$'\t'
23declare -r nl_=$'\n'
24
25declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
26declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
27declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
28
29# bold yellow > < pair
30declare -r R_arrow=$'\e[1;33m>\e[0m'
31declare -r L_arrow=$'\e[1;33m<\e[0m'
32
33VERBOSITY=1
34
35COMMON_DIR="common"
36BLFS_TOOL='y'
37BUILDDIR=$(cd ~;pwd)
38BLFS_ROOT="/blfs_root"
39TRACKING_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>..."
45source $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
52BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
53case $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} ;;
57esac
58
59# Check for build prerequisites.
60echo
61 check_prerequisites
62echo "${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}
67cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
68cp -r menu ${BUILDDIR}${BLFS_ROOT}
69cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
70cp 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
75make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
76rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
77rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
78rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
79rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
80
81# Set some harcoded envars to their proper values
82sed -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)"
87make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$TRACKING_DIR \
88 $BUILDDIR$BLFS_ROOT/packages.xml
89[[ $VERBOSITY > 0 ]] && echo "... OK"
90
Note: See TracBrowser for help on using the repository browser.