sysvinit/powerd.spec
Dr. Werner Fink 71f7b74020 Accepting request 829755 from home:dimstar:Factory
- Drop /bin/pidof and /sbin/pidof, including corresponding man
  page: let's switch to pidof as provided by procps-ng.

- Update to sysvinit 2.97:
  * Check $(ROOT) filesystem for libcrypt instead of a hardcoded
    path to /usr.
  * Code clean-up and making sure we avoid freeing unused memory.
  * Added shell script which converts systemd unit files into
    init.d style scripts.
  * Allow init to load configuration data from files stored in
    /etc/inittab.d/
  * Allow shutdown time to be specified in the format +hh:mm. This
    is in addition to the existing formats such as hh:mm, +m, and
    "now".
  * Fixed typos in manual pages.
- Update startpar to 0.65:
  + Make sure startpar testsuite can find insserv executable in
    /usr/sbin or /sbin.
  + Added PREFIX variable to Makefile and testsuite to make
    location of startpar and insserv more flexible.
- Rebase sysvinit-2.90.dif.
- Drop SCVER defines: not used in any place.
- Drop startpar-sysmacros.patch: fixed upstream.

OBS-URL: https://build.opensuse.org/request/show/829755
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysvinit?expand=0&rev=243
2020-09-15 06:17:21 +00:00

101 lines
3.2 KiB
RPMSpec

#
# spec file for package powerd
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name: powerd
Version: 2.0.2
Release: 0
Summary: UPS monitoring daemon
License: GPL-2.0-or-later
Group: System/Base
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: systemd-rpm-macros
URL: https://power.sourceforge.net/
Source0: powerd-%{version}.tar.bz2
Source2: powerd.service
Patch0: powerd-%{version}.dif
Patch1: powerd-%{version}-getaddrinfo.patch
%if %{undefined _unitdir}
%{expand: %%global %_unitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
%endif
%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
mkdir -m 755 -p %{buildroot}%{_sbindir}
mkdir -m 755 -p %{buildroot}%{_mandir}/man8
make install DESTDIR=%{buildroot}
echo '# ' > %{buildroot}/etc/powerd.conf
echo '# /etc/powerd.conf for powerd version-%{version}' >> %{buildroot}/etc/powerd.conf
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
mkdir -p %{buildroot}/%{_unitdir}
install -m 0644 %{S:2} %{buildroot}/%{_unitdir}/powerd.service
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcpowerd
%pre
%service_add_post powerd.service
%preun
%service_del_preun powerd.service
%post
%service_add_post powerd.service
%postun
%service_del_postun powerd.service
%files -n powerd
%defattr (-,root,root,755)
%license COPYING
%doc README SUPPORTED FAQ powerd.conf.monitor powerd.conf.peer
/sbin/powerd
/sbin/detectups
%{_sbindir}/rcpowerd
%config /etc/powerd.conf
%attr(0644,root,root) %{_unitdir}/powerd.service
%doc %{_mandir}/man8/powerd.8.gz
%doc %{_mandir}/man8/detectups.8.gz
%changelog