diff options
Diffstat (limited to 'sys-apps/kuroevtd')
-rw-r--r-- | sys-apps/kuroevtd/ChangeLog | 12 | ||||
-rw-r--r-- | sys-apps/kuroevtd/Manifest | 7 | ||||
-rw-r--r-- | sys-apps/kuroevtd/files/digest-kuroevtd-1.1.3 | 1 | ||||
-rw-r--r-- | sys-apps/kuroevtd/files/kuroevtd.d/powerdown | 19 | ||||
-rw-r--r-- | sys-apps/kuroevtd/files/kuroevtd.d/powerpress | 8 | ||||
-rw-r--r-- | sys-apps/kuroevtd/files/kuroevtd.d/powerup | 10 | ||||
-rw-r--r-- | sys-apps/kuroevtd/files/kuroevtd.d/resetpress | 12 | ||||
-rw-r--r-- | sys-apps/kuroevtd/files/kuroevtd.initd | 26 | ||||
-rw-r--r-- | sys-apps/kuroevtd/kuroevtd-1.1.3.ebuild | 67 | ||||
-rw-r--r-- | sys-apps/kuroevtd/metadata.xml | 10 |
10 files changed, 172 insertions, 0 deletions
diff --git a/sys-apps/kuroevtd/ChangeLog b/sys-apps/kuroevtd/ChangeLog new file mode 100644 index 000000000000..8e244c35fad6 --- /dev/null +++ b/sys-apps/kuroevtd/ChangeLog @@ -0,0 +1,12 @@ +# ChangeLog for sys-apps/kuroevtd +# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/kuroevtd/ChangeLog,v 1.1 2006/01/21 21:24:13 nerdboy Exp $ + +*kuroevtd-1.1.3 (21 Jan 2006) + + 21 Jan 2006; Steve Arnold <nerdboy@gentoo.org> + +files/kuroevtd.d/powerdown, +files/kuroevtd.d/powerpress, + +files/kuroevtd.d/powerup, +files/kuroevtd.d/resetpress, + +files/kuroevtd.initd, +metadata.xml, +kuroevtd-1.1.3.ebuild: + new ebuild for kurobox button event monitoring + diff --git a/sys-apps/kuroevtd/Manifest b/sys-apps/kuroevtd/Manifest new file mode 100644 index 000000000000..0138000570c9 --- /dev/null +++ b/sys-apps/kuroevtd/Manifest @@ -0,0 +1,7 @@ +MD5 804574fc3c4758cb6cb3cac81eafacc5 kuroevtd-1.1.3.ebuild 1323 +MD5 b6bd61ed2635d004501be297d9a3496d files/kuroevtd.initd 535 +MD5 9ee57cc3ef125b722d1f849ffaffefcb files/digest-kuroevtd-1.1.3 61 +MD5 9c01a7a8770e8b6531bcb04e2fcf15b8 files/kuroevtd.d/powerpress 146 +MD5 79d71a7e07783badf6d245d4359f3fbd files/kuroevtd.d/resetpress 274 +MD5 4f073418728e4b5baf8104f16cea5123 files/kuroevtd.d/powerdown 418 +MD5 2801389561cbf0e6bb92c9d81e4bf232 files/kuroevtd.d/powerup 184 diff --git a/sys-apps/kuroevtd/files/digest-kuroevtd-1.1.3 b/sys-apps/kuroevtd/files/digest-kuroevtd-1.1.3 new file mode 100644 index 000000000000..564f734d6c3b --- /dev/null +++ b/sys-apps/kuroevtd/files/digest-kuroevtd-1.1.3 @@ -0,0 +1 @@ +MD5 6b00820a543ab8729281c158dc322847 kuroevtd_1.1.3.tgz 5575 diff --git a/sys-apps/kuroevtd/files/kuroevtd.d/powerdown b/sys-apps/kuroevtd/files/kuroevtd.d/powerdown new file mode 100644 index 000000000000..8901b077ea11 --- /dev/null +++ b/sys-apps/kuroevtd/files/kuroevtd.d/powerdown @@ -0,0 +1,19 @@ +#!/bin/bash + +STATE_DIR="/var/lib/kuroevtd" +debug=true + +current=$(date +%s) + +if [ -f "${STATE_DIR}/last" ] ; then + read last <<<$(cat "${STATE_DIR}/last") + rm -f ${STATE_DIR}/last + if (( current <= (last+3) )) ; then + ${debug} && echo "[kuroevtd] powerdown: will reset soon..." + touch ${STATE_DIR}/reset + exit 0 + fi +fi + +${debug} && echo "[kuroevtd] powerdown: saving push date" +echo ${current} > "${STATE_DIR}/last" diff --git a/sys-apps/kuroevtd/files/kuroevtd.d/powerpress b/sys-apps/kuroevtd/files/kuroevtd.d/powerpress new file mode 100644 index 000000000000..df842a83fb42 --- /dev/null +++ b/sys-apps/kuroevtd/files/kuroevtd.d/powerpress @@ -0,0 +1,8 @@ +#!/bin/sh + +STATE_DIR="/var/lib/kuroevtd" +debug=true + +${debug} && echo "[kuroevtd] powerpress: shutdown now!" +rm -f ${STATE_DIR}/* +shutdown -h now diff --git a/sys-apps/kuroevtd/files/kuroevtd.d/powerup b/sys-apps/kuroevtd/files/kuroevtd.d/powerup new file mode 100644 index 000000000000..78985218a3d4 --- /dev/null +++ b/sys-apps/kuroevtd/files/kuroevtd.d/powerup @@ -0,0 +1,10 @@ +#!/bin/sh + +STATE_DIR="/var/lib/kuroevtd" +debug=true + +if [ -f "${STATE_DIR}/reset" ] ; then + ${debug} && echo "[kuroevtd] powerup: reset now!" + rm -f ${STATE_DIR}/* + shutdown -r now +fi diff --git a/sys-apps/kuroevtd/files/kuroevtd.d/resetpress b/sys-apps/kuroevtd/files/kuroevtd.d/resetpress new file mode 100644 index 000000000000..56dd3a61a17a --- /dev/null +++ b/sys-apps/kuroevtd/files/kuroevtd.d/resetpress @@ -0,0 +1,12 @@ +#!/bin/bash + +STATE_DIR="/var/lib/kuroevtd" +debug=true + +${debug} && echo "[kuroevtd] powerpress: reset in EM mode now!" +if grep -q started <<<$(/etc/init.d/em-fallback status 2>/dev/null) ; then + /etc/init.d/em-fallback stop +fi +rm -f ${STATE_DIR}/* +write_ng +shutdown -r now diff --git a/sys-apps/kuroevtd/files/kuroevtd.initd b/sys-apps/kuroevtd/files/kuroevtd.initd new file mode 100644 index 000000000000..89216bd745b4 --- /dev/null +++ b/sys-apps/kuroevtd/files/kuroevtd.initd @@ -0,0 +1,26 @@ +#!/sbin/runscript + +[ -z "${PIDFILE}" ] && PIDFILE=/var/run/kuroevtd.pid + +depend() { + need kuro-avr-init +} + +start() { + ebegin "Starting Kurobox button events monitor" + start-stop-daemon --start --quiet --exec /usr/sbin/kuroevtd \ + || eend 1 \ + || return 1 + local mypid=$(pidof /usr/sbin/kuroevtd 2>/dev/null) + [ -n "${mypid}" ] && echo ${mypid} > ${PIDFILE} + eend 0 +} + +stop() { + ebegin "Stopping Kurobox button events monitor" + start-stop-daemon --stop --quiet --pidfile=${PIDFILE} + local status=$? + rm -f ${PIDFILE} + eend $status +} + diff --git a/sys-apps/kuroevtd/kuroevtd-1.1.3.ebuild b/sys-apps/kuroevtd/kuroevtd-1.1.3.ebuild new file mode 100644 index 000000000000..e48a7c473154 --- /dev/null +++ b/sys-apps/kuroevtd/kuroevtd-1.1.3.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/kuroevtd/kuroevtd-1.1.3.ebuild,v 1.1 2006/01/21 21:24:13 nerdboy Exp $ + +DESCRIPTION="Monitor the Kurobox' power/reset buttons" +HOMEPAGE="http://kuro.dsk.jp/" +SRC_URI="http://kuro.dsk.jp/data/bin/${PN}_${PV}.tgz" +RESTRICT="nomirror nostrip" +LICENSE="as-is" +SLOT="0" +KEYWORDS="ppc" +IUSE="" +DEPEND="sys-apps/sed" + +S=${WORKDIR}/${PN} + +src_unpack() { + unpack ${A} + sed -i -e 's:/etc/kuroevtd:\0.d:' \ + ${S}/kuroevtd.c ${S}/README +} + +src_compile() { + make kuroevtd || die "Failed to compile kuroevtd." +} + +src_install() { + + dodir /usr/sbin + dosbin kuroevtd + dodoc README + + dodir /etc/init.d + newinitd "${FILESDIR}/kuroevtd.initd" kuroevtd + + dodir /etc/kuroevtd.d + exeinto /etc/kuroevtd.d + local button evt script + for button in power reset ; do + for evt in up down press ; do + script="${FILESDIR}/kuroevtd.d/${button}${evt}" + if [ -f "${script}" ] ; then + doexe "${script}" + else + echo "#!/bin/sh" > "${button}${evt}" + doexe "${button}${evt}" + fi + done + done + + dodir /var/lib/kuroevtd + keepdir /var/lib/kuroevtd +} + +pkg_postinst() { + if [ "${ROOT}" = "/" ] \ + && [ ! -f /etc/runlevels/boot/kuroevtd ] ; then + rc-update add kuroevtd boot + fi +} + +pkg_postrm() { + if [ "${ROOT}" = "/" ] \ + && [ ! -f /usr/sbin/kuroevtd ] ; then + rc-update del kuroevtd boot + fi +} diff --git a/sys-apps/kuroevtd/metadata.xml b/sys-apps/kuroevtd/metadata.xml new file mode 100644 index 000000000000..ce55fca05a2c --- /dev/null +++ b/sys-apps/kuroevtd/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>ppc</herd> +<maintainer> + <email>nerdboy@gentoo.org</email> + <name>Steve Arnold</name> +</maintainer> +<longdescription>A set of scripts to monitor and respond to button presses on a Kurobox.</longdescription> +</pkgmetadata> |