# Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later # Author: Imran Rafique S=${WORKDIR}/${P} DESCRIPTION="a GKrellM plugin for hddtemp (which reads the temperature of SMART IDE hard drives)" SRC_URI="http://coredump.free.fr/linux/${P}.tar.gz" HOMEPAGE="http://coredump.free.fr/linux/harddrive.html" DEPEND=">=app-admin/gkrellm-1.2.1" RDEPEND=">=app-admin/hddtemp-0.2" src_unpack() { unpack ${A} ; cd ${S} # patch Makefile mv Makefile Makefile.orig sed -e "s:^CFLAGS.*:CFLAGS=${CFLAGS} -fPIC:" Makefile.orig > Makefile } src_compile() { make || die } src_install() { insinto /usr/lib/gkrellm/plugins doins gkrellm-hddtemp.so } pkg_postinst() { # hddtemp needs to run with root permissions # However, only make hddtemp setuid, if we are confident that the binary was installed via the hddtemp ebuild # if hddtemp is not in /usr/bin, or its not executable, or not owned by root, then this means that it wasn't installed by the hddtemp ebuild - in which case, do nothing ! if [ -x "/usr/bin/hddtemp" -a `ls -l /usr/bin/hddtemp | awk '{print $3}'` = "root" ]; then chmod u+s /usr/bin/hddtemp fi } pkg_postrm() { if [ -f "/usr/bin/hddtemp" ]; then chmod u-s /usr/bin/hddtemp fi }