summaryrefslogtreecommitdiff
blob: aa6aa32d47e39c0f4a43d7a6e05bb0faaf2511aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# created for ::darkelf overlay.
# by Simon the Sorcerer

EAPI=6

DESCRIPTION="darkelf-features for gentoo portage"
HOMEPAGE="http://homepages.uni-paderborn.de/neuron/darkelf/"
SRC_URI="http://homepages.uni-paderborn.de/neuron/gentoo/darkelf/darkelf-features-bashrc"

LICENSE="Artistic"
KEYWORDS="amd64 ~ppc ~ppc64 x86 arm arm64"
IUSE=""
SLOT="0"

S="${WORKDIR}/"

pkg_postinst() {
	if [ ! -f /etc/portage/bashrc ]; then
		cp "$DISTDIR"/darkelf-features-bashrc /etc/portage/bashrc || die
	elif ! b2sum --quiet -c <<< "2e423452045799e5f0a4fac20c183a21a97fe66797d12646a79e154681fead73ba52300e1e939c1e4d3448a4d2ea6a33c213ae44461b8dadd904537fe7132505  /etc/portage/bashrc" ; then
		eerror ERROR: A different /etc/portage/bashrc does already exist.
	fi
	if ! grep -q "DARKELF_FEATURES" /etc/portage/make.conf ; then
		echo '#DARKELF_FEATURES="postmerge_distclean"' >> /etc/portage/make.conf || die
	fi
	elog "To enable cleaning distfiles after every merged ebuild uncomment DARKELF_FEATURES=\"postmerge_distclean\" in /etc/portage/make.conf."
}

pkg_postrm() {
	cp /etc/portage/make.conf make.conf
	sed "/^#DARKELF_FEATURES=\"postmerge_distclean\"/d" make.conf > /etc/portage/make.conf
	if b2sum --quiet -c <<< "2e423452045799e5f0a4fac20c183a21a97fe66797d12646a79e154681fead73ba52300e1e939c1e4d3448a4d2ea6a33c213ae44461b8dadd904537fe7132505  /etc/portage/bashrc" ; then
		rm /etc/portage/bashrc
	else
		ewarn /etc/portage/bashrc will be kept because it was modified.
	fi
}