File acpid.spec of Package acpid

#
# spec file for package acpid
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           acpid
Version:        2.0.16
Release:        0
License:        GPL-2.0+
Summary:        Executes Actions at ACPI Events
Url:            http://tedfelix.com/linux/acpid-netlink.html
Group:          System/Daemons
Source:         http://tedfelix.com/linux/%{name}-%{version}.tar.gz
Source2:        rcacpid
Source3:        README.SuSE
Source4:        thinkpad_acpi.modprobe
Source5:        events.power_button
Source9:        events.thinkpad
Source6:        thinkpad_handler
Source7:        power_button
Source8:        acpid.service
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1:         acpid-makefile.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch2:         acpid-wrong-memset.patch
BuildRequires:  systemd
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64 ia64
%systemd_requires

%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.

%prep
%setup -q
%patch1
%patch2 

cp %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE9} .

%build
export LDFLAGS="-Wl,-z,relro,-z,now"
%configure 
make OPT="%{optflags}" %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} SBINDIR=%{_sbindir}
install -Dm 744 rcacpid %{buildroot}%{_initddir}/acpid
install -Dm 644 thinkpad_acpi.modprobe %{buildroot}%{_sysconfdir}/modprobe.d/50-thinkpad_acpi.conf
install -Dm 744 thinkpad_handler %{buildroot}%{_prefix}/lib/acpid/thinkpad_handler
install -Dm 744 power_button %{buildroot}%{_prefix}/lib/acpid/power_button
mkdir -p %{buildroot}%{_prefix}/sbin
ln -sf ../../etc/init.d/acpid %{buildroot}%{_sbindir}/rcacpid
install -Dm 644 events.power_button %{buildroot}%{_sysconfdir}/acpi/events/power_button
install -Dm 644 events.thinkpad %{buildroot}%{_sysconfdir}/acpi/events/thinkpad
mkdir -p %{buildroot}/%{_unitdir}
install -m 644 %{SOURCE8} %{buildroot}/%{_unitdir}

# for the rpmlint fascists
mv samples examples
# keep the logfile
install -dm 755 %{buildroot}%{_localstatedir}/log
touch %{buildroot}%{_localstatedir}/log/acpid

%pre
%service_add_pre acpid.service

%post
%{fillup_and_insserv -y -f acpid}
%service_add_post acpid.service

%postun
%restart_on_update acpid
%{insserv_cleanup}
%service_del_postun acpid.service

%preun
%stop_on_removal acpid
%service_del_preun acpid.service

%files
%defattr(-,root,root)
%dir %{_sysconfdir}/modprobe.d
%dir %{_sysconfdir}/acpi
%dir %{_sysconfdir}/acpi/events
%{_sysconfdir}/acpi/events/thinkpad
%{_sysconfdir}/acpi/events/power_button
%{_prefix}/lib/acpid
%{_sysconfdir}/init.d/acpid
%{_sysconfdir}/modprobe.d/50-thinkpad_acpi.conf
%_unitdir/%{name}.service
%{_sbindir}/rcacpid
%{_sbindir}/acpid
%{_sbindir}/kacpimon
%{_bindir}/acpi_listen
%doc README.SuSE README Changelog examples
%{_mandir}/man8/acpid.8.gz
%{_mandir}/man8/acpi_listen.8.gz
%{_mandir}/man8/kacpimon.8.gz
%ghost %config(noreplace,missingok) %{_localstatedir}/log/acpid

%changelog
openSUSE Build Service is sponsored by