%define _cgibin /var/www/cgi-bin %define _sbindir /sbin # A change in RPM 4.15 causes the make_build macro to misbuild this package. # See https://github.com/rpm-software-management/rpm/issues/798 %global _make_verbose %nil Summary: Power management software for APC UPS hardware Name: apcupsd Version: 3.14.14 Release: %mkrel 5 License: GPLv2 Group: System/Servers URL: https://sourceforge.net/projects/apcupsd/ Source0: https://downloads.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz Source1: apcupsd.service Source2: apcupsd-tmpfiles.conf Source3: apcupsd-httpd.conf Source4: apcupsd.logrotate # From fedora # fix crash in gui, rhbz#578276 Patch0: apcupsd-3.14.9-fixgui.patch # Halt without powering off, rhbz#1442577 Patch1: apcupsd-3.14.4-shutdown.patch # Fix format-security error so we can enable the checks Patch2: apcupsd-format-security.patch # # from debian Patch11: 06-fix-nologin.patch Patch12: 08-fix-loglevels.patch Patch14: 11-wall-on-umounted-usr.patch Patch15: 13-spelling.patch Patch16: 14-update-conf.patch Requires(post): rpm-helper Requires(preun):rpm-helper Requires: tcp_wrappers Requires: nail BuildRequires: pkgconfig(gdlib) BuildRequires: pkgconfig(libusb) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(netsnmp) BuildRequires: pkgconfig(ncurses) BuildRequires: tcp_wrappers-devel BuildRequires: libstdc++-devel BuildRequires: systemd %description UPS power management under Linux for APCC Products. It allows your computer/server to run during power problems for a specified length of time or the life of the batteries in your BackUPS, BackUPS Pro, SmartUPS v/s, or SmartUPS, and then properly executes a controlled shutdown during an extended power failure. %prep %autosetup -p1 # Override the provided platform makefile printf 'install:\n\techo skipped\n' > platforms/mandrake/Makefile # fix attribs find examples -type f | xargs chmod 644 %build export LC_CTYPE=en_US.UTF-8 %configure \ --sysconfdir=%{_sysconfdir}/apcupsd \ --enable-usb \ --enable-modbus-usb \ --enable-net \ --enable-cgi \ --enable-apcsmart \ --enable-dumb \ --enable-pcnet \ --enable-snmp \ --with-cgi-bin=%{_cgibin} \ --with-serial-dev= \ --with-upstype=usb \ --with-halpolicydir="" \ --with-upscable=usb \ --with-lock-dir=/run/lock \ --with-nisip=127.0.0.1 \ --with-pid-dir=%{_rundir} \ --with-libwrap %make_build V= %install install -d %{buildroot}%{_cgibin} %make_install #cgibin=%%{buildroot}%%{_cgibin} install -p -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/apcupsd.service install -p -D -m0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -p -D -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/apcupsd.conf install -p -D -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/apcupsd install -m0644 platforms/etc/apcupsd.conf %{buildroot}%{_sysconfdir}/apcupsd/ install -m0755 platforms/apccontrol %{buildroot}%{_sysconfdir}/apcupsd/ for src in changeme commfailure commok onbattery offbattery; do install -m0744 platforms/etc/$src %{buildroot}%{_sysconfdir}/apcupsd/$src done # cleanup pushd doc/manual rm -f *.rst publishdoc Makefile popd %post %_tmpfilescreate %{name} %_post_service apcupsd %preun %_preun_service apcupsd %files %license COPYING %doc ChangeLog DISCLAIMER Developers ReleaseNotes examples doc/manual %{_unitdir}/apcupsd.service %dir %ghost %attr(0755, root, root) %{_rundir}/apcupsd %{_tmpfilesdir}/%{name}.conf %dir %{_sysconfdir}/apcupsd %config(noreplace) %{_sysconfdir}/apcupsd/* %config(noreplace) %{_sysconfdir}/logrotate.d/apcupsd %config(noreplace) %{_sysconfdir}/httpd/conf.d/apcupsd.conf %{_sbindir}/apcaccess %{_sbindir}/apctest %{_sbindir}/apcupsd %{_sbindir}/smtp %{_cgibin}/multimon.cgi %{_cgibin}/upsfstats.cgi %{_cgibin}/upsimage.cgi %{_cgibin}/upsstats.cgi %{_mandir}/man8/* %{_mandir}/man5/apcupsd.conf.5*