# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../webcdwriter/webcdwriter.conf
# Copyright (C) 2007 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# 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; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

webcdwriter_main() {
	local wcwuser=cdwserve
	local wcwgroup=cdwserve

	# prepare a user/group

	# configure
	eval ./configure --user=$wcwuser --group=$wcwgroup --pam

# FIXME maybe as config.in options:
#--doNotCompileCDWserver  if you want to install CDWserver Pro
#--nosCert=certificate  Netscape Object Signing Certificate
#                       (required to sign the webCDcreator for Netscape 4
#                       and the RSA version for IE)
#--sunCert=certificate  certificate for the keytool from Sun
#                       (required to sign the webCDcreator for Java Plugin)

	eval make $makeopt
	eval make $makeinstopt

	# use our own init
	rm -f $root/etc/rc.d/init.d/CDWserver

	# make "setuid root copies" of cdrdao, cdrecord, mkisofs and readcd
	TOOLSDIR=$root/$localstatedir/CDWserver/bin
	for tool in cdrdao cdrecord mkisofs readcd
	do
        	if [ ! -e $TOOLSDIR/$tool ]; then
                	if [ -e $root/usr/bin/$tool ]; then
                        	cp -pf $root/usr/bin/$tool $TOOLSDIR/ || :
	                elif [ -e /usr/local/bin/$tool ]; then
        	                cp -pf /usr/local/bin/$tool $TOOLSDIR/ || :
                	fi
	                if [ -e $TOOLSDIR/$tool ]; then
        	                chown root $TOOLSDIR/$tool 2> /dev/null \
                	                && chgrp cdwserve $TOOLSDIR/$tool 2> /dev/null \
                	                && chmod 4750 $TOOLSDIR/$tool || :
        	        fi
	        fi
	done
}

custmain=webcdwriter_main