#!/bin/sh
#
# $OpenBSD: INSTALL,v 1.1 2001/06/01 23:36:32 jakob Exp $

PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_DIR=/var/arpwatch
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/arpwatch


do_configs()
{
    if [ -d $CONFIG_DIR ]; then
	echo ""
	echo "+---------------"
	echo "| The existing $1 configuration files in $CONFIG_DIR,"
	echo "| have NOT been changed.  You may want to compare them to the"
	echo "| current sample files, $SAMPLE_CONFIG_DIR,"
	echo "| and update your configuration as needed."
    	echo "+---------------"
	echo ""
    else
	install -d -o root -g wheel -m 755 $CONFIG_DIR
	install -o root -g wheel -m 444 \
	    $SAMPLE_CONFIG_DIR/ethercodes.dat $CONFIG_DIR
	install -o root -g wheel -m 644 \
	    /dev/null $CONFIG_DIR/arp.dat

	echo ""
	echo "+---------------"
	echo "| The $1 configuration files in $CONFIG_DIR,"
	echo "| have been installed.  Please view these files and change"
	echo "| the configuration to meet your needs."
	echo "+---------------"
	echo ""
    fi
}

if [ $# -ne 2 ]; then
    echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
    exit 1
fi

case $2 in
    PRE-INSTALL)
	;;
    POST-INSTALL)
	do_configs $1
	;;
    *)
	echo "Usage: `basename $0` distname <PRE-INSTALL|POST-INSTALL>" >&2
	exit 1
	;;
esac

exit 0
