# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION="More advanced replacement for etc-update that implements a 3 way (automatic) merge"
HOMEPAGE="http://etc-an-update.sf.net"
SRC_URI="mirror://sourceforge/etc-an-update/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86"
IUSE=""

RDEPEND="dev-lang/perl
	app-portage/genlop
	>=app-portage/gentoolkit-0.3
	kde-misc/kdiff3"

S=${WORKDIR}/${P}

src_unpack() {
	unpack ${A}
	cd "${S}"
	mkdir baselineConfig
}

pkg_postrm() {
	rm -f /var/db/etc-an-update.lastrun
	ewarn "If you want to permanently remove the baseline config files,"
	ewarn "then you should manually remove /var/db/baselineConfig"
}

src_install() {
	into /
	exeinto /usr/sbin
	exeopts -m0750
	doexe etc-an-update
	diropts -m0750
	dodir /var/db/baselineConfig
	dodoc README
	keepdir /var/db/baselineConfig
}

pkg_postinst() {
	if [ ! "$(ls /var/db/baselineConfig)" ]; then
		einfo "Looks like a new install. Please run etc-an-update now"
		einfo "so that it can acquire baseline config files."
	fi
}
