[877cc6a] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
[4da2512] | 5 | set -e
|
---|
[877cc6a] | 6 |
|
---|
| 7 |
|
---|
| 8 | no_empty_builddir() {
|
---|
| 9 | 'clear'
|
---|
| 10 | cat <<- -EOF-
|
---|
| 11 | ${DD_BORDER}
|
---|
| 12 |
|
---|
| 13 | ${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
|
---|
| 14 | Looks like the \$BUILDDIR directory contains subdirectories
|
---|
| 15 | from a previous HLFS build.
|
---|
| 16 |
|
---|
| 17 | Please format the partition mounted on \$BUILDDIR or set
|
---|
[73e5448] | 18 | a different build directory before running jhalfs.
|
---|
[877cc6a] | 19 | ${OFF}
|
---|
| 20 | ${DD_BORDER}
|
---|
| 21 | -EOF-
|
---|
| 22 | exit
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | #----------------------------#
|
---|
[261eea6] | 27 | run_make() { #
|
---|
[877cc6a] | 28 | #----------------------------#
|
---|
| 29 | # Test if make must be run.
|
---|
[401f81e] | 30 | if [ "$RUNMAKE" = "y" ] ; then
|
---|
[fe30c61] | 31 | # Test to make sure we're not running the build as root
|
---|
[045b2dc] | 32 | if [ "$UID" = "0" ] ; then
|
---|
| 33 | echo "You must not be logged in as root to build the system."
|
---|
[877cc6a] | 34 | exit 1
|
---|
| 35 | fi
|
---|
| 36 | # Build the system
|
---|
| 37 | if [ -e $MKFILE ] ; then
|
---|
| 38 | echo -ne "Building the system...\n"
|
---|
[a167246] | 39 | cd $JHALFSDIR && make
|
---|
[877cc6a] | 40 | echo -ne "done\n"
|
---|
| 41 | fi
|
---|
| 42 | fi
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | #----------------------------#
|
---|
[261eea6] | 47 | clean_builddir() { #
|
---|
[877cc6a] | 48 | #----------------------------#
|
---|
| 49 | # Test if the clean must be done.
|
---|
[401f81e] | 50 | if [ "${CLEAN}" = "y" ]; then
|
---|
[877cc6a] | 51 | # Test to make sure that the build directory was populated by jhalfs
|
---|
| 52 | if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
---|
[5468631] | 53 | echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
|
---|
[877cc6a] | 54 | exit 1
|
---|
| 55 | else
|
---|
| 56 | # Clean the build directory
|
---|
[5468631] | 57 | echo -n "Cleaning $BUILDDIR ..."
|
---|
| 58 | sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
|
---|
| 59 | echo "done"
|
---|
| 60 | echo -n "Cleaning $JHALFSDIR ..."
|
---|
| 61 | sudo rm -rf $JHALFSDIR
|
---|
| 62 | echo "done"
|
---|
| 63 | echo -n "Cleaning remainig extracted sources in $BUILDDIR/sources ..."
|
---|
| 64 | sudo rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
|
---|
| 65 | echo "done"
|
---|
[877cc6a] | 66 | fi
|
---|
| 67 | fi
|
---|
| 68 | }
|
---|
| 69 |
|
---|
[fe30c61] | 70 | VERBOSITY2=$VERBOSITY
|
---|
[877cc6a] | 71 |
|
---|
[fe30c61] | 72 | [[ $VERBOSITY2 > 0 ]] && echo ""
|
---|
[877cc6a] | 73 |
|
---|
[fe30c61] | 74 | [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_book_parser>..."
|
---|
| 75 | source $COMMON_DIR/libs/func_book_parser
|
---|
| 76 | [[ $? > 0 ]] && echo "file libs/func_book_parser did not load.." && exit 1
|
---|
| 77 | [[ $VERBOSITY2 > 0 ]] && echo "OK"
|
---|
[877cc6a] | 78 |
|
---|
[7432834] | 79 |
|
---|
[fe30c61] | 80 | [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_download_pkgs>..."
|
---|
| 81 | source $COMMON_DIR/libs/func_download_pkgs
|
---|
| 82 | [[ $? > 0 ]] && echo "file libs/func_download_pkgs did not load.." && exit 1
|
---|
| 83 | [[ $VERBOSITY2 > 0 ]] && echo "OK"
|
---|
[2639f65] | 84 |
|
---|
| 85 |
|
---|
[fe30c61] | 86 | [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_wrt_Makefile>..."
|
---|
| 87 | source $COMMON_DIR/libs/func_wrt_Makefile
|
---|
| 88 | [[ $? > 0 ]] && echo "file libs/func_wrt_Makefile did not load.." && exit 1
|
---|
| 89 | [[ $VERBOSITY2 > 0 ]] && echo "OK"
|
---|
[877cc6a] | 90 |
|
---|
[4965fa8] | 91 |
|
---|
[fe30c61] | 92 | [[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_blfs_deps>..."
|
---|
| 93 | source $COMMON_DIR/libs/func_blfs_deps
|
---|
| 94 | [[ $? > 0 ]] && echo "file libs/func_blfs_deps did not load.." && exit 1
|
---|
| 95 | [[ $VERBOSITY2 > 0 ]] && echo "OK"
|
---|
[877cc6a] | 96 |
|
---|
[fe30c61] | 97 | [[ $VERBOSITY2 > 0 ]] && echo -n " ..." |
---|