#!/bin/sh
#
# make startup scripts for GMS services
#
# Usage: makescript basedir mail locn seq_no
#    installdir - is the directory where GMS is installed eg /opt/gordano
#    mail       - is '1' for mail and '0' for list
#    file       - is the location of the startup script eg /etc/rc2.d/S88glmail
#
#    The script will produce a file such as /etc/rc2.d/S88glmail
#

if [ $# != "3" ]
then
    echo "Usage: makescript basedir mail file"
else
    if [ $2 = "0" ]
    then
        target="gllist"
        names="list post smtp www glmmanager"
    else
        target="glmail"
        names="imap list pop post smtp www glmmanager glmmessenger"
    fi
    echo "creating $target script $3" >>install.txt
    sed -e s:LOCATION:$1: -e s:SCRIPTNAME:$3: -e s:TARGETNAME:${target}: -e "s:SERVICES:${names}:" ./startup >$3
    chmod ug+x $3
fi
