#!/bin/sh
#
# Copyright 2002 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
#

SRCDIR=/usr/src/gnome
SCRIPTDIR=$SRCDIR/scripts
PACKAGEDIR=$SRCDIR/packages
BUILDDIR=$SRCDIR/builds

#
# WARNING!!!
#
# This file is TERRIBLY out of date!  DO NOT USE IT VERBATIM!
# You can model your own auto-build system on it, but it won't
# work to build a Dropline GNOME system anymore--I run all the 
# build scripts by hand now.
#

# the idea is to get the newest version of the given file; in theory,
# it should be the last one listed by 'ls'

installpkg ()
{
	COUNT=0
	for FILE in $( ls $1 | sort )
	do
		COUNT=$COUNT+1
	done
	
	if [ "$COUNT" == "0" ]; then
		echo "Could not find file matching '$1'"
		echo "Please ensure you downloaded the entire Dropline GNOME"
		echo "package set.  Installation aborting..."
		echo ""
		exit 3
	fi

	/sbin/installpkg $FILE

	if [ "$?" != "0" ]; then
		echo "Error installing $1: Could not install '$FILE'."
		exit $?
	fi

	echo "press any key to continue..."
	read FILE
}

echo "building GNOME environment..."

cd $SCRIPTDIR

#
# the libraries
#

sh expat.build &&\
installpkg "$PACKAGEDIR/expat-*.tgz" &&\
sh Python.build &&\
installpkg "$PACKAGEDIR/Python-*.tgz" &&\
sh fam.build &&\
installpkg "$PACKAGEDIR/fam-*.tgz" &&\
sh freetype.build &&\
installpkg "$PACKAGEDIR/freetype-*.tgz" &&\
sh gtk-doc.build &&\
installpkg "$PACKAGEDIR/gtk-doc-*.tgz" &&\
sh glib.build &&\
installpkg "$PACKAGEDIR/glib-*.tgz" &&\
sh pango.build &&\
installpkg "$PACKAGEDIR/pango-*.tgz" &&\
sh atk.build &&\
installpkg "$PACKAGEDIR/atk-*.tgz" &&\
sh gtk+.build &&\
installpkg "$PACKAGEDIR/gtk+-*.tgz" &&\
sh libxml2.build &&\
installpkg "$PACKAGEDIR/libxml2-*.tgz" &&\
sh libxslt.build &&\
installpkg "$PACKAGEDIR/libxslt-*.tgz" &&\
sh libglade.build &&\
installpkg "$PACKAGEDIR/libglade-*.tgz" &&\
sh libart_lgpl.build &&\
installpkg "$PACKAGEDIR/libart_lgpl-*.tgz" &&\
sh libgnomecanvas.build &&\
installpkg "$PACKAGEDIR/libgnomecanvas-*.tgz" &&\
sh libIDL.build &&\
installpkg "$PACKAGEDIR/libIDL-*.tgz" &&\
sh linc.build &&\
installpkg "$PACKAGEDIR/linc-*.tgz" &&\
sh ORBit2.build &&\
installpkg "$PACKAGEDIR/ORBit2-*.tgz" &&\
sh intltool.build &&\
installpkg "$PACKAGEDIR/intltool-*.tgz" &&\
sh gnome-common.build &&\
installpkg "$PACKAGEDIR/gnome-common-*.tgz" &&\
sh GConf.build &&\
installpkg "$PACKAGEDIR/GConf-*.tgz" &&\
sh bonobo-activation.build &&\
installpkg "$PACKAGEDIR/bonobo-activation-*.tgz" &&\
sh libbonobo.build &&\
installpkg "$PACKAGEDIR/libbonobo-*.tgz" &&\
sh gnome-mime-data.build &&\
installpkg "$PACKAGEDIR/gnome-mime-data-*.tgz" &&\
sh gnome-vfs.build &&\
installpkg "$PACKAGEDIR/gnome-vfs-*.tgz" &&\
sh audiofile.build &&\
installpkg "$PACKAGEDIR/audiofile-*.tgz" &&\
sh esound.build &&\
installpkg "$PACKAGEDIR/esound-*.tgz" &&\
sh libgnome.build &&\
installpkg "$PACKAGEDIR/libgnome-*.tgz" &&\
sh libbonoboui.build &&\
installpkg "$PACKAGEDIR/libbonoboui-*.tgz" &&\
sh libgnomeui.build &&\
installpkg "$PACKAGEDIR/libgnomeui-*.tgz" &&\
sh libgnomeprint.build &&\
installpkg "$PACKAGEDIR/libgnomeprint-*.tgz" &&\
sh libgnomeprintui.build &&\
installpkg "$PACKAGEDIR/libgnomeprintui-*.tgz" &&\
sh gail.build &&\
installpkg "$PACKAGEDIR/gail-*.tgz" &&\
sh at-spi.build &&\
installpkg "$PACKAGEDIR/at-spi-*.tgz" &&\
sh libgail-gnome.build &&\
installpkg "$PACKAGEDIR/libgail-gnome-*.tgz" &&\
sh scrollkeeper.build &&\
installpkg "$PACKAGEDIR/scrollkeeper-*.tgz" &&\
sh libgtop.build &&\
installpkg "$PACKAGEDIR/libgtop-*.tgz" &&\
sh glade.build &&\
installpkg "$PACKAGEDIR/glade-*.tgz"

if [ "$?" != "0" ]; then
	echo "Error building GNOME libraries."
	exit $?
fi

#
# the desktop
#

sh gnome-desktop.build &&\
installpkg "$PACKAGEDIR/gnome-desktop-*.tgz" &&\
sh eel.build &&\
installpkg "$PACKAGEDIR/eel-*.tgz" &&\
sh librsvg.build &&\
installpkg "$PACKAGEDIR/librsvg-*.tgz" &&\
sh nautilus.build &&\
installpkg "$PACKAGEDIR/nautilus-*.tgz" &&\
sh libgtkhtml.build &&\
installpkg "$PACKAGEDIR/libgtkhtml-*.tgz" &&\
sh yelp.build &&\
installpkg "$PACKAGEDIR/yelp-*.tgz" &&\
sh eog.build &&\
installpkg "$PACKAGEDIR/eog-*.tgz" &&\
sh libwnck.build &&\
installpkg "$PACKAGEDIR/libwnck-*.tgz" &&\
sh gnome-panel.build &&\
installpkg "$PACKAGEDIR/gnome-panel-*.tgz" &&\
sh gnome-session.build &&\
installpkg "$PACKAGEDIR/gnome-session-*.tgz" &&\
sh gnome-applets.build &&\
installpkg "$PACKAGEDIR/gnome-applets-*.tgz" &&\
sh control-center.build &&\
installpkg "$PACKAGEDIR/control-center-*.tgz" &&\
sh gnome-utils.build &&\
installpkg "$PACKAGEDIR/gnome-utils-*.tgz" &&\
sh libzvt.build &&\
installpkg "$PACKAGEDIR/libzvt-*.tgz" &&\
sh gnome-terminal.build &&\
installpkg "$PACKAGEDIR/gnome-terminal-*.tgz" &&\
sh gnome-games.build &&\
installpkg "$PACKAGEDIR/gnome-games-*.tgz" &&\
sh gnome-media.build &&\
installpkg "$PACKAGEDIR/gnome-media-*.tgz" &&\
sh gnome-system-monitor.build &&\
installpkg "$PACKAGEDIR/gnome-system-monitor-*.tgz" &&\
sh metacity.build &&\
installpkg "$PACKAGEDIR/metacity-*.tgz" &&\
sh gedit.build &&\
installpkg "$PACKAGEDIR/gedit-*.tgz" &&\
sh gdm.build &&\
installpkg "$PACKAGEDIR/gdm-*.tgz" &&\
sh bug-buddy.build &&\
installpkg "$PACKAGEDIR/bug-buddy-*.tgz" &&\
sh gtk-engines.build &&\
installpkg "$PACKAGEDIR/gtk-engines-*.tgz" &&\
sh gconf-editor.build &&\
installpkg "$PACKAGEDIR/gconf-editor-*.tgz"

if [ "$?" != "0" ]; then
	echo "Error building GNOME desktop."
	exit $?
fi

#
# extra applications
#

#sh gaim.build &&\
#installpkg "$PACKAGEDIR/gaim-*.tgz" &&\
sh drivel.build &&\
installpkg "$PACKAGEDIR/drivel-*.tgz" &&\
sh gcalctool.build &&\
installpkg "$PACKAGEDIR/gcalctool-*.tgz" &&\
sh gftp.build &&\
installpkg "$PACKAGEDIR/gftp-*.tgz" &&\
sh metacity-setup.build &&\
installpkg "$PACKAGEDIR/metacity-setup-*.tgz" &&\
sh gtk-crux-engine.build &&\
installpkg "$PACKAGEDIR/gtk-crux-engine-*.tgz" &&\
sh gtk-mist-engine.build &&\
installpkg "$PACKAGEDIR/gtk-mist-engine-*.tgz" &&\
sh gtk-xfce-engine.build &&\
installpkg "$PACKAGEDIR/gtk-xfce-engine-*.tgz" &&\
sh ggv.build &&\
installpkg "$PACKAGEDIR/ggv-*.tgz" &&\
sh gnome-vfs-extras.build &&\
installpkg "$PACKAGEDIR/gnome-vfs-extras-*.tgz" &&\
sh xmms.build &&\
installpkg "$PACKAGEDIR/xmms-*.tgz" &&\
sh gnome2-user-docs.build
installpkg "$PACKAGEDIR/gnome2-user-docs-*.tgz"

if [ "$?" != "0" ]; then
	echo "Error building GNOME applications."
	exit $?
fi

echo ""
echo "CD-ROM Software section"
echo ""
echo "These packages are not available on the Dropline FTP site,"
echo "so 'file not found' errors are normal"
echo ""

sh libdvdcss.build &&\
installpkg "$PACKAGEDIR/libdvdcss-*.tgz" &&\
sh libdvdread.build &&\
installpkg "$PACKAGEDIR/libdvdread-*.tgz" &&\
sh libdvdnav.build &&\
installpkg "$PACKAGEDIR/libdvdnav-*.tgz" &&\
sh xine-lib.build &&\
installpkg "$PACKAGEDIR/xine-lib-*.tgz" &&\
sh xine-ui.build &&\
installpkg "$PACKAGEDIR/xine-ui-*.tgz" &&\
sh xine-dvdnav.build &&\
installpkg "$PACKAGEDIR/xine-dvdnav-*.tgz"

if [ "$?" != "0" ]; then
	echo "Error building GNOME CD-ROM applications."
	exit $?
fi

echo ""
echo "All done building Dropline GNOME!"
echo ""
