SHA256
1
0
forked from pool/acct

Accepting request 313079 from home:scarabeus_iv:branches:Base:System

- Use just /var/log/acct/pacct file and remove the tmpfiles creation
  completely

- Use try-restart not restart on logrotate update, otherwise we could
  suprisingly start the service for user, which is not desired
- Cleanup with spec-cleaner
- Use tmpfiles creation instead of hand-written shell script

OBS-URL: https://build.opensuse.org/request/show/313079
OBS-URL: https://build.opensuse.org/package/show/Base:System/acct?expand=0&rev=45
This commit is contained in:
Kristyna Streitova 2015-06-22 15:10:08 +00:00 committed by Git OBS Bridge
parent 65a2e23e00
commit 3e6544a8e2
5 changed files with 50 additions and 63 deletions

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Mon Jun 22 12:40:46 UTC 2015 - tchvatal@suse.com
- Use just /var/log/acct/pacct file and remove the tmpfiles creation
completely
-------------------------------------------------------------------
Mon Jun 22 12:11:02 UTC 2015 - tchvatal@suse.com
- Use try-restart not restart on logrotate update, otherwise we could
suprisingly start the service for user, which is not desired
- Cleanup with spec-cleaner
- Use tmpfiles creation instead of hand-written shell script
-------------------------------------------------------------------
Sun May 17 09:09:27 UTC 2015 - meissner@suse.com

View File

@ -2,12 +2,11 @@
Description=Process accounting
Documentation=man:accton(8)
After=syslog.target
ConditionPathExists=/var/log/account/pacct
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/usr/lib/account/create
ExecStartPre=chmod 600 /var/log/account/pacct
ExecStart=/usr/sbin/accton /var/log/account/pacct
ExecStop=/usr/sbin/accton off

View File

@ -19,41 +19,26 @@
Name: acct
Version: 6.6.2
Release: 0
Source: http://ftp.gnu.org/gnu/acct/%{name}-%{version}.tar.gz
Source4: http://ftp.gnu.org/gnu/acct/%{name}-%{version}.tar.gz.sig
Source5: %name.keyring
Source1: acct.service
Source2: logrotate.acct
Source3: accton-create
BuildRequires: libtool
%if %suse_version >= 1310
BuildRequires: systemd-rpm-macros
%else
BuildRequires: systemd
%endif
%{?systemd_requires}
%if %suse_version >= 1230
BuildRequires: makeinfo
%endif
Requires: logrotate
Requires(pre): fileutils
Requires(pre): coreutils
Requires(preun): fileutils
Requires(preun): coreutils
Requires(post): %install_info_prereq
Requires(post): fileutils
Requires(post): coreutils
Requires(postun): %install_info_prereq
Requires(postun): fileutils
Requires(postun): coreutils
Patch: %{name}-%{version}-hz.patch
Patch2: %{name}-info.patch
Patch3: %{name}-ac.patch
Url: http://www.gnu.org/software/acct/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: User-Specific Process Accounting
License: GPL-2.0+
Group: System/Base
Url: http://www.gnu.org/software/acct/
Source: http://ftp.gnu.org/gnu/acct/%{name}-%{version}.tar.gz
Source1: acct.service
Source2: logrotate.acct
Source3: http://ftp.gnu.org/gnu/acct/%{name}-%{version}.tar.gz.sig
Source4: %{name}.keyring
Patch0: %{name}-%{version}-hz.patch
Patch2: %{name}-info.patch
Patch3: %{name}-ac.patch
BuildRequires: libtool
BuildRequires: makeinfo
BuildRequires: systemd-rpm-macros
Requires: logrotate
Requires(post): %{install_info_prereq}
Requires(postun): %{install_info_prereq}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%description
This package contains the programs necessary for user-specific process
@ -61,14 +46,14 @@ accounting: sa, accton, and lastcomm.
%prep
%setup -q
%patch -p1
%patch0 -p1
%patch2 -p1
%patch3 -p1
%build
autoreconf -ivf
%configure
make %{?_smp_mflags} CC="%{__cc}" CXX="%{__cxx}"
make %{?_smp_mflags}
%install
install -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
@ -77,23 +62,21 @@ install -d -m 755 %{buildroot}%{_localstatedir}/account/
install -d -m 755 %{buildroot}%{_libexecdir}/account
install -d -m 755 %{buildroot}%{_sbindir}
install -d -m 755 %{buildroot}%{_bindir}
%make_install CC="%{__cc}" CXX="%{__cxx}"
install -m 644 %{S:1} %{buildroot}/%{_unitdir}/acct.service
install -m 644 %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/acct
> %{buildroot}%{_localstatedir}/account/pacct
chmod 600 %{buildroot}%{_localstatedir}/account/pacct
cd %{buildroot}/usr/sbin/
ln -sf service rcacct
rm -f %{buildroot}/usr/bin/last
%make_install
install -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/acct.service
ln -sf service %{buildroot}%{_sbindir}/rcacct
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/acct
mkdir -p %{buildroot}%{_localstatedir}/log/account
rm -f %{buildroot}%{_bindir}/last
rm -f %{buildroot}/%{_mandir}/man1/last.1*
install -m 0755 %{S:3} %{buildroot}%{_libexecdir}/account/create
%pre
%service_add_pre acct.service
%post
echo "Creating %{_localstatedir}/account/pacct"
%{_libexecdir}/account/create
%install_info --info-dir=%{_infodir} %{_infodir}/accounting.info.gz
%service_add_post acct.service
@ -107,18 +90,16 @@ echo "Creating %{_localstatedir}/account/pacct"
%files
%defattr(-, root, root)
%doc README NEWS
%doc %{_infodir}/*.info.*
%doc %{_mandir}/man1/ac*
%doc %{_mandir}/man1/lastcomm*
%doc %{_mandir}/man8/*
%dir %{_localstatedir}/account
%attr(600, root, root) %ghost %{_localstatedir}/account/pacct
%{_infodir}/*.info.*
%{_mandir}/man1/ac*
%{_mandir}/man1/lastcomm*
%{_mandir}/man8/*
%config %{_sysconfdir}/logrotate.d/acct
%dir %{_localstatedir}/log/account
%ghost %{_localstatedir}/log/account/pacct
%{_bindir}/ac
%{_bindir}/lastcomm
%{_sbindir}/*
%{_unitdir}/acct.service
%dir %{_libexecdir}/account
%{_libexecdir}/account/create
%changelog

View File

@ -1,7 +0,0 @@
#!/bin/bash
ACCTFILE=/var/account/pacct
if test ! -e $ACCTFILE
then
umask 066
> $ACCTFILE
fi

View File

@ -8,7 +8,7 @@
missingok
create 640 root root
postrotate
/usr/bin/systemctl restart acct.service
/usr/bin/systemctl try-restart acct.service
endscript
}