2006-03-07 21:02:53 +01:00
|
|
|
#!/bin/bash
|
2006-03-11 00:35:41 +01:00
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2006-08-26 15:00:37 +02:00
|
|
|
set -e
|
2006-03-07 21:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
no_empty_builddir() {
|
|
|
|
'clear'
|
|
|
|
cat <<- -EOF-
|
|
|
|
${DD_BORDER}
|
|
|
|
|
|
|
|
${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
|
|
|
|
Looks like the \$BUILDDIR directory contains subdirectories
|
2007-09-19 18:50:48 +02:00
|
|
|
from a previous build.
|
2006-03-07 21:02:53 +01:00
|
|
|
|
|
|
|
Please format the partition mounted on \$BUILDDIR or set
|
2007-09-19 18:50:48 +02:00
|
|
|
a different build directory before running jhalfs.
|
2006-03-07 21:02:53 +01:00
|
|
|
${OFF}
|
|
|
|
${DD_BORDER}
|
|
|
|
-EOF-
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------#
|
2006-05-03 21:35:01 +02:00
|
|
|
run_make() { #
|
2006-03-07 21:02:53 +01:00
|
|
|
#----------------------------#
|
|
|
|
# Test if make must be run.
|
2006-08-12 21:59:11 +02:00
|
|
|
if [ "$RUNMAKE" = "y" ] ; then
|
2007-09-19 18:50:48 +02:00
|
|
|
# Test to make sure we're not running the build as root
|
2006-09-16 19:45:58 +02:00
|
|
|
if [ "$UID" = "0" ] ; then
|
2006-09-13 22:04:46 +02:00
|
|
|
echo "You must not be logged in as root to build the system."
|
2006-03-07 21:02:53 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# Build the system
|
|
|
|
if [ -e $MKFILE ] ; then
|
2006-03-28 22:11:42 +02:00
|
|
|
echo -ne "Building the system...\n"
|
2006-04-17 13:15:36 +02:00
|
|
|
cd $JHALFSDIR && make
|
2006-03-07 21:02:53 +01:00
|
|
|
echo -ne "done\n"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------#
|
2006-05-03 21:35:01 +02:00
|
|
|
clean_builddir() { #
|
2006-03-07 21:02:53 +01:00
|
|
|
#----------------------------#
|
|
|
|
# Test if the clean must be done.
|
2006-08-12 21:59:11 +02:00
|
|
|
if [ "${CLEAN}" = "y" ]; then
|
2006-03-07 21:02:53 +01:00
|
|
|
# Test to make sure that the build directory was populated by jhalfs
|
|
|
|
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
2007-09-19 18:50:48 +02:00
|
|
|
echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
|
|
|
|
exit 1
|
|
|
|
# Test that dev filesystems are not mounted in $BUILDDIR
|
|
|
|
elif mount | grep $BUILDDIR/dev > /dev/null ; then
|
|
|
|
echo "Looks like kernel fylesystems are yet mounted on $BUILDDIR."
|
2006-03-07 21:02:53 +01:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
# Clean the build directory
|
2006-10-07 21:14:47 +02:00
|
|
|
echo -n "Cleaning $BUILDDIR ..."
|
2007-09-19 18:50:48 +02:00
|
|
|
# First delete proc and sys directories, if exist.
|
|
|
|
# Both should be empty, if not be sure to exit.
|
|
|
|
if [ -d $BUILDDIR/proc ] ; then
|
|
|
|
sudo rmdir $BUILDDIR/proc || exit 1
|
|
|
|
fi
|
|
|
|
if [ -d $BUILDDIR/sys ] ; then
|
|
|
|
sudo rmdir $BUILDDIR/sys || exit 1
|
|
|
|
fi
|
|
|
|
sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,root,sbin,srv,tmp,tools,cross-tools,usr,var}
|
2006-10-07 21:14:47 +02:00
|
|
|
echo "done"
|
|
|
|
echo -n "Cleaning $JHALFSDIR ..."
|
|
|
|
sudo rm -rf $JHALFSDIR
|
|
|
|
echo "done"
|
|
|
|
echo -n "Cleaning remainig extracted sources in $BUILDDIR/sources ..."
|
|
|
|
sudo rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
|
|
|
|
echo "done"
|
2006-03-07 21:02:53 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
VERBOSITY2=$VERBOSITY
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo ""
|
2006-07-26 20:42:01 +02:00
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_book_parser>..."
|
|
|
|
source $COMMON_DIR/libs/func_book_parser
|
|
|
|
[[ $? > 0 ]] && echo "file libs/func_book_parser did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo "OK"
|
2006-03-07 21:02:53 +01:00
|
|
|
|
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_download_pkgs>..."
|
|
|
|
source $COMMON_DIR/libs/func_download_pkgs
|
|
|
|
[[ $? > 0 ]] && echo "file libs/func_download_pkgs did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo "OK"
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2006-07-26 20:42:01 +02:00
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_wrt_Makefile>..."
|
|
|
|
source $COMMON_DIR/libs/func_wrt_Makefile
|
|
|
|
[[ $? > 0 ]] && echo "file libs/func_wrt_Makefile did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo "OK"
|
2006-03-11 00:35:41 +01:00
|
|
|
|
2006-08-28 23:41:49 +02:00
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo -n "Loading <func_blfs_deps>..."
|
|
|
|
source $COMMON_DIR/libs/func_blfs_deps
|
|
|
|
[[ $? > 0 ]] && echo "file libs/func_blfs_deps did not load.." && exit 1
|
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo "OK"
|
2006-03-07 21:02:53 +01:00
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
[[ $VERBOSITY2 > 0 ]] && echo -n " ..."
|