source: install-blfs-tools.sh@ b9c3497

2.4 ablfs-more legacy new_features trunk
Last change on this file since b9c3497 was 2dd1992, checked in by Pierre Labastie <pierre@…>, 10 years ago

small corrections to install-blfs-tools.sh

  • Property mode set to 100755
File size: 4.0 KB
RevLine 
[e576789]1#!/bin/bash
2# $Id$
3set -e
4
[65d7d46]5: << inline_doc
6Installs a set-up to build BLFS packages.
7You can set these variables:
8TRACKING_DIR : where the installed package file is kept.
9 (default /var/lib/jhalfs/BLFS)
10BLFS_ROOT : where the installed tools will be installed, relative to $HOME.
11 Must start with a '/' (default /blfs_root)
12BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
13 (default development)
14Examples:
151 - If you plan to use the tools to build BLFS on top of LFS, but you did not
16use jhalfs, or forgot to include the jhalfs-blfs tools:
[2dd1992]17(as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
18(as user) ./install-blfs-tools.sh
[65d7d46]192 - To install with only user privileges:
[2dd1992]20TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
[65d7d46]21inline_doc
22
23
[e576789]24# VT100 colors
25declare -r BLACK=$'\e[1;30m'
26declare -r DK_GRAY=$'\e[0;30m'
27
28declare -r RED=$'\e[31m'
29declare -r GREEN=$'\e[32m'
30declare -r YELLOW=$'\e[33m'
31declare -r BLUE=$'\e[34m'
32declare -r MAGENTA=$'\e[35m'
33declare -r CYAN=$'\e[36m'
34declare -r WHITE=$'\e[37m'
35
36declare -r OFF=$'\e[0m'
37declare -r BOLD=$'\e[1m'
38declare -r REVERSE=$'\e[7m'
39declare -r HIDDEN=$'\e[8m'
40
41declare -r tab_=$'\t'
42declare -r nl_=$'\n'
43
44declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
45declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
46declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
47
48# bold yellow > < pair
49declare -r R_arrow=$'\e[1;33m>\e[0m'
50declare -r L_arrow=$'\e[1;33m<\e[0m'
51
52VERBOSITY=1
53
54COMMON_DIR="common"
55BLFS_TOOL='y'
56BUILDDIR=$(cd ~;pwd)
[65d7d46]57BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
58TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
[e576789]59
60[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
61
62#*******************************************************************#
63[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
64source $COMMON_DIR/libs/func_check_version.sh
65[[ $? > 0 ]] && echo " function module did not load.." && exit 2
66[[ $VERBOSITY > 0 ]] && echo "OK"
67
68[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
69
70# blfs-tool envars
71BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
72case $BLFS_BRANCH_ID in
73 development ) BLFS_TREE=trunk/BOOK ;;
74 branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
75 * ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
76esac
77
78# Check for build prerequisites.
79echo
[65d7d46]80 check_alfs_tools
81 check_blfs_tools
[e576789]82echo "${SD_BORDER}${nl_}"
83
84# Install the files
85[[ $VERBOSITY > 0 ]] && echo -n Populating the ${BUILDDIR}${BLFS_ROOT} directory
86[[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
87cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
88cp -r menu ${BUILDDIR}${BLFS_ROOT}
89cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
90cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
91[[ $VERBOSITY > 0 ]] && echo "... OK"
92[[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
93
94# Clean-up
95make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
96rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
97rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
98rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
99rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
[2dd1992]100# We do not want to keep an old version of the book:
101rm -rf ${BUILDDIR}${BLFS_ROOT}/blfs-xml
[e576789]102
103# Set some harcoded envars to their proper values
104sed -i s@tracking-dir@$TRACKING_DIR@ \
105 ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
[65d7d46]106
107# Ensures the tracking directory exists.
108# Throws an error if it does not exist and the user does not
109# have write permission to create it.
110# If it exists, does nothing.
111mkdir -p $TRACKING_DIR
[e576789]112[[ $VERBOSITY > 0 ]] && echo "... OK"
113
114[[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)"
[2dd1992]115make -j1 -C $BUILDDIR$BLFS_ROOT \
116 TRACKING_DIR=$TRACKING_DIR \
117 SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \
118 $BUILDDIR$BLFS_ROOT/packages.xml
[e576789]119[[ $VERBOSITY > 0 ]] && echo "... OK"
120
Note: See TracBrowser for help on using the repository browser.