summaryrefslogtreecommitdiff
blob: b4559558a6be729bac6c51d56abe6bd317e0d2c1 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-sci/setiathome/setiathome-3.03-r1.ebuild,v 1.4 2002/08/01 11:40:14 seemant Exp $

# generic archive name, this should be a link to the real archive
A="${P}.tar"

# this directory will not exist at first, we rename the real directory
# to this name later
S="${WORKDIR}/${P}"

# no version number on this install dir since upgrades will be using same dir
# (data will be stored here too)
I=/opt/setiathome

DESCRIPTION="Search for Extraterrestrial Intelligence (SETI) @ home"
HOMEPAGE="http://setiathome.ssl.berkeley.edu"
DEPEND=">=virtual/glibc-2.1
		>=sys-apps/baselayout-1.8.0"
RDEPEND=">=virtual/glibc-2.1
	X? ( x11-base/xfree )"
SLOT="0"
LICENSE="proprietary"
KEYWORDS="x86"

src_unpack () {
	if [ ! -e ${DISTDIR}/${A} ] ; then
		einfo "Please download the appropriate setiathome archive"
		einfo "for your system's architecture from:"
		einfo "http://setiathome.ssl.berkeley.edu/unix.html"
		einfo ""
		einfo "The archive should be placed into /usr/portage/distfiles."
		einfo "After that, create a symbolic link:"
		einfo ""
		einfo "\tln -s <archive> ${DISTDIR}/${A}"

		die "package archive not found"
	fi

	cd ${WORKDIR}
	tar xf ${DISTDIR}/${A}

	# find real directory ...
	dir="`find . -type d -name "${P}*" -mindepth 1 -maxdepth 1 | \
		cut -b "3-"`"
	# ... and rename it to our desired directory name
	mv "${dir}" "${P}"
}

src_install () {
	dodir ${I}
	cp {setiathome,README} ${D}/${I}
	use X && cp {xsetiathome,README.xsetiathome} ${D}/${I}
	chown nobody.nogroup ${D}/${I}
	chown nobody.nogroup ${D}/${I}/setiathome
	chmod +s ${S}/setiathome

	exeinto /etc/init.d ; newexe ${FILESDIR}/seti-init.d-r1 setiathome
	insinto /etc/conf.d ; newins ${FILESDIR}/seti-conf.d-r1 setiathome
	echo "SETIATHOME_DIR=${I}">> ${D}/etc/conf.d/setiathome
}

pkg_postinst () {
	einfo "To run SETI@home in the background at boot:"
	einfo " Edit /etc/conf.d/setiathome to setup"
	einfo " Then just run \`/etc/init.d/setiathome start\`"
	einfo ""
	einfo "Otherwise remember to cd into the directory"
	einfo "where it should keep its data files first, like so:"
	einfo " cd ${I} && ./setiathome"
}

pkg_postrm () {
	einfo "SETI@home data files were not removed."
	einfo " Remove them manually from ${I}"
}