#!/bin/bash

NAME=${bash[0]}
PROGRAM=${bash[3]}
FILE=${bash[2]}
EXT=${bash[4]}
DLINK=${bash[1]}
MD5=${bash[5]}

download ${DLINK}

waitUser

check ${FILE} ${MD5}

waitUser

unpack ${EXT}

waitUser

startBuild


cd $BUILD_DIR/$PROGRAM
{

	echo -e "$G $PROGRAM/configure $DEF" 
	./configure --prefix=/usr --bindir=/bin \
    --htmldir=/usr/share/doc/bash-4.2 --without-bash-malloc \
    --with-installed-readline || exit 1
	StartMake
	waitUser
	make || exit 1
	
	if [ $MakeTests == 1 ]; then
		chown -Rv nobody .
		echo -e "$G su-tools nobody -s /bin/bash -c make tests $DEF"
		su-tools nobody -s /bin/bash -c "make tests" || exit 1 
	fi
	StartMakeInstall
	waitUser
	make install || exit 1
	echo -e "$R $BASHexec $DEF"
	waitUser
} 2>&1 | tee $BUILD_DIR/LOG_$PROGRAM.log
	if [ $PIPESTATUS -ne 0 ]
		then
			echo -e "$L_FAIL_BUIL"
			exit 1
	fi

RMbuild
waitUser
touch $SCRIPTS_DIR/bashCH6Complete

echo -e "$C New Login, you must start script/chroot_makeall again $DEF"

exec /bin/bash --login +h  	  

cd $ROOT
