Mercurial > vanilla
changeset 19:175f1197d6bb
system/acpid: initial import, closes #1011
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 23 Feb 2019 12:41:39 +0100 |
parents | 55de38cecaf7 |
children | 8370b44de961 |
files | system/acpid/acpid.info system/acpid/acpid.sh system/acpid/rc.acpid |
diffstat | 3 files changed, 137 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/acpid/acpid.info Sat Feb 23 12:41:39 2019 +0100 @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2019 David Demelier <markand@malikania.fr> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PKGNAME=acpid +PKGVERSION=2.0.31 +PKGREVISION=1 +PKGSUMMARY="daemon for ACPI and netlink events" +PKGDOWNLOAD="https://downloads.sourceforge.net/sourceforge/acpid2/$PKGNAME-$PKGVERSION.tar.xz"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/acpid/acpid.sh Sat Feb 23 12:41:39 2019 +0100 @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Copyright (c) 2019 David Demelier <markand@malikania.fr> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +source ./acpid.info + +case $(uname -m) in +x86_64) + CFLAGS="-O2 -fPIC" + ;; +*) + CFLAGS="-O2" + ;; +esac + +set -e + +rm -rf $PKGNAME-$PKGVERSION +tar xvaf $PKGNAME-$PKGVERSION.tar.xz +pushd $PKGNAME-$PKGVERSION + +CFLAGS="$CFLAGS" ./configure --prefix=/usr +make +make install DESTDIR=$DESTDIR + +popd +mkdir -p $DESTDIR/etc/rc.d +cp rc.acpid $DESTDIR/etc/rc.d + +rm -rf $PKGNAME-$PKGVERSION
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/acpid/rc.acpid Sat Feb 23 12:41:39 2019 +0100 @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (c) 2019 David Demelier <markand@malikania.fr> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +if [ -r /etc/rc.conf ]; then + . /etc/rc.conf +fi + +: ${ACPID_CMD:=/usr/sbin/acpid} +: ${ACPID_ARGS:=--netlink} +: ${ACPID_PID:=/var/run/acpid/acpid.pid} + +acpid_start() +{ + echo "Starting acpid: $ACPID_CMD $ACPID_ARGS" + $ACPID_CMD $ACPID_ARGS -p $ACPID_PID +} + +acpid_status() +{ + if [ -s $ACPID_PID ]; then + echo "acpid is running with pid: `cat $ACPID_PID`" + else + echo "acpid is not running" + fi +} + +acpid_stop() +{ + if [ -s $ACPID_PID ]; then + echo "Stopping acpid..." + kill -QUIT $ACPID_PID + fi +} + +acpid_restart() +{ + acpid_stop + sleep 3 + acpid_start +} + +case $1 in +start) + acpid_start + ;; +status) + acpid_status + ;; +stop) + acpid_stop + ;; +restart) + acpid_restart + ;; +*) + echo "usage: $(basename $0) restart|start|status|stop" + ;; +esac