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