#!/bin/sh
# $Id: 3.installworld.sh,v 1.13 2004/10/15 20:45:19 saturnero Exp $                     

set -e -u

. ./config.sh
. ./.common.sh

if [ "x$MINIMAL" = "xYES" ]; then
    export __MAKE_CONF=$LOCALDIR/files/make.conf.minimal # Redefine make.conf path
else
    export __MAKE_CONF=$LOCALDIR/files/make.conf # Redefine make.conf path
fi

echo "Copying /etc files..."
sleep 1
cd /usr/src/etc || print_error
make distrib-dirs DESTDIR=$FREESBIEBASEDIR || print_error
make distribution DESTDIR=$FREESBIEBASEDIR || print_error

echo "Installing world..."
sleep 1
cd /usr/src/ || print_error
make installworld DESTDIR=$FREESBIEBASEDIR || print_error

if [ "$RELEASE" -lt "5" ];
then
    echo "Building new sysinstall..."
    sleep 1
    cd /usr/src/release/sysinstall
    make clean
    make 
    make install

    tar -cf - -C /stand . | tar xpf - -C $FREESBIEBASEDIR/stand
fi