#!/bin/sh
# $OpenBSD: INSTALL,v 1.1.1.1 2003/12/15 06:11:34 jolan Exp $
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SYSCONFDIR=${SYSCONFDIR:-/etc}
CONFDIR=${SYSCONFDIR}/xfce4
CONF=$CONFDIR/xinitrc
EXAMPLECONFDIR=$PREFIX/share/examples/xfce-utils
EXAMPLECONF=$EXAMPLECONFDIR/xinitrc

do_confdir_install()
{
  install -d -o root -g wheel -m 755 $CONFDIR
}

do_conf_install()
{
  install -o root -g wheel -m 644 $EXAMPLECONF $CONF
  echo
  echo "+---------------"
  echo "| The $1 configuration file has been installed to:"
  echo "| $CONF."
  echo "| Please view this file and change the configuration to meet your needs."
  echo "+---------------"
  echo
}

do_conf_notice()
{
  echo
  echo "+---------------"
  echo "| The existing $1 configuration file at $CONF"
  echo "| has NOT been changed.  You may want to compare it to"
  echo "| the current samples in $EXAMPLECONFDIR"
  echo "| and update your configuration as needed."
  echo "+---------------"
  echo
}

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

case $2 in
    PRE-INSTALL)
        #
        ;;
    POST-INSTALL)
        if [ ! -d $CONFDIR ]; then
          do_confdir_install
        fi
        if [ ! -f $CONF ]; then
          do_conf_install $1
        else
          do_conf_notice $1
        fi
        ;;
    *)
        echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
        exit 1
        ;;
esac

exit 0
