#!/bin/sh

#==================================================
# This shell script is intended to be placed in
# /usr/bin/ and should be run to start a GNUmed
# client.
#
# $Source: /sources/gnumed/gnumed/gnumed/dists/Linux/gnumed,v $
# $Id: gnumed,v 1.4 2005/07/11 16:55:27 ncq Exp $
# license: GPL
# Karsten Hilbert, Sebastian Hilbert
#--------------------------------------------------

# set -x

CONFSOURCE="/etc/gnumed/gnumed.conf"

echo "GNUmed startup"

# - make sure standard config file is there
# - people using --conf-file=<FILE> are on their own
if [ ! -s ${HOME}/.gnumed/gnumed.conf ] ; then
	if [ ! -e ${CONFSOURCE} ] ; then
		echo "Global config file ${CONFSOURCE} missing."
	else
		cp -Rv ${CONFSOURCE} ${HOME}/.gnumed/gnumed.conf
	fi
fi

# this ugly hack needs to go once we use proper
# distutil installation for the Python part
export PYTHONPATH="${PYTHONPATH}:/usr/lib/python/site-packages/Gnumed:/usr/lib/python/site-packages/Gnumed/wxpython:/usr/lib/python/site-packages/Gnumed/pycommon"

# source systemwide startup extension shell script if it exists
if [ -r /etc/gnumed/gnumed-startup-local.sh ] ; then
	. /etc/gnumed/gnumed-startup-local.sh
fi

# source local startup extension shell script if it exists
if [ -r ${HOME}/.gnumed/gnumed-startup-local.sh ] ; then
	. ${HOME}/.gnumed/gnumed-startup-local.sh
fi

# now run a client
python /usr/lib/python/site-packages/Gnumed/wxpython/gnumed.py $@
#--unicode-gettext=0
#--log-file=somewhere.log
#--conf-file=somewhere.conf
#--debug

#==================================================
# $Log: gnumed,v $
# Revision 1.4  2005/07/11 16:55:27  ncq
# - allow systemwide startup extension shell script, too
#
# Revision 1.3  2005/07/11 16:53:03  ncq
# - include user-local startup shell script
# - use cp -R
#
# Revision 1.2  2005/07/11 16:46:41  ncq
# - make more dumb but more robust
#
