#!/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
#

# ${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 ${DLG_ISODIR} ]; then
	rm -rf ${DLG_ISODIR} || die
fi

mkdir -p ${DLG_ISODIR}/dropline-gnome || die

cp ${DLG_ROOT}/DroplineFiles2c ${DLG_ISODIR}/dropline-gnome/ &&
cp ${DLG_DOCDIR}/README ${DLG_ISODIR}/ || die

file="1"
while [ -n "${file}" ]
do
	read file
	if [ "${file}" == "" ]; then
		break;
	fi
	filename=`echo "${file}" | cut -d ':' -f 1`
	status=`echo "${file}" | cut -d ':' -f 2`
	if [[ "${status}" == "required" || "${status}" == "optional" ]]; then
		echo "copying ${filename}..."
		cp -r ${DLG_PACKAGEDIRROOT}/${filename} ${DLG_ISODIR}/dropline-gnome/ || die
	fi
done < ${DLG_ROOT}/DroplineFiles2c

mkisofs -r -V "Dropline GNOME ${DLG_VERSION}" -o ~/dlg-${DLG_VERSION}.iso ${DLG_ISODIR} || die
