1# Copyright 2004 Rainer Wichmann
2# Distributed under the terms of the GNU General Public License v2
3
4inherit eutils
5
6MY_P="${PN}_signed-${PV}"
7SLOT="0"
8LICENSE="GPL-2"
9DESCRIPTION="Samhain is a file integrity checker with optional central logging"
10
11# This is a fake URI that allows us to do a 'make dist' and copy
12# the file to distdir.
13# The proper URI would be http://www.la-samhna.de/archive/${MY_P}.tar.gz,
14# but this would force us to do a 'make dist-sign' ...
15# Apparently, portage cannot handle the file:// scheme,
16# and not every user might be prepared to create a signed tarball.
17#
18# SRC_URI="http://www.la-samhna.de/archive/${MY_P}.tar.gz"
19SRC_URI="http://www.la-samhna.de/archive/${P}.tar.gz"
20
21
22HOMEPAGE="http://www.la-samhna.de/samhain/"
23
24KEYWORDS="x86"
25
26IUSE=""
27
28DEPEND="app-arch/gzip
29	app-arch/tar"
30#	mysql? (>=dev-db/mysql-3.23.58)"
31RDEPEND=""
32
33src_unpack() {
34        unpack ${A}
35        cd ${WORKDIR}
36        if test -f ${P}.tar.gz; then
37	   gunzip -c ${P}.tar.gz | tar xf -  || die
38	   cd ${P}
39	elif test -d "samhain-${PV}"; then
40	   mv "samhain-${PV}" "@install_name@-${PV}"
41	fi
42}
43
44src_compile() {
45	local myconf="--with-trusted=0,250"
46
47#	myconf="$myconf --enable-mounts-check"
48#	myconf="$myconf --enable-userfiles"
49
50#	use mysql    && myconf="$myconf --with-database=mysql"
51#	use postgres && myconf="$myconf --with-database=postgresql"
52
53#        econf \
54#	      --with-pid-file=/var/run/${PN}.pid \
55#	      --with-state-dir=/var/lib/${PN} \
56#	      --with-log-file=/var/log/${PN}.log \
57
58	./configure ${myconf} @mydefargs@ || die
59        emake || die
60
61	echo '#!/bin/sh' > ./sstrip
62	echo 'echo "*** SSTRIP DISABLED ***"' >> ./sstrip
63}
64
65src_install() {
66        make DESTDIR=${D} install  || die
67        make DESTDIR=${D} install-boot  || die
68
69	dodoc docs/BUGS COPYING docs/Changelog LICENSE docs/README \
70	      docs/README.UPGRADE docs/sh_mounts.txt docs/sh_userfiles.txt \
71	      docs/MANUAL-2_4.ps docs/MANUAL-2_4.html.tar
72
73	dohtml docs/HOWTO-client+server.html docs/HOWTO-samhain+GnuPG.html \
74	       docs/HOWTO-write-modules.html docs/HOWTO-samhain-on-windows.html \
75	       docs/HOWTO-client+server-troubleshooting.html docs/FAQ.html
76}
77
78pkg_prerm() {
79	rc-update del @install_name@
80	einfo "Stopping service @install_name@"
81	test -f /etc/init.d/@install_name@ && /etc/init.d/@install_name@ stop
82	sleep 3
83}
84
85pkg_postinst() {
86	rc-update add @install_name@ default
87	einfo
88        einfo "@install_name@ is installed but is NOT running yet, and the database"
89	einfo "of file signatures is NOT initialized yet."
90	einfo
91	einfo "You need to run \"@install_name@ -t init\" to initialize "
92        einfo "the baseline database of file signatures."
93        einfo
94	einfo "After initializing the database, you can start @install_name@ "
95	einfo "with \"/etc/init.d/@install_name@ start\". It is configured to start"
96	einfo "automatically on the next boot for runlevel \"default\""
97}
98
99