# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils DESCRIPTION="Processor Hardware Control Userland Configuration Tool" HOMEPAGE="http://www.linux-phc.org/" RESTRICT="primaryuri" SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=50 -> phctool_0.5.2-2.tar.gz" KEYWORDS="~amd64 ~x86" SLOT="0" LICENSE="GPL-2" IUSE="sudo doc" DEPEND="" RDEPEND="=dev-lang/python-2* dev-python/pygtk:2 dev-python/egg-python sudo? ( app-admin/sudo )" S="${WORKDIR}/0.5.2-2/phctool/" PROGDIR="/usr/share/${P}" src_prepare() { epatch "${FILESDIR}/${PF}_all_paths_tray.patch" if use sudo; then epatch "${FILESDIR}/${PF}_all_paths_tool_sudo.patch" else epatch "${FILESDIR}/${PF}_all_paths_tool_no_sudo.patch" fi } src_install() { dodoc CHANGELOG || die "ebuild failed" if use doc; then dohtml -r doc/docfiles doc/index.htm || die "ebuild failed" fi insinto ${PROGDIR}/inc/libs doins inc/libs/{cpuinfo,generic,msr,phctoolhelp,throttling,voltages}.py || die "ebuild failed" insinto ${PROGDIR}/inc/textfiles doins inc/textfiles/popup_{about,analysis,info,settings,throttle,vids}.inc inc/textfiles/about.inc || die "ebuild failed" insinto ${PROGDIR}/inc doins inc/phc_{icon,exit}_22.png inc/{phctool_globals,theme}.py inc/{phctool,phctoolhelp}.glade inc/{phc_icon,sidelogo,helplogo}.png || die "ebuild failed" exeinto /usr/bin newexe phctool.sh phctool || die "ebuild failed" newexe phctray.sh phctray || die "ebuild failed" exeinto ${PROGDIR} doexe phc{tool,tray}.py subphctool.sh || die "ebuild failed" } pkg_postinst() { if use sudo; then GROUPNAME='phcusers' enewgroup ${GROUPNAME} SUDOERS=`cat /etc/sudoers | grep $GROUPNAME` if [ "$SUDOERS" = "" ]; then echo "%$GROUPNAME ALL=(root) NOPASSWD:$PROGDIR/subphctool.sh" >> /etc/sudoers einfo "Added '%$GROUPNAME ALL=(root) NOPASSWD:$PROGDIR/subphctool.sh' to /etc/sudoers" else einfo "Group seems already added to /etc/sudoers - leaving file as it is." fi chgrp -R ${GROUPNAME} ${PROGDIR} || die "ebuild failed" else einfo "Group not automatically added. Make sure by your own that you can run PHCtool as root." fi }