#
# spec file for package acpid (Version 1.0.4)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           acpid
URL:            http://acpid.sourceforge.net/
Version:        1.0.4
Release:        81
%define       acpi_version 0.09
License:        GNU General Public License (GPL)
Group:          System/Daemons
Autoreqprov:    on
PreReq:         %insserv_prereq %fillup_prereq
Summary:        Executes Actions at ACPI Events
Source:         %{name}-%{version}.tar.gz
Patch:          %{name}-%{version}.dif
Source1:        acpi-%{acpi_version}.tar.bz2
Source2:        rcacpid
Source3:        README.SuSE
Source4:        ibm_acpi.modprobe
Source5:        events.default
Patch1:         acpi_%{acpi_version}.dif
Patch2:         acpid-1.0.4-signedness.diff 
Patch3:         acpid-1.0.4-close-fd-on-client-disconnect.diff
Patch4:         acpid-1.0.4-use-syslog.diff
Patch5:         acpid-1.0.4-skip-editor-backup-files.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 x86_64 ia64

%description
ACPID is a completely flexible, totally extensible daemon for
delivering ACPI events. It listens to a file (/proc/acpi/event) and,
when an event occurs, executes programs to handle the event. The start
script loads all needed modules.

Configure it in /etc/sysconfig/powermanagement.



Authors:
--------
    Andrew Grover <andrew.grover@intel.com>
    Tim Hockin <thockin@sun.com>
    Cajus Pollmeier <pollmeier@gonicus.de>

%prep
%setup -b 0 -a 1
%patch
%patch1
pushd acpi-%{acpi_version}
popd
%patch2
%patch3
%patch4 -p1
%patch5
cp %{S:2} %{S:3} %{S:4} %{S:5} .

%build
make EXTRA_CFLAGS="$RPM_OPT_FLAGS -DUSE_SYSLOG"
pushd acpi-%{acpi_version}
ln -sf /usr/share/automake*/install-sh install-sh
./configure
make CFLAGS="$RPM_OPT_FLAGS"
popd

%install
make install INSTPREFIX=%{buildroot} SBINDIR=%{buildroot}/sbin
install -Dm 744 rcacpid %{buildroot}/etc/init.d/acpid
install -Dm 644 ibm_acpi.modprobe %{buildroot}/etc/modprobe.d/ibm_acpi
mkdir -p %{buildroot}/usr/sbin
ln -sf ../../etc/init.d/acpid %{buildroot}/usr/sbin/rcacpid
install -Dm 644 events.default %{buildroot}/etc/acpi/events/default
pushd acpi-%{acpi_version}
ln -sf /usr/share/automake*/mkinstalldirs mkinstalldirs
make prefix=%{buildroot}/usr install
install -Dm 644 acpi.1 %{buildroot}/%{_mandir}/man1/acpi.1
popd
mkdir -p %{buildroot}/var/lib/acpi
# keep the logfile
install -dm 755 %buildroot%_var/log
touch %buildroot%_var/log/acpid

%clean
rm -rf %{buildroot}

%post
%{fillup_and_insserv -Y -f acpid}
rm -f -- var/lib/acpi/*

%postun
%restart_on_update acpid
%{insserv_cleanup}

%preun 
%stop_on_removal acpid

%files
%defattr(-,root,root)
%dir /etc/modprobe.d
%dir /etc/acpi
%dir /etc/acpi/events
/etc/acpi/events/default
/etc/init.d/acpid
/etc/modprobe.d/ibm_acpi
/usr/sbin/rcacpid
/sbin/acpid
/usr/bin/acpi_listen
%doc README.SuSE README Changelog samples
/usr/share/man/man8/acpid.8.gz
/usr/share/man/man8/acpi_listen.8.gz
/usr/bin/acpi
/usr/share/man/man1/acpi.1.gz
%ghost %config(noreplace,missingok) %_var/log/acpid
%dir %attr(0750, root, root) /var/lib/acpi

%changelog
* Tue Jun 19 2007 - thoenig@suse.de
- Add $local_fs to Required-Start (b.n.c #285472)
* Mon Jun 04 2007 - lrupp@suse.de
- clean builddir after build is finished
- own /var/log/acpid (#280469)
* Tue Apr 24 2007 - trenn@suse.de
- compile some more files with rpm_opt flags
- remove/fix:
  +E: acpid unknown-lsb-tag # X-UnitedLinux-Should-Start:
  +E: acpid unknown-lsb-tag # X-UnitedLinux-Should-Stop:
* Tue Apr 10 2007 - hmacht@suse.de
- add modules dock and bay to probed laptop modules
* Thu Mar 29 2007 - rguenther@suse.de
- add /etc/modprobe.d directory
* Fri Nov 17 2006 - hmacht@suse.de
- remove CPUFreq modules loading, acpid is not available on all
  architectures. Move handling to proper place --> HAL init script
  (novell bug 220682)
* Mon Nov 13 2006 - hmacht@suse.de
- do not "fail" if there is no CPUFreq support, print descriptive
  message instead (novell bug 219757)
* Wed Oct 18 2006 - seife@suse.de
- unload asus_acpi on unsupported machines.
- load cpufreq_acpi after speedstep-smi module.
- load the cpufreq_conservative governor (bug 163767).
- ignore editor backup files for the event configuration.
- package the provided action script samples under documentation.
- cleanup the specfile %%prep section.
* Tue Oct 17 2006 - hmacht@suse.de
- load CPUFreq modules before acpi modules, otherwise we would
  exit without acpi support
* Tue Sep 12 2006 - hmacht@suse.de
- load CPUFreq modules in acpid for now because they have to be
  already loaded when HAL starts
* Thu Jun 01 2006 - thoenig@suse.de
- rcacpid: do not probe unsupported modules if
  LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY is set to yes
  (b.n.c #180654)
- rcacpid: be verbose about which modules are being probed or
  loaded.
* Tue Feb 21 2006 - rw@suse.de
- never try laptop modules on ia64 (bug #146291)
* Wed Feb 15 2006 - thoenig@suse.de
- revert hotkey mask for IBM ACPI back to 0xffff (bug #150357)
- add documentation hints for IBM ACPI driver
* Thu Feb 09 2006 - seife@suse.de
- do not try the hotkey modules on ia64 (bug #146291)
* Mon Feb 06 2006 - seife@suse.de
- do not load ac and battery modules on ia64 (bug #140249)
- untangle the "suse-files.tar" packaging mess
- after a kernel update, rescan the laptop modules
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Nov 24 2005 - seife@suse.de
- move daemon from /usr/sbin to /sbin to remove the $remote_fs
  dependency and start sooner
- log via syslog instead of using the own logfile mechanism
* Tue Oct 25 2005 - thoenig@suse.de
- changed hotkey mask for ibm_acpi from 0xffff to 0xffef so that
  the driver does not block Fn-F5 (switch Bluetooh on/off) on IBM
  ThinkPads (closes #128088)
* Wed Oct 05 2005 - dmueller@suse.de
- add norootforbuild
* Sat Sep 24 2005 - seife@suse.de
- rework last patch, fix a memleak in addition to the fd leak.
* Fri Sep 23 2005 - seife@suse.de
- fix filedescriptor leak on client disconnect (bug #117884)
* Thu Sep 08 2005 - thoenig@suse.de
- fixed probing of laptop modules (closes #115819)
* Wed Sep 07 2005 - thoenig@suse.de
- changed modprobe.d/ibm_acpi to be even more verbose (more Fn-Fxx
  will be reported (see #115127 and closes re-opened #113625)
* Wed Aug 31 2005 - ro@suse.de
- removed config-dist.sh (ExclusiveArch is already there)
* Tue Aug 30 2005 - thoenig@suse.de
- added sony_acpi and pcc_acpi to be probed on first run (SUSE
  feature request r6125)
* Mon Aug 29 2005 - thoenig@suse.de
- fixed probe function of rcacpid
* Mon Aug 29 2005 - thoenig@suse.de
- added install parameter for ibm_acpi to enable verbose output
  of hotkey (#113625)
* Thu Aug 25 2005 - thoenig@suse.de
- rcacpid now probes laptop modules once and will only
  load those modules at a later point if modprobe succeeded.
* Wed Aug 10 2005 - thoenig@suse.de
- added three modules to DEFAULT_ACPI_MODULES:
  * asus_acpi
  * ibm_acpi
  * toshiba_acpi
- added $SYSCONFDIR/modprobe.d/ibm_acpi for ibm_acpi to load the
  module with "experimental=1"
* Fri Aug 05 2005 - seife@suse.de
- load ACPI modules in /etc/init.d/acpid.
* Fri Aug 05 2005 - trenn@suse.de
- Activate acpid by default again (use -Y to force, was disabled
  in old setups, but we need it urgently now)
- Deleted suse stuff (acpid_proxy,...), only use acpid to forward
  acpi events to other apps/services.
- updated acpid (1.0.3 -> 1.0.4) acpi (0.07 -> 0.09)
- changed config to not process acpi events, just forward them
* Mon May 02 2005 - mmj@suse.de
- Fix warning about chdir return value not being caught
* Mon Apr 04 2005 - pth@suse.de
- Fix signed/unsigned warnings
* Thu Nov 25 2004 - zoz@suse.de
- rcacpid status now reports service acpid as unused if acpid was
  started from rcpowersaved (Bug 48432)
* Thu Nov 11 2004 - zoz@suse.de
- added /var/lib/acpi with proper permissions to filelist. Further
  acpid_proxy won't create that dir if missing. (Bug 47729)
* Mon Sep 06 2004 - seife@suse.de
- clean up config file for sysconfig editor
* Thu Aug 26 2004 - trenn@suse.de
- deleted debian stuff
* Fri Aug 13 2004 - trenn@suse.de
- updated to acpid from 1.0.1 to version 1.0.3 and
  acpi Version from 0.06 to 0.07
* Fri May 14 2004 - trenn@suse.de
- P4 Hyperthreading patch from pth@suse (#39017)
* Tue Apr 06 2004 - trenn@suse.de
- rcacpid stop  does not return skipped anymore on none acpi systems
  this prevented acpid to uninstall on these systems  (#38508)
* Thu Mar 18 2004 - seife@suse.de
- updated README.SuSE and default config (#36208)
* Wed Mar 03 2004 - trenn@suse.de
- add %%restart_on_update and %%stop_on_removal in .spec file
* Tue Feb 24 2004 - trenn@suse.de
- deleted ac_on_power, is now in powersave package
* Mon Feb 23 2004 - trenn@suse.de
- deleted -y parameter in inserv, to not start by default
  powersave gets confused otherwise, only one daemon is allowed
  to access /proc/acpi/event
* Wed Nov 05 2003 - olh@suse.de
- do not start the build if not required
* Mon Sep 22 2003 - zoz@suse.de
- fixed naming of actions in acpid_proxy (Bug 31357)
- fixed metadata and description of actions in sysconfig template
  (Bug 31357)
- fixed startscript to unload modules if requested (Bug 31357)
- set default action for lid closure to 'ignore', because 'throttle'
  breaks some laptops (Bug 31529)
* Sun Sep 21 2003 - ro@suse.de
- fix typo in sysconfig-file
* Thu Sep 18 2003 - trenn@suse.de
- bug 30913 and 31265
  lid state is now read out correctly (CLOSE->CLOSED)
  corrected parts for throttling
  action kde_term fixed (determine kde user)
  action kde_logout additionally added
* Tue Sep 16 2003 - trenn@suse.de
- bug 30399 -> lid read out of /proc/acpi/lid/... now
  and changed frequency scaling from deprecated /acpi/processor
  to cpufreqd
* Wed Sep 10 2003 - kukuk@suse.de
- rcacpid: Fix return codes, fix try-restart, fix probe (don't
  compare with non existing FOO config file), fix restart (restart
  should honor modified sysconfig file).
* Tue Sep 02 2003 - trenn@suse.de
- on_ac_adapter: more stable and
  check for desktop
  start acpid by default
* Thu Aug 28 2003 - trenn@suse.de
- fixed bug in sysconfig.acpi template
* Thu Aug 28 2003 - trenn@suse.de
- added on_ac_power
* Tue Aug 26 2003 - trenn@suse.de
- added action tags for sysconfig file
* Thu Aug 14 2003 - ro@suse.de
- added exclusivearch line to specfile
* Sun Jul 20 2003 - zoz@suse.de
- Removed ACPI_MODULES_NOT_TO_LOAD from /etc/init.d/acpid and
  /etc/sysconfig/powermanagement. now we use ACPI_MODULES instead.
  This works also with 2.5/6 kernels and you may add one of the
  modules asus_acpi or toshiba_acpi to this variable.
* Sat Mar 01 2003 - zoz@suse.de
- fixed acpid: Did not call acpid_proxy with event information
- splitted ACPI_BUTTON_LID into ACPI_BUTTON_LID_OPEN and
  ACPI_BUTTON_LID_CLOSE
- added some actions for button events to acpid_proxy
  + kde_term     (terminate all KDE sessions)
  + wmaker_term  (terminate all wmaker sessions)
  + standby      (switches to S1. This may crash the system. Test it before!)
  + suspend      (switches to S3 if kernel is 2.5 or newer)
  + hibernate    (switches to S4 if kernel is 2.5 or newer
  + throttle     (reduce processor performance, enable maximum processor throttlin
  put disk into sleep state)
  + dethrottle   (restore settings like before throttle)
- for proper throttling added ACPI_THROTTLED_DISK_TIMEOUT and
  ACPI_THROTTLED_KUPDATED_INTERVAL
- provided some usefull information in README.SuSE
* Mon Feb 24 2003 - zoz@suse.de
- enhanced sysconfig metadata and descriptions
- added ACPI_MODULES_NOT_TO_UNLOAD, because there are modules which
  oops when unloaded
- added ACPI_BUTTON_SLEEP
- added some more actions for button events
* Sat Feb 22 2003 - mmj@suse.de
- Add sysconfig metadata [#22676]
* Sat Feb 08 2003 - zoz@suse.de
- added 'acpi': a tool providing battery and thermal information
  (like apm in package apmd)
* Tue Sep 17 2002 - ro@suse.de
- removed bogus self-provides
* Fri Sep 06 2002 - zoz@suse.de
- added comments to sysconfig variables (Bug 18654)
- fixed specfile to fillup /etc/sysconfig/powermanagement properly
* Tue Aug 13 2002 - zoz@suse.de
- added PreReq insserv_prereq fillup_prereq
* Tue Aug 06 2002 - zoz@suse.de
- initial package: version 1.0.1
- added init script which loads acpi modules as well
- provided acpid_proxy (apmd like) which cares about all events