#!/bin/sh

# Copyright 2008 Enrico Zini <enrico@truelite.it>
# Licensed under the terms of the GNU General Public License,
# version 3 or any later version.

set -e

FINDPARTS="/usr/lib/partconf/find-partitions"

notice () {
	logger -t condpart "$@"
}
error () {
	logger -t condpart "error: $@"
}

# load debconf
. /usr/share/debconf/confmodule

notice "Checking if we need to recreate /home"

if [ ! -x $FINDPARTS ]
then
	error "$FINDPARTS not found"
	exit 1
fi

if $FINDPARTS | grep -q part6
then
	# Keep
	notice "/home exists: we keep it"
	debconf-set-selections /usr/lib/condpart/part-keep.preseed
else
	# Format
	notice "/home does not exist: we create it"
	debconf-set-selections /usr/lib/condpart/part-create.preseed
fi

notice "Finished special handling of /home"

#DEBHELPER#

exit 0
