summaryrefslogtreecommitdiff
blob: 7e0618247d4dee4a74b373cb064d54e48df097d0 (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
77
78
79
80
81
82
83
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/smolt/smolt-1.2.ebuild,v 1.4 2010/06/08 19:11:10 arfrever Exp $

inherit python eutils

DESCRIPTION="The Fedora hardware profiler"
HOMEPAGE="https://fedorahosted.org/smolt/"
SRC_URI="https://fedorahosted.org/releases/s/m/${PN}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="gtk"

DEPEND="virtual/python
	sys-devel/gettext
	gtk? ( >=dev-python/pygtk-2.10.3 )"

RDEPEND="${DEPEND}
	sys-apps/hal
	>=dev-python/rhpl-0.213
	>=dev-python/urlgrabber-3.0.0
	>=dev-python/simplejson-1.7.1
	dev-python/dbus-python"

S="${S}/client"

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/${P}-config.py-gentoo-config.patch"
	epatch "${FILESDIR}/${P}-Makefile-fix-install.patch"
}

src_install() {
	emake install DESTDIR="${D}" || die "Install failed"

	insinto /usr/share/smolt/client/
	doins os_detect.py

	dosym /etc/smolt/config.py /usr/share/smolt/client/config.py
	domenu smolt.desktop

	if ! use gtk; then
		rm "${D}"/usr/bin/smoltGui
		rm "${D}"/usr/share/smolt/client/smoltGui.py
		rm "${D}"/usr/share/smolt/client/gui.py
	fi

	doman man/smolt{SendProfile,DeleteProfile}.1
	use gtk && doman man/smoltGui.1

	dodoc ../README ../TODO ../doc/PrivacyPolicy
	newinitd "${FILESDIR}"/${PN}-init.d ${PN}
}

pkg_postinst() {
	python_mod_optimize /usr/share/${PN}

	if ! [ -f "${ROOT}"/etc/smolt/hw-uuid ]; then
		elog "Creating this machines UUID in ${ROOT}/etc/smolt/hw-uuid"
		cat /proc/sys/kernel/random/uuid > "${ROOT}"/etc/smolt/hw-uuid
		UUID=$(cat "${ROOT}"/etc/smolt/hw-uuid)
		elog "Your UUID is: ${UUID}"
	fi
	echo
	elog "Call smoltSendProfile as root in order to initialize your profile."
	echo
	elog "You can withdraw it from the server if you wish to with"
	elog "   smoltDeleteProfile any time later on."
	echo

	if use gtk && has_version "<virtual/python-2.5"; then
		elog "If you want to view your profile on the web from within smoltGui,"
		elog "you should have a link mozilla-firefox -> firefox in your path."
		echo
	fi
}

pkg_postrm() {
	python_mod_cleanup /usr/share/${PN}
}