Summary: ACPI Event Daemon
Summary(ja): ACPI イベントデーモン
Name: acpid
Version: 2.0.2
Release: 1%{?_dist_release}
License: GPL
Group: System Environment/Daemons
URL: http://tedfelix.com/linux/acpid-netlink.html

Source: http://tedfelix.com/linux/acpid-%{version}.tar.gz
Source1: acpid.init
Source2: acpid.video.conf
Source3: acpid.power.conf
Source4: acpid.power.sh

Patch1: acpid-2.0.2-makefile.patch
Patch2: acpid-2.0.2-no_umask.patch
Patch3: acpid-2.0.2-headers.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires(post): chkconfig
Requires(preun): chkconfig, initscripts

ExclusiveArch: x86_64 %{ix86}

Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke

%description
acpid is a daemon that dispatches ACPI events to user-space programs.
  (bug reports to sunthockin@users.sourceforge.net)

%description -l ja
acpidはACPIイベントをユーザスペースのプログラムへ素早く伝えるデーモンです。
（バグレポートはsunthockin@users.sourceforge.netに送ってください）


%prep
%setup -q
%patch1 -p1 -b .makefile
%patch2 -p1 -b .no_umask
%patch3 -p1 -b .headers

%build
make %{?_smp_mflags}


%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
make install DESTDIR=%{buildroot}

mkdir -p %{buildroot}%{_sysconfdir}/acpi/events
mkdir -p %{buildroot}%{_sysconfdir}/acpi/actions
chmod 755 %{buildroot}%{_sysconfdir}/acpi/events
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/acpi/events/video.conf
install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/acpi/events/power.conf
install -m 755 %{SOURCE4} %{buildroot}%{_sysconfdir}/acpi/actions/power.sh

install -D -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/acpid


%clean
rm -rf $RPM_BUILD_ROOT


%post
# only run on install, not upgrade 
if [ "$1" = "1" ]; then
	/sbin/chkconfig --add acpid
fi
if [ -e /var/log/acpid ]; then
    touch /var/log/acpid
fi


%postun
if [ "$1" -ge "1" ]; then
	/sbin/service acpid condrestart >/dev/null 2>&1
fi


%preun
# only run if this is the last instance to be removed
if [ "$1" = "0" ]; then
	/sbin/service acpid stop > /dev/null 2>&1
	/sbin/chkconfig --del acpid
	rm -f /var/run/acpid.socket
fi


%files
%defattr(-,root,root)
%doc COPYING Changelog README TODO samples
%dir %{_sysconfdir}/acpi
%dir %{_sysconfdir}/acpi/events
%dir %{_sysconfdir}/acpi/actions
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/acpi/events/video.conf
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/acpi/events/power.conf
%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/acpi/actions/power.sh
%{_bindir}/acpi_listen
%{_sbindir}/acpid
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/acpid
%{_mandir}/man8/acpid.8*
%{_mandir}/man8/acpi_listen.8*


%changelog
* Tue Mar 16 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.2-1
- new upstream release

* Sat May  9 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.0.10-1
- new upstream release: fixes CVE-2009-0798 (too many open files DoS)
- fix power.sh (Source4) to work with ConsoleKit >= 0.3.0
  (ck-list-sessions now returns 'unix-user' instead of 'uid')
  without this fix, pressing power key will always goes to shutdown
  even if gnome-power-manager is active and running
- add ExclusiveArch: x86_64 %%{ix86}

* Mon Aug 11 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.6-4
- add patch10 to ignore .rpmnew file
- add power button handling script and config
- import some patches from fedora
  - add rpm's optflags to makefile
  - Fixed leak of a file descriptor
  - Fixed dumping useless info to log

* Mon Aug 11 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.0.6-3
- spec in UTF-8
- adjust start/stop priority not to conflict with HAL

* Sun Apr 06 2008 Kazutaka HARADA <Kazutaka@dc4.so-net.ne.jp> 1.0.6-2
- rebuild
- apply new versioning policy

* Sun Jul 1 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.0.6-1vl2
- remove %%{_sysconfdir}/logrotate.d/acpid from files
  (from this version, syslog is used for logging)
- remove Source2 (from this version, syslog is used for logging)

* Sun Jul 1 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.0.6-1vl1
- upstream release
- update Source0 URL
- drop Patch0 (merged into upstream source)
- drop Patch1 (solved in another way on upstream source)

* Sat May 26 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.0.4-1vl3
- add Patch1 to rebuild with new toolchain

* Sat Nov 04 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.4-1vl2
- update acpid.init
  - check if ACPI interface is available or not. (<BTS:216>)

* Thu Oct 21 2004 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.0.4-1vl1
- upstream release
- move sample.conf to %doc
- add some new sample scripts to %doc
- MEMO: file acpid-bindir.patch will be unnecessary in next upstream release,
  since the patch is accepted in upstream CVS

* Thu Sep 23 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.3-1vl4
- changed Group:
- added %clean section

* Wed Jul 21 2004 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.0.3-1vl3
- changed redhat/acpid.init tarball into text file
- added Source2: logrotate support

* Thu Jun 24 2004 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.0.3-1vl2
- upstream release
- extract redhat/acpid.init from acpid-1.0.2.tar.gz tarball
- patch Makefile to mkdir %BINDIR before install
- added Japanese Summary
- remove /var/run/acpid.socket at preun
- delete previously commented scripts

* Sun Dec 21 2003 KAZUKI SHIMURA <rito@pos.to> 1.0.2-1vl3
- removed name/version/release macros
- added vendor/distribution tag
- added %%doc (merged with 1.0.2-1vl2 in VinePlus/2.5)
- removed needless chmod/attr
- stop service before uninstall

* Fri Nov 14 2003 Satoshi MACHINO <machino@vinelinux.org> 1.0.2-1vl2
- rebuilt for Vine Seed
- added japanese description
- changed from Copylight to License

* Sun Nov 2 2003  KANEKO Seiji <giraffe@m2.pbc.ne.jp>
  - 1.0.2-1vl1
  - Removed prefix definition
  - Remove /var/log/acpid from package file

* Thu Aug 21 2003  KANEKO Seiji <giraffe@m2.pbc.ne.jp>
  - 1.0.2-1vl0.1
  - Spec file modified for Vine Linux 2.6r1

* Tue May 13 2003  Tim Hockin <thockin@sun.com>
  - Fixed a dumb bug with %e expansion for commands
  - Add COPYING file
  - Add TODO file

* Fri Mar 15 2002  Tim Hockin <thockin@sun.com>
  - Updated RPM spec with patch from sun for chkconfig on/off
  - Add Changelog, make 'make rpm' use it.
  - 1.0.1

* Wed Mar 13 2002  Tim Hockin <thockin@sun.com>
  - Fixed logging bug - not appending to log (O_APPEND needed)
  - Fix 'make install' to not need root access
  - Fix RPM spec to not need root

* Thu Sep 6 2001 Tim Hockin <thockin@sun.com>
  - 1.0.0

* Thu Aug 16 2001  Tim Hockin <thockin@sun.com>
  - Added commandline options to actions

* Wed Aug 15 2001  Tim Hockin <thockin@sun.com>
  - Added UNIX domain socket support
  - Changed /etc/acpid.d to /etc/acpid/events

* Mon Aug 13 2001  Tim Hockin <thockin@sun.com>
  - added changelog
  - 0.99.1-1

