#!/bin/sh
set -e

# The following issues won't be fixed in lenny:
#   - unconditional use of deluser during postrm purge
#   - unconditional use of ucf during postrm purge
# so add these packages to the "fake" essential set.
USED_DURING_PURGE="adduser ucf"


case ${PIUPARTS_OBJECTS%%=*} in
	TARBALL)
		# don't install fake essential packages while creating the tarball
		exit 0
		;;
	adduser|ucf)
		# allow testing of the fake essential packages
		exit 0
		;;
	docbookwiki)
		USED_DURING_PURGE="$USED_DURING_PURGE mysql-client"
		;;
	prelude-manager)
		#660455
		USED_DURING_PURGE="$USED_DURING_PURGE dbconfig-common"
		;;
	drupal6|moodle|moodle-book|moodle-debian-edu-theme|scuttle)
		USED_DURING_PURGE="$USED_DURING_PURGE wwwconfig-common"
		;;
	octave-audio|octave-symbolic|octave-vrml)
		USED_DURING_PURGE="$USED_DURING_PURGE octave3.0"
		;;
	ttf-beteckna)
		#502707
		USED_DURING_PURGE="$USED_DURING_PURGE defoma"
		;;
esac

echo "*** Adding fake essential packages ***"
apt-get install -yf $USED_DURING_PURGE
