File acct.spec of Package acct

#
# spec file for package acct
#
# Copyright (c) 2011 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
# 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 http://bugs.opensuse.org/
#



Name:           acct
License:        GPLv2+
Group:          System/Base
PreReq:         %insserv_prereq %fillup_prereq fileutils %install_info_prereq
Version:        6.3.5
Release:        829
Source:         %{name}-%{version}.tar.bz2
Source1:        rc.acct
Source2:        logrotate.acct
BuildRequires:  libtool
Patch:          %{name}-%{version}-axp.dif
Patch1:         %{name}-%{version}-ac.dif
Patch2:         %{name}-%{version}-info.diff
Patch3:         %{name}-%{version}-acct_v3-fix.diff
Patch4:         %{name}-%{version}-time-fix.diff
Patch5:         %{name}-%{version}-hz.patch
Patch6:         %{name}-%{version}-warning.patch
Url:            http://www.gnu.org/directory/acct.html
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        User-Specific Process Accounting

%description
This package contains the programs necessary for user-specific process
accounting: sa, accton, and lastcomm.

%prep
%setup -q
%patch
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6

%build
%define prefix   /usr
%define sysconfdir /etc
%{suse_update_config}
libtoolize -f
aclocal
automake -a
autoconf
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure \
                                                  --mandir=%{_mandir} \
                                                  --prefix=%{prefix} \
                                                  --infodir=%{_infodir} \
                                                  --sysconfdir=%{sysconfdir}
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/{init.d,logrotate.d}
install -m 755 %{S:1}  $RPM_BUILD_ROOT/etc/init.d/acct
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/
ln -sf ../../etc/init.d/acct rcacct
rm -f $RPM_BUILD_ROOT/usr/bin/last
rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/last.1*

%post
%{fillup_and_insserv acct}
echo "Creating /var/account/pacct"
touch var/account/pacct
chmod 600 var/account/pacct
%install_info --info-dir=%{_infodir} %{_infodir}/accounting.info.gz

%preun
%stop_on_removal acct

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/accounting.info.gz
%restart_on_update acct
%{insserv_cleanup}

%files
%defattr(-, root, root)
%doc README NEWS
%doc %{_infodir}/*.info.*
%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
%config /etc/init.d/acct
/usr/bin/ac
/usr/bin/lastcomm
/usr/sbin/*

%changelog
openSUSE Build Service is sponsored by