openbsd-ports/devel/gconf/pkg/INSTALL
2002-08-31 13:31:58 +00:00

95 lines
2.2 KiB
Plaintext

#!/bin/sh
#
# $OpenBSD: INSTALL,v 1.5 2002/08/31 13:31:58 nino Exp $
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
P_NAME=gconf
DEST_PFX=${SYSCONFDIR}
SOURCE_PFX=${PREFIX}/share/examples/${P_NAME}
warn_if_old_config() {
if grep "${DEST_PFX}/gconf/gconf.xml.defaults" ${DEST_PFX}/gconf/1/path >/dev/null 2>&1; then
echo "|"
echo "| WARNING: The default path in your configuration is incorrect."
echo "| Make sure that you update your configuration before using ${P_NAME}!"
fi
}
do_post() {
echo
echo "+--------------- ${P_NAME}"
install -d ${DEST_PFX}/gconf/1
install -d ${DEST_PFX}/gconf/schemas
install -d /var/db/gconf/gconf.xml.mandatory
install -d /var/db/gconf/gconf.xml.defaults
# install or take note of existing config files
for f in \
gconf/1/path \
gconf/schemas/desktop.schemas
do
if [ -f "${DEST_PFX}/$f" ]; then
OLD_CONFS="${OLD_CONFS} $f"
else
if ! install -m 644 ${SOURCE_PFX}/$f ${DEST_PFX}/$f; then
echo "| ERROR: The following file could not be installed, exiting: ${DEST_PFX}/$f"
exit 1
fi
NEW_CONFS="${NEW_CONFS} $f"
fi
done
# print status report
if [ -n "${NEW_CONFS}" ]; then
echo "| The following NEW configuration files have been installed:"
echo "|"
for f in ${NEW_CONFS}; do
echo "| ${DEST_PFX}/$f"
done
fi
if [ -n "${OLD_CONFS}" ]; then
if [ -n "${NEW_CONFS}" ]; then
echo "|"
fi
echo "| The following OLD configuration files was found and have NOT been overwritten:"
echo "| You should however manually compare it to it's equivalent in ${SOURCE_PFX}"
echo "| and update your configuration if needed."
echo "|"
for f in ${OLD_CONFS}; do
echo "| ${DEST_PFX}/$f"
done
fi
warn_if_old_config
echo "+--------------- ${P_NAME}"
echo
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
;;
POST-INSTALL)
do_post
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0