#!/bin/sh
#  
# 	@(#)localize.smpl	1.1 5/9/91 
#
#		The purpose of this file is to make changes to
#		rkive's Makefile and rkive.h. This allows for
#		local configuration modifications to be isolated
#		to this file.  
#set -x
if [ -f Makefile ]
then
	mv Makefile Makefile.old
	echo "Storing original Makefile in Makefile.old"
fi

echo "Extracting Makefile"
cp Makefile.dst Makefile
chmod u+w Makefile
echo "Performing substitutions on Makefile"
ed - Makefile  <<'EOF'
/^#EXOSFLAGS/s;^#;;
/^#EXOSLIBS/s;^#;;
/^#NNTPSRCDIR/s;^#;;
/^#NNTPDEBUG/s;^#;;
/^#NNTPFLAGS/s;^#;;
/^#NNTPSRCS/s;^#;;
/^#NNTPOBJS/s;^#;;
/^#SFLAGS/s;^#;;
/^#GETOPTO/s;^#;;
/^#GETOPTC/s;^#;;
/^CC/s;cc;gcc;
/^FLAGS/s;-g;-O;
/^YFLAGS/s;=;=-v;
/^YACC/s;yacc;bison;
/^ACCESSLIB/s;=;=-lndir;
/^LIBS/s;=;=-lc_s;
/^LP/s;lpr;lp;
/^PR/s;nl -n;pr;
/^NROFF/s;nroff;troff;
/^BINDIR/s;/usr/local/bin;/home/kent/bin;
/^RKIVEDIR/s;/usr/local/lib;/home/kent/rkive;
/^MAN1/s;/usr/man/man1;/usr/man/local/man1;
/^MAN5/s;/usr/man/man5;/usr/man/local/man5;
w
q
EOF

echo

if [ -f rkive.h ]
then
	mv rkive.h rkive.h.old
	echo "Storing original rkive.h in rkive.h.old"
fi

echo "Extracting rkive.h"
cp rkive.h.dst rkive.h
chmod u+w rkive.h
echo "Performing substitutions on rkive.h"
ed - rkive.h <<'EOF'
/OWNER/s;0;78;
/GROUP/s;3;21;
/MODES/s;0444;0644;
/DIR_MODE/s;0755;0775;
/^#define SUBJECT_LINE/s;define;undef;
/^#define MAIL/s;/usr/ucb/Mail;/usr/local/bin/elm;
/^#define SPOOLDIR/s;/usr/spool/news;/var/spool/news;
/^#define PROBLEMS_DIR/s;/usenet/problems;/home/kent/rkive/problems;
/^#define LOCATION/s;/usr/local/lib/rkive/rkive.cf;/home/kent/rkive/rkive.cf;
/^#undef ADD_REPOST_SUFFIX/s;undef;define;
/^#define MV_ORIGINAL/s;define;undef;
/^#define REPOST_SUFFIX/s;-repost;.rp;
/^#define VOLUME/s;volume;vol;
/^#undef ZEROFILL/s;undef;define;
/^#define REDUCE_HEADERS/s;define;undef;
/^#undef NO_MONTH_DIR/s;undef;define;
/^#undef USE_SYSMKDIR/s;undef;define;
/^#define MKDIR/s;define;undef;
/^#define DEFAULT_INDEX_FORMAT/s;%B\\t%S;%O\\t%T;
/^#define DEFAULT_LOG_FORMAT/s;%O\\t%T;%B\\t%S;
w
q
EOF
cat << 'EOM'

Done. Did you see a '?' appear while running this ? If so you need to
do a little more work to get it working right.  If not...

Check over the Makefile and rkive.h to assure that things are the way
that you want them. If they are not, make the appropriate changes to
this script and rerun it.  When things are correct, type

$ make 

This will build the three executables, article, ckconfig and rkive.
When you feel brave enough, install the software in place by typing

$ make install

EOM
