[e576789] | 1 | #!/bin/bash
|
---|
| 2 | # $Id$
|
---|
| 3 | set -e
|
---|
| 4 |
|
---|
[65d7d46] | 5 | : << inline_doc
|
---|
| 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)
|
---|
| 13 | (default development)
|
---|
| 14 | Examples:
|
---|
| 15 | 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
|
---|
| 16 | use 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] | 19 | 2 - To install with only user privileges:
|
---|
[2dd1992] | 20 | TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
|
---|
[65d7d46] | 21 | inline_doc
|
---|
| 22 |
|
---|
| 23 |
|
---|
[e576789] | 24 | # VT100 colors
|
---|
| 25 | declare -r BLACK=$'\e[1;30m'
|
---|
| 26 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
| 27 |
|
---|
| 28 | declare -r RED=$'\e[31m'
|
---|
| 29 | declare -r GREEN=$'\e[32m'
|
---|
| 30 | declare -r YELLOW=$'\e[33m'
|
---|
| 31 | declare -r BLUE=$'\e[34m'
|
---|
| 32 | declare -r MAGENTA=$'\e[35m'
|
---|
| 33 | declare -r CYAN=$'\e[36m'
|
---|
| 34 | declare -r WHITE=$'\e[37m'
|
---|
| 35 |
|
---|
| 36 | declare -r OFF=$'\e[0m'
|
---|
| 37 | declare -r BOLD=$'\e[1m'
|
---|
| 38 | declare -r REVERSE=$'\e[7m'
|
---|
| 39 | declare -r HIDDEN=$'\e[8m'
|
---|
| 40 |
|
---|
| 41 | declare -r tab_=$'\t'
|
---|
| 42 | declare -r nl_=$'\n'
|
---|
| 43 |
|
---|
| 44 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
| 45 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
| 46 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
| 47 |
|
---|
| 48 | # bold yellow > < pair
|
---|
| 49 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
| 50 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
| 51 |
|
---|
| 52 | VERBOSITY=1
|
---|
| 53 |
|
---|
| 54 | COMMON_DIR="common"
|
---|
| 55 | BLFS_TOOL='y'
|
---|
| 56 | BUILDDIR=$(cd ~;pwd)
|
---|
[65d7d46] | 57 | BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
|
---|
| 58 | TRACKING_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>..."
|
---|
| 64 | source $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
|
---|
| 71 | BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
---|
| 72 | case $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} ;;
|
---|
| 76 | esac
|
---|
| 77 |
|
---|
| 78 | # Check for build prerequisites.
|
---|
[66f8df0] | 79 | declare -r dotSTR=".................." # needed for proper display of versions
|
---|
[e576789] | 80 | echo
|
---|
[65d7d46] | 81 | check_alfs_tools
|
---|
| 82 | check_blfs_tools
|
---|
[e576789] | 83 | echo "${SD_BORDER}${nl_}"
|
---|
| 84 |
|
---|
| 85 | # Install the files
|
---|
| 86 | [[ $VERBOSITY > 0 ]] && echo -n Populating the ${BUILDDIR}${BLFS_ROOT} directory
|
---|
| 87 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
|
---|
| 88 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
| 89 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
| 90 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
| 91 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
| 92 | [[ $VERBOSITY > 0 ]] && echo "... OK"
|
---|
| 93 | [[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
|
---|
| 94 |
|
---|
| 95 | # Clean-up
|
---|
| 96 | make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
|
---|
| 97 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
| 98 | rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
|
---|
| 99 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
| 100 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
[2dd1992] | 101 | # We do not want to keep an old version of the book:
|
---|
| 102 | rm -rf ${BUILDDIR}${BLFS_ROOT}/blfs-xml
|
---|
[e576789] | 103 |
|
---|
| 104 | # Set some harcoded envars to their proper values
|
---|
| 105 | sed -i s@tracking-dir@$TRACKING_DIR@ \
|
---|
| 106 | ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
|
---|
[65d7d46] | 107 |
|
---|
| 108 | # Ensures the tracking directory exists.
|
---|
| 109 | # Throws an error if it does not exist and the user does not
|
---|
| 110 | # have write permission to create it.
|
---|
| 111 | # If it exists, does nothing.
|
---|
| 112 | mkdir -p $TRACKING_DIR
|
---|
[e576789] | 113 | [[ $VERBOSITY > 0 ]] && echo "... OK"
|
---|
| 114 |
|
---|
| 115 | [[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)"
|
---|
[2dd1992] | 116 | make -j1 -C $BUILDDIR$BLFS_ROOT \
|
---|
| 117 | TRACKING_DIR=$TRACKING_DIR \
|
---|
| 118 | SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \
|
---|
| 119 | $BUILDDIR$BLFS_ROOT/packages.xml
|
---|
[e576789] | 120 | [[ $VERBOSITY > 0 ]] && echo "... OK"
|
---|
| 121 |
|
---|