#! /bin/sh
# postinst script for gfax
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
if [ "$1" = "configure" ]; then
	# Install all the printer profiles
	# Install GNOME-1.x printer files.
	if [ -d /usr/share/gnome-print ]; then
		cp -f /usr/lib/gfax/fax-g3.profile /usr/share/gnome-print/profiles
	fi

	# Install GNOME-2.x printer files.
	if [ -d /usr/share/libgnomeprint ]; then
		for i in /usr/share/libgnomeprint/*
		do
			cp -f /usr/lib/gfax/GFAX.xml $i/printers
			cp -f /usr/lib/gfax/GNOME-GFAX-PS.xml $i/models
		done
	fi
	# Make the fax spool directory
	if [ ! -d /var/spool/gfax ]; then
		mkdir /var/spool/gfax
		mkdir /var/spool/gfax/doneq
		mkdir /var/spool/gfax/recq
		chmod -R 777 /var/spool/gfax
	fi
fi

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_gconf
if [ "$1" = "configure" ]; then
	SCHEMA_LOCATION=/etc/gconf/schemas
	SCHEMA_FILES="gfax.schemas "
	for SCHEMA in $SCHEMA_FILES; do
		if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
			HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
				gconftool-2 \
				--makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
		fi
	done
fi
# End automatically added section

killall -HUP gconfd-2


exit 0
