#!/bin/sh
## init_suse
## changes SuSE sendmail.conf in /etc/mail

. ./ansi.sh

xamimepath=$1
rcfile="/etc/init.d/sendmail"

alreadydone=`grep xamime $rcfile | wc -l`
if [ $alreadydone -gt 0 ]; then
	printf "SuSE init alterations to start Inflex already done.\n"
	exit 0
fi


if [ -e $rcfile ]
	then
	printf "$dg Altering init.d sendmail file.. $doff"
	./replaceit --input=$rcfile "sendmail" "sendmail -C $xamimepath/xamime.cf" "{daemon" "}DAEMON" "-xamime"

	sleep 2
	count=`grep "xamime.cf" $rcfile | wc -l`
	if [ $count -gt 0 ]
		then
		printf "${don}Success.. $doff\n"
		else
			printf "${dr}Update did not succeed, please add '-C $xamimepath/xamime.cf' manually\n\
			to your $conf_file sendmail startup routine...$doff"
			fi
	else
	printf "$dr Sorry, could not find sendmail startup file\n\
	You have to manually find out how sendmail is started and append\n\n
		$dg -C $xamimepath/xamime.cf$doff\n\n
	${dr}to it.$doff\n"
	fi
	
