SHA256
1
0
forked from pool/acct

Accepting request 226823 from Base:System

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

OBS-URL: https://build.opensuse.org/request/show/226823
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/acct?expand=0&rev=29
This commit is contained in:
Stephan Kulow 2014-03-21 12:28:27 +00:00 committed by Git OBS Bridge
commit 550078f38a
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 Sat Dec 21 22:53:20 UTC 2013 - vcizek@suse.com

View File

@ -1,11 +1,15 @@
[Unit] [Unit]
Description=Process accounting Description=Process accounting
Documentation=man:accton(8) Documentation=man:accton(8)
After=syslog.target
ConditionPathExists=/var/account
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=true 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 ExecStart=/usr/sbin/accton /var/account/pacct
ExecStop=/usr/sbin/accton off ExecStop=/usr/sbin/accton off
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
# #
# spec file for package acct # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,22 +17,36 @@
Name: acct Name: acct
PreReq: fileutils %install_info_prereq
Version: 6.6.1 Version: 6.6.1
Release: 0 Release: 0
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
Source1: acct.service Source1: acct.service
Source2: logrotate.acct Source2: logrotate.acct
Source3: accton-create
Source10: %{name}-%{version}.tar.gz.sig Source10: %{name}-%{version}.tar.gz.sig
Source11: %{name}.keyring Source11: %{name}.keyring
BuildRequires: gpg-offline BuildRequires: gpg-offline
BuildRequires: libtool BuildRequires: libtool
%if %suse_version >= 1310
BuildRequires: systemd-rpm-macros
%else
BuildRequires: systemd BuildRequires: systemd
%endif
%{?systemd_requires} %{?systemd_requires}
%if %suse_version >= 1230 %if %suse_version >= 1230
BuildRequires: makeinfo BuildRequires: makeinfo
%endif %endif
Requires: logrotate 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 Patch: %{name}-hz.patch
Patch2: %{name}-info.patch Patch2: %{name}-info.patch
Patch3: %{name}-ac.patch Patch3: %{name}-ac.patch
@ -54,37 +68,34 @@ accounting: sa, accton, and lastcomm.
%patch3 -p1 %patch3 -p1
%build %build
%define prefix /usr
%define sysconfdir /etc
autoreconf -ivf autoreconf -ivf
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure \ %configure
--mandir=%{_mandir} \ make %{?_smp_mflags} CC="%{__cc}" CXX="%{__cxx}"
--prefix=%{prefix} \
--infodir=%{_infodir} \
--sysconfdir=%{sysconfdir}
make %{?_smp_mflags} CC="%{__cc}" CXX="%{__cxx}"
%install %install
make DESTDIR=$RPM_BUILD_ROOT install CC="%{__cc}" CXX="%{__cxx}" install -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d install -d -m 755 %{buildroot}/%{_unitdir}
install -d -m 755 $RPM_BUILD_ROOT/%{_unitdir} install -d -m 755 %{buildroot}%{_localstatedir}/account/
install -m 644 %{S:1} $RPM_BUILD_ROOT/%{_unitdir}/acct.service install -d -m 755 %{buildroot}%{_libexecdir}/account
install -m 644 %{S:2} $RPM_BUILD_ROOT/etc/logrotate.d/acct install -d -m 755 %{buildroot}%{_sbindir}
install -d -m 755 $RPM_BUILD_ROOT/var/account/ install -d -m 755 %{buildroot}%{_bindir}
touch $RPM_BUILD_ROOT/var/account/pacct %make_install CC="%{__cc}" CXX="%{__cxx}"
chmod 600 $RPM_BUILD_ROOT/var/account/pacct install -m 644 %{S:1} %{buildroot}/%{_unitdir}/acct.service
cd $RPM_BUILD_ROOT/usr/sbin/ 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 ln -sf service rcacct
rm -f $RPM_BUILD_ROOT/usr/bin/last rm -f %{buildroot}/usr/bin/last
rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/last.1* rm -f %{buildroot}/%{_mandir}/man1/last.1*
install -m 0755 %{S:3} %{buildroot}%{_libexecdir}/account/create
%pre %pre
%service_add_pre acct.service %service_add_pre acct.service
%post %post
echo "Creating /var/account/pacct" echo "Creating %{_localstatedir}/account/pacct"
touch var/account/pacct %{_libexecdir}/account/create
chmod 600 var/account/pacct
%install_info --info-dir=%{_infodir} %{_infodir}/accounting.info.gz %install_info --info-dir=%{_infodir} %{_infodir}/accounting.info.gz
%service_add_post acct.service %service_add_post acct.service
@ -102,12 +113,14 @@ chmod 600 var/account/pacct
%doc %{_mandir}/man1/ac* %doc %{_mandir}/man1/ac*
%doc %{_mandir}/man1/lastcomm* %doc %{_mandir}/man1/lastcomm*
%doc %{_mandir}/man8/* %doc %{_mandir}/man8/*
%dir /var/account %dir %{_localstatedir}/account
%attr(600, root, root) %ghost /var/account/pacct %attr(600, root, root) %ghost %{_localstatedir}/account/pacct
%config /etc/logrotate.d/acct %config %{_sysconfdir}/logrotate.d/acct
/usr/bin/ac %{_bindir}/ac
/usr/bin/lastcomm %{_bindir}/lastcomm
/usr/sbin/* %{_sbindir}/*
%{_unitdir}/acct.service %{_unitdir}/acct.service
%dir %{_libexecdir}/account
%{_libexecdir}/account/create
%changelog %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