#!/bin/sh
#
# Copyright 2004 Todd Kulesza
#
# The Dropline GNOME Installation System is free software.
# You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
#

SERVER_DIR=/home/fflew/MORVA/dropline-gnome

# ${DLG_ROOT} should be the root directory of the Dropline Build System.
# This only needs to be set if you try to run ./build from outside of
# the root directory.
#DLG_ROOT=/usr/src/dlg

if [ -z ${DLG_ROOT} ]; then
	DLG_ROOT="`pwd`"
fi

export DLG_ROOT

. ${DLG_ROOT}/SCRIPTS/dropline-header

if [ -d ${SERVER_DIR}/BUILD-SYSTEM ]; then
	rm -rf ${SERVER_DIR}/BUILD-SYSTEM || die
fi

mkdir -p ${SERVER_DIR}/BUILD-SYSTEM || die
mkdir -p ${SERVER_DIR}/BUILD-SYSTEM/SOURCES || die
mkdir -p ${SERVER_DIR}/BUILD-SYSTEM/SCRIPTS || die

# copy the root files
cp ${DLG_ROOT}/ChangeLog ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/DroplineFiles2c ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/README ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/build ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/compile-order ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/copy-pkg-to-server ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/copy-src-to-server ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_ROOT}/update-filelist ${SERVER_DIR}/BUILD-SYSTEM/ &&
cp ${DLG_SCRIPTDIR}/dropline-build.sh ${SERVER_DIR}/BUILD-SYSTEM/SCRIPTS/ &&
cp ${DLG_SCRIPTDIR}/dropline-files-update.sh ${SERVER_DIR}/BUILD-SYSTEM/SCRIPTS/ &&
cp ${DLG_SCRIPTDIR}/dropline-header ${SERVER_DIR}/BUILD-SYSTEM/SCRIPTS/ || die

# copy the source & script files
file="1"
while [ -n "${file}" ]
do
	read file
	if [ "${file}" == "" ]; then
		break;
	fi
	echo "copying ${file}..."
	cp -r ${DLG_SRCDIR}/${file} ${SERVER_DIR}/BUILD-SYSTEM/SOURCES || die
	cp -r ${DLG_SCRIPTDIR}/${file} ${SERVER_DIR}/BUILD-SYSTEM/SCRIPTS || die
done < ${DLG_ROOT}/compile-order
