2014-01-14 12:07:01 +01:00
|
|
|
#
|
|
|
|
# spec file for package powerd
|
|
|
|
#
|
2016-01-21 12:39:47 +01:00
|
|
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
2014-01-14 12:07:01 +01:00
|
|
|
#
|
|
|
|
# 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: powerd
|
|
|
|
Version: 2.0.2
|
|
|
|
Release: 0
|
|
|
|
Summary: UPS monitoring daemon
|
|
|
|
License: GPL-2.0+
|
|
|
|
Group: System/Base
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2014-08-21 14:33:30 +02:00
|
|
|
BuildRequires: systemd-rpm-macros
|
2014-01-14 12:07:01 +01:00
|
|
|
Url: https://power.sourceforge.net/
|
|
|
|
Source0: powerd-%{version}.tar.bz2
|
|
|
|
Source2: powerd.service
|
|
|
|
Patch0: powerd-%{version}.dif
|
|
|
|
Patch1: powerd-%{version}-getaddrinfo.patch
|
2014-08-21 14:33:30 +02:00
|
|
|
%if %{undefined _unitdir}
|
|
|
|
%{expand: %%global %_unitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
|
|
|
|
%endif
|
2014-01-14 12:07:01 +01:00
|
|
|
|
|
|
|
%description -n powerd
|
|
|
|
powerd monitors the serial port connected to an UPS device and will perform
|
|
|
|
an unattended shutdown of the system if the UPS is on battery longer
|
|
|
|
than a specified number of minutes.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
%patch0
|
|
|
|
%patch1
|
|
|
|
%_fixowner .
|
|
|
|
%_fixgroup .
|
|
|
|
/bin/chmod -Rf a+rX,g-w,o-w .
|
|
|
|
|
|
|
|
%build
|
|
|
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS} $(getconf LFS_CFLAGS) -pipe"
|
|
|
|
CC=%__cc
|
|
|
|
export RPM_OPT_FLAGS CC
|
|
|
|
%configure --prefix= --bindir='$(DESTDIR)/sbin' \
|
|
|
|
--mandir='$(DESTDIR)%{_mandir}' \
|
|
|
|
--sbindir='$(DESTDIR)/sbin'
|
|
|
|
make %{?_smp_mflags} CFLAGS="-I. $RPM_OPT_FLAGS -DWITH_SYSVINIT"
|
|
|
|
|
|
|
|
%install
|
|
|
|
mkdir -m 755 -p %{buildroot}/etc
|
|
|
|
mkdir -m 755 -p %{buildroot}/sbin
|
2014-08-21 14:33:30 +02:00
|
|
|
mkdir -m 755 -p %{buildroot}%{_sbindir}
|
2014-01-14 12:07:01 +01:00
|
|
|
mkdir -m 755 -p %{buildroot}%{_mandir}/man8
|
|
|
|
make install DESTDIR=%{buildroot}
|
|
|
|
echo '# ' > %{buildroot}/etc/powerd.conf
|
2014-01-15 10:19:45 +01:00
|
|
|
echo '# /etc/powerd.conf for powerd version-%{version}' >> %{buildroot}/etc/powerd.conf
|
2014-01-14 12:07:01 +01:00
|
|
|
echo '# ' >> %{buildroot}/etc/powerd.conf
|
|
|
|
echo '# read manual page of detectups(8) and powerd(8) its self.' >> %{buildroot}/etc/powerd.conf
|
|
|
|
echo '# ' >> %{buildroot}/etc/powerd.conf
|
|
|
|
echo '# to enable powerd service run the command' >> %{buildroot}/etc/powerd.conf
|
|
|
|
echo '# systemctl enable powerd.service' >> %{buildroot}/etc/powerd.conf
|
|
|
|
echo '# systemctl start powerd.service' >> %{buildroot}/etc/powerd.conf
|
2014-08-21 14:33:30 +02:00
|
|
|
mkdir -p %{buildroot}/%{_unitdir}
|
|
|
|
install -m 0644 %{S:2} %{buildroot}/%{_unitdir}/powerd.service
|
|
|
|
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcpowerd
|
2014-01-14 12:07:01 +01:00
|
|
|
|
|
|
|
%preun
|
|
|
|
%stop_on_removal powerd
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%restart_on_update powerd
|
|
|
|
|
|
|
|
%files -n powerd
|
|
|
|
%defattr (-,root,root,755)
|
|
|
|
%doc README COPYING SUPPORTED FAQ powerd.conf.monitor powerd.conf.peer
|
|
|
|
/sbin/powerd
|
|
|
|
/sbin/detectups
|
2014-08-21 14:33:30 +02:00
|
|
|
%{_sbindir}/rcpowerd
|
2014-01-14 12:07:01 +01:00
|
|
|
%config /etc/powerd.conf
|
2014-08-21 14:33:30 +02:00
|
|
|
%attr(0644,root,root) %{_unitdir}/powerd.service
|
2014-01-14 12:07:01 +01:00
|
|
|
%doc %{_mandir}/man8/powerd.8.gz
|
|
|
|
%doc %{_mandir}/man8/detectups.8.gz
|
|
|
|
|
|
|
|
%changelog
|