SHA256
1
0
forked from pool/acct

Accepting request 226397 from home:WernerFink:branches:Base:System

- cleanup of acct
  * Add install section in service unit (bnc#867138)
  * Add a simple script to create pacct file

OBS-URL: https://build.opensuse.org/request/show/226397
OBS-URL: https://build.opensuse.org/package/show/Base:System/acct?expand=0&rev=34
This commit is contained in:
Marcus Meissner 2014-03-20 07:50:42 +00:00 committed by Git OBS Bridge
parent 590ace6354
commit 6a419c6707
4 changed files with 62 additions and 31 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Mar 17 10:41:47 UTC 2014 - werner@suse.de
- cleanup of acct
* Add install section in service unit (bnc#867138)
* Add a simple script to create pacct file
-------------------------------------------------------------------
Sat Dec 21 22:53:20 UTC 2013 - vcizek@suse.com

View File

@ -1,11 +1,15 @@
[Unit]
Description=Process accounting
Documentation=man:accton(8)
After=syslog.target
ConditionPathExists=/var/account
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/bin/sh -c 'test -e /var/account/pacct || touch /var/account/pacct'
ExecStartPre=/usr/libexec/account/create
ExecStart=/usr/sbin/accton /var/account/pacct
ExecStop=/usr/sbin/accton off
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
#
# spec file for package acct
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 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
@ -17,22 +17,36 @@
Name: acct
PreReq: fileutils %install_info_prereq
Version: 6.6.1
Release: 0
Source: %{name}-%{version}.tar.gz
Source1: acct.service
Source2: logrotate.acct
Source3: accton-create
Source10: %{name}-%{version}.tar.gz.sig
Source11: %{name}.keyring
BuildRequires: gpg-offline
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}-hz.patch
Patch2: %{name}-info.patch
Patch3: %{name}-ac.patch
@ -54,37 +68,34 @@ accounting: sa, accton, and lastcomm.
%patch3 -p1
%build
%define prefix /usr
%define sysconfdir /etc
autoreconf -ivf
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure \
--mandir=%{_mandir} \
--prefix=%{prefix} \
--infodir=%{_infodir} \
--sysconfdir=%{sysconfdir}
make %{?_smp_mflags} CC="%{__cc}" CXX="%{__cxx}"
%configure
make %{?_smp_mflags} CC="%{__cc}" CXX="%{__cxx}"
%install
make DESTDIR=$RPM_BUILD_ROOT install CC="%{__cc}" CXX="%{__cxx}"
install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
install -d -m 755 $RPM_BUILD_ROOT/%{_unitdir}
install -m 644 %{S:1} $RPM_BUILD_ROOT/%{_unitdir}/acct.service
install -m 644 %{S:2} $RPM_BUILD_ROOT/etc/logrotate.d/acct
install -d -m 755 $RPM_BUILD_ROOT/var/account/
touch $RPM_BUILD_ROOT/var/account/pacct
chmod 600 $RPM_BUILD_ROOT/var/account/pacct
cd $RPM_BUILD_ROOT/usr/sbin/
install -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
install -d -m 755 %{buildroot}/%{_unitdir}
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 $RPM_BUILD_ROOT/usr/bin/last
rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/last.1*
rm -f %{buildroot}/usr/bin/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 /var/account/pacct"
touch var/account/pacct
chmod 600 var/account/pacct
echo "Creating %{_localstatedir}/account/pacct"
%{_libexecdir}/account/create
%install_info --info-dir=%{_infodir} %{_infodir}/accounting.info.gz
%service_add_post acct.service
@ -102,12 +113,14 @@ chmod 600 var/account/pacct
%doc %{_mandir}/man1/ac*
%doc %{_mandir}/man1/lastcomm*
%doc %{_mandir}/man8/*
%dir /var/account
%attr(600, root, root) %ghost /var/account/pacct
%config /etc/logrotate.d/acct
/usr/bin/ac
/usr/bin/lastcomm
/usr/sbin/*
%dir %{_localstatedir}/account
%attr(600, root, root) %ghost %{_localstatedir}/account/pacct
%config %{_sysconfdir}/logrotate.d/acct
%{_bindir}/ac
%{_bindir}/lastcomm
%{_sbindir}/*
%{_unitdir}/acct.service
%dir %{_libexecdir}/account
%{_libexecdir}/account/create
%changelog

7
accton-create Normal file
View File

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