#!/bin/sh

# This file is part of the aMule project.
#
# Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
# Copyright (c) 2006-2011 Werner Mahr (Vollstrecker) ( amule@vollstreckernet.de )
#
# This program 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 program 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
#

prefix=/usr/pkg
exec_prefix=${prefix}
xas_bin=${exec_prefix}/lib/xchat/plugins/xas.pl

if [ -z $xas_bin ] ; then
	echo "xas.pl: Plugin not found"
	exit 0
fi

if [ -d ~/.xchat2 ] ; then
	if [ -e ~/.xchat2/xas.pl ] ; then
		rm ~/.xchat2/xas.pl
	fi
	ln -s $xas_bin ~/.xchat2/xas.pl && echo "autostart successfully added"
	if  ps -A | grep -q xchat ; then
		echo "You have to restart XChat to autoload xas.pl"
	fi
else
	echo "XChat-Datadir not found"
fi
