diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2010-04-28 15:21:07 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2010-04-28 15:21:07 +0000 |
commit | b2f8e8b92529a11850bfaac1f8452c7ed1d273ee (patch) | |
tree | 43c792a5db02eb4e6b649960bc89e57d7c718bec /sys-power/acpid | |
parent | x86 stable wrt bug #316299 (diff) | |
download | gentoo-2-b2f8e8b92529a11850bfaac1f8452c7ed1d273ee.tar.gz gentoo-2-b2f8e8b92529a11850bfaac1f8452c7ed1d273ee.tar.bz2 gentoo-2-b2f8e8b92529a11850bfaac1f8452c7ed1d273ee.zip |
New powerbtn.sh (power button script forked from fedora) wrt #317421.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'sys-power/acpid')
-rw-r--r-- | sys-power/acpid/ChangeLog | 8 | ||||
-rw-r--r-- | sys-power/acpid/acpid-2.0.4-r1.ebuild | 64 | ||||
-rw-r--r-- | sys-power/acpid/files/acpid-2.0.4-powerbtn.sh | 30 | ||||
-rw-r--r-- | sys-power/acpid/metadata.xml | 5 |
4 files changed, 105 insertions, 2 deletions
diff --git a/sys-power/acpid/ChangeLog b/sys-power/acpid/ChangeLog index 922b0e6dc7ee..fe5e30074ab1 100644 --- a/sys-power/acpid/ChangeLog +++ b/sys-power/acpid/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for sys-power/acpid # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/ChangeLog,v 1.46 2010/04/26 12:55:42 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/ChangeLog,v 1.47 2010/04/28 15:21:07 ssuominen Exp $ + +*acpid-2.0.4-r1 (28 Apr 2010) + + 28 Apr 2010; Samuli Suominen <ssuominen@gentoo.org> + +acpid-2.0.4-r1.ebuild, +files/acpid-2.0.4-powerbtn.sh: + New powerbtn.sh (power button script forked from fedora) wrt #317421. *acpid-2.0.4 (26 Apr 2010) diff --git a/sys-power/acpid/acpid-2.0.4-r1.ebuild b/sys-power/acpid/acpid-2.0.4-r1.ebuild new file mode 100644 index 000000000000..9838b6bcf547 --- /dev/null +++ b/sys-power/acpid/acpid-2.0.4-r1.ebuild @@ -0,0 +1,64 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/acpid-2.0.4-r1.ebuild,v 1.1 2010/04/28 15:21:07 ssuominen Exp $ + +EAPI=2 +inherit eutils toolchain-funcs + +DESCRIPTION="Daemon for Advanced Configuration and Power Interface" +HOMEPAGE="http://tedfelix.com/linux/acpid-netlink.html" +SRC_URI="http://tedfelix.com/linux/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~ia64 -ppc ~x86" +IUSE="consolekit" + +RDEPEND="consolekit? ( sys-auth/consolekit )" + +src_prepare() { + epatch "${FILESDIR}"/${PN}-2.0.3.patch + cp "${FILESDIR}"/${PN}-2.0.4-default.sh "${T}" || die + + if ! use consolekit; then + sed -i \ + -e 's:/etc/acpi/powerbtn.sh:/sbin/init 0:' \ + "${T}"/${PN}-2.0.4-default.sh || die + fi +} + +src_compile() { + tc-export CC CPP + emake || die + emake -C kacpimon || die +} + +src_install() { + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install || die + + dobin kacpimon/kacpimon || die + newdoc kacpimon/README README.kacpimon + + exeinto /etc/acpi + newexe "${T}"/${PN}-2.0.4-default.sh default.sh || die + + if use consolekit; then + newexe "${FILESDIR}"/${PN}-2.0.4-powerbtn.sh powerbtn.sh || die + fi + + insinto /etc/acpi/events + newins "${FILESDIR}"/${PN}-1.0.4-default default || die + + newinitd "${FILESDIR}"/${PN}-2.0.3-init.d acpid || die + newconfd "${FILESDIR}"/${PN}-1.0.6-conf.d acpid || die + + prepalldocs +} + +pkg_postinst() { + echo + elog "You may wish to read the Gentoo Linux Power Management Guide," + elog "which can be found online at:" + elog "http://www.gentoo.org/doc/en/power-management-guide.xml" + echo +} diff --git a/sys-power/acpid/files/acpid-2.0.4-powerbtn.sh b/sys-power/acpid/files/acpid-2.0.4-powerbtn.sh new file mode 100644 index 000000000000..5d248db73cb3 --- /dev/null +++ b/sys-power/acpid/files/acpid-2.0.4-powerbtn.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +PATH=/sbin:/bin:/usr/bin + +# Get the ID of the first active X11 session: +uid_session=$( +ck-list-sessions | \ +awk ' +/^Session[0-9]+:$/ { uid = active = x11 = "" ; next } +{ gsub(/'\''/, "", $3) } +$1 == "unix-user" { uid = $3 } +$1 == "active" { active = $3 } +$1 == "x11-display" { x11 = $3 } +active == "TRUE" && x11 != "" { + print uid + exit +}') + +# Check that there is a power manager, otherwise shut down. +[ "$uid_session" ] && +ps axo uid,cmd | \ +awk ' + $1 == '$uid_session' && + ($2 ~ /gnome-power-manager/ || $2 ~ /kded4/ || + $3 ~ /kded4/ || $3 ~ /guidance-power-manager/) \ + { found = 1; exit } + END { exit !found } +' || + shutdown -h now + diff --git a/sys-power/acpid/metadata.xml b/sys-power/acpid/metadata.xml index b27ff8eb4ed6..ceafcb6b0f3c 100644 --- a/sys-power/acpid/metadata.xml +++ b/sys-power/acpid/metadata.xml @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> -<herd>mobile</herd> + <herd>mobile</herd> + <use> + <flag name="consolekit">Install consolekit based powerbtn.sh (power button) script</flag> + </use> </pkgmetadata> |