diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99d3b40 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/acct-6.6.1.tar.gz diff --git a/.psacct.metadata b/.psacct.metadata new file mode 100644 index 0000000..062b400 --- /dev/null +++ b/.psacct.metadata @@ -0,0 +1 @@ +54300d030823063904155ccf24b071a512d88dd0 SOURCES/acct-6.6.1.tar.gz diff --git a/SOURCES/acct-6.3.2-sa_manpage.patch b/SOURCES/acct-6.3.2-sa_manpage.patch new file mode 100644 index 0000000..e07964e --- /dev/null +++ b/SOURCES/acct-6.3.2-sa_manpage.patch @@ -0,0 +1,12 @@ +diff -up acct-6.3.2/sa.8.pom acct-6.3.2/sa.8 +--- acct-6.3.2/sa.8.pom 2008-11-13 13:08:54.000000000 +0100 ++++ acct-6.3.2/sa.8 2008-11-13 13:09:38.000000000 +0100 +@@ -323,8 +323,6 @@ file. + .I acct + The raw system wide process accounting file. See + .BR acct (5) +-(or +-.BR pacct (5)) + for further details. + .TP + .I savacct diff --git a/SOURCES/accton-create b/SOURCES/accton-create new file mode 100755 index 0000000..4e889fa --- /dev/null +++ b/SOURCES/accton-create @@ -0,0 +1,5 @@ +#!/bin/sh +ACCTFILE=/var/account/pacct +if [ ! -r $ACCTFILE ];then + touch $ACCTFILE && chmod 600 $ACCTFILE +fi diff --git a/SOURCES/psacct-6.3.2-lastcomm_man.patch b/SOURCES/psacct-6.3.2-lastcomm_man.patch new file mode 100644 index 0000000..09050e6 --- /dev/null +++ b/SOURCES/psacct-6.3.2-lastcomm_man.patch @@ -0,0 +1,12 @@ +diff -up acct-6.5.4/lastcomm.1.pom acct-6.5.4/lastcomm.1 +--- acct-6.5.4/lastcomm.1.pom 2010-01-23 20:18:03.000000000 +0100 ++++ acct-6.5.4/lastcomm.1 2010-02-12 12:57:34.000000000 +0100 +@@ -111,7 +111,7 @@ For each entry the following information + D -- command terminated with the generation of a core file + X -- command was terminated with the signal SIGTERM + + the name of the user who ran the process +- + time the process exited ++ + time the process started + .SH OPTIONS + .PD 0 + .TP diff --git a/SOURCES/psacct-6.6.1-RH-man-page-scan.patch b/SOURCES/psacct-6.6.1-RH-man-page-scan.patch new file mode 100644 index 0000000..b006051 --- /dev/null +++ b/SOURCES/psacct-6.6.1-RH-man-page-scan.patch @@ -0,0 +1,167 @@ +diff -Naur acct-6.6.1.orig/ac.c acct-6.6.1/ac.c +--- acct-6.6.1.orig/ac.c 2011-03-16 23:50:13.000000000 +0100 ++++ acct-6.6.1/ac.c 2013-07-31 16:44:17.859142249 +0200 +@@ -343,12 +343,29 @@ + + void give_usage(void) + { +- (void)printf("\ +- Usage: %s [-dhpVy] [-f ] [people] ...\n\ +- [--daily-totals] [--individual-totals] [--file ]\n\ +- [--complain] [--reboots] [--supplants] [--timewarps] [--print-year]\n\ +- [--compatibility] [--print-zeros] [--debug] [--tw-leniency ]\n\ +- [--tw-suspicious ] [--version] [--help]\n", program_name); ++ (void)printf( ++ "\n" ++ "Usage: %s [OPTION] ...\n" ++ "\n" ++ "OPTIONS:\n" ++ " -d, --daily-totals Print totals for each day\n" ++ " -p, --individual-totals Print time totals for each user\n" ++ " -f, --file Read from \n" ++ " --complain Print errors for whatever problem\n" ++ " --reboots Count the time between login and reboot\n" ++ " --supplants Count the time between logins on the terminal\n" ++ " --timewarps Count the time between login and time warp\n" ++ " --compatibility Shortcut for --reboots --supplants --timewarps\n" ++ " -a, --all-days Do not skip days without login activity\n" ++ " --tw-leniency Set the time warp leniency in seconds\n" ++ " --tw-suspicious Set the time warp suspicious in seconds\n" ++ " --print-year Print year when displaying dates\n" ++ " --print-zeros Don't suppress zeros in category totals\n" ++ " --debug Print verbose internal information\n" ++ " -V, --version Show version and exit\n" ++ " -h, --help Show help and exit\n" ++ , program_name); ++ + print_wtmp_file_location(); + } + +diff -Naur acct-6.6.1.orig/dump-acct.c acct-6.6.1/dump-acct.c +--- acct-6.6.1.orig/dump-acct.c 2011-03-16 23:50:13.000000000 +0100 ++++ acct-6.6.1/dump-acct.c 2013-07-31 17:45:03.075476755 +0200 +@@ -52,6 +52,7 @@ + #ifdef LINUX_MULTIFORMAT +- printf (" [--format ] [--byteswap]\n"); ++ printf (" [--format ] [--byteswap]\n"); + #endif ++ printf (" [--ahz ]\n"); + print_acct_file_location (); + } + +diff -Naur acct-6.6.1.orig/lastcomm.c acct-6.6.1/lastcomm.c +--- acct-6.6.1.orig/lastcomm.c 2011-03-16 23:50:13.000000000 +0100 ++++ acct-6.6.1/lastcomm.c 2013-07-31 18:01:57.772529043 +0200 +@@ -304,7 +304,7 @@ + #ifdef HAVE_PAGING + "[--show-paging] " + #endif +- "[--version] [--help]\n", program_name); ++ "[--ahz ] [--version] [--help]\n", program_name); + print_acct_file_location (); + } + +diff -Naur acct-6.6.1.orig/lastcomm.1 acct-6.6.1/lastcomm.1 +--- acct-6.6.1.orig/lastcomm.1 2013-07-31 15:44:16.000000000 +0200 ++++ acct-6.6.1/lastcomm.1 2013-07-31 17:08:33.442122085 +0200 +@@ -18,54 +18,7 @@ + .I terminal-name ... + ] + .br +-[ +-.B \-\-strict-match +-] +-.br +-[ +-.B \-\-forwards +-] +-.br +-[ +-.BI \-f " filename" +-| +-.BI \-\-file " filename" +-] +-[ +-.BI \-\-ahz " hz" +-] +-.br +-[ +-.B \-\-user +-.I name +-] +-[ +-.B \-\-command +-.I name +-] +-[ +-.B \-\-tty +-.I name +-] +-.br +-[ +-.B \p +-| +-.B \-\-show_paging +-] +-[ +-.B \-\-debug +-] +-[ +-.B \-V +-| +-.B \-\-version +-] +-[ +-.B \-h +-| +-.B \-\-help +-] ++[ OPTION ... ] + .ad b + .hy 1 + .SH DESCRIPTION +@@ -115,10 +68,13 @@ + .SH OPTIONS + .PD 0 + .TP +-.B \-\-strict-match ++.B \-\-strict\-match + Print only entries that match *all* of the arguments on the command + line. + .TP ++.B \-\-print\-controls ++Print control characters. ++.TP + .BI \-\-user " name" + List records for user with + .I name. +diff -Naur acct-6.6.1.orig/sa.8 acct-6.6.1/sa.8 +--- acct-6.6.1.orig/sa.8 2013-07-31 15:44:16.000000000 +0200 ++++ acct-6.6.1/sa.8 2013-07-31 17:19:06.325431034 +0200 +@@ -43,7 +43,7 @@ + [ + .B \-i + | +-.B \-\-dont-read-summary-file ++.B \-\-dont-read-summary-files + ] + .br + [ +@@ -282,7 +282,7 @@ + When using the `\-\-threshold' option, assume that all answers to + interactive queries will be affirmative. + .TP +-.B \-i, \-\-dont-read-summary-file ++.B \-i, \-\-dont-read-summary-files + Don't read the information in the system's default + .I savacct + file. +@@ -386,7 +386,7 @@ + .I SAVACCT + file. + .TP +-.BI \-\-other-file " filename" ++.BI \-\-other-acct-file " filename" + Read from the file + .I filename + instead of the system's default diff --git a/SOURCES/psacct-6.6.1-dump-acct-to-dump-utmp.patch b/SOURCES/psacct-6.6.1-dump-acct-to-dump-utmp.patch new file mode 100644 index 0000000..ffd658e --- /dev/null +++ b/SOURCES/psacct-6.6.1-dump-acct-to-dump-utmp.patch @@ -0,0 +1,35 @@ +From 8280180feda889a1529844d71d03582021f7d207 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Mon, 27 Apr 2015 15:08:57 +0200 +Subject: [PATCH] dump-acct to dump-utmp + +--- + dump-utmp.8 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dump-utmp.8 b/dump-utmp.8 +index 829031f..fc4fad2 100644 +--- a/dump-utmp.8 ++++ b/dump-utmp.8 +@@ -4,7 +4,7 @@ + dump-utmp \- print an utmp file in human-readable format. + + .SH SYNOPSIS +-.B dump-acct ++.B dump-utmp + .RB [\| \-r \||\| \-\-reverse \|] + .RB [\| \-R \||\| \-\-raw \|] + .RB [\| \-n \||\| \-\-num +@@ -14,7 +14,7 @@ dump-utmp \- print an utmp file in human-readable format. + .IR files \|] + + .SH DESCRIPTION +-.B dump-acct ++.B dump-utmp + .I filename + prints a list of all logins. This list is usually written in + .IR /var/log/wtmp . +-- +1.9.3 + + diff --git a/SOURCES/psacct-6.6.1-lastcomm-bad-file-sigsegv.patch b/SOURCES/psacct-6.6.1-lastcomm-bad-file-sigsegv.patch new file mode 100644 index 0000000..c29da80 --- /dev/null +++ b/SOURCES/psacct-6.6.1-lastcomm-bad-file-sigsegv.patch @@ -0,0 +1,16 @@ +diff -up acct-6.6.1/file_rd.c.ori acct-6.6.1/file_rd.c +--- acct-6.6.1/file_rd.c.ori 2017-03-20 17:03:35.167177224 +0100 ++++ acct-6.6.1/file_rd.c 2017-03-20 17:03:40.468155269 +0100 +@@ -118,8 +118,11 @@ char *file_reader_get_entry(struct file_ + ? max_recs + : fri->buffered_records); + +- /* Move back in the file */ ++ /* Preventing SEGV when incomplete record appears */ ++ if (recs_to_read==0) ++ goto no_more_records; + ++ /* Move back in the file */ + (void)fseek(fri->fp, -fri->record_size * recs_to_read, + SEEK_CUR); + diff --git a/SOURCES/psacct-6.6.1-lastcomm-show-pid.patch b/SOURCES/psacct-6.6.1-lastcomm-show-pid.patch new file mode 100644 index 0000000..d88fabf --- /dev/null +++ b/SOURCES/psacct-6.6.1-lastcomm-show-pid.patch @@ -0,0 +1,101 @@ +diff -up ./lastcomm.1.ori ./lastcomm.1 +--- ./lastcomm.1.ori 2017-02-13 10:18:15.394190398 +0100 ++++ ./lastcomm.1 2017-02-13 11:37:28.993835576 +0100 +@@ -122,7 +122,10 @@ format as your current machine, but has + .B AHZ. + .TP + .B \-p, \-\-show\-paging +-Print paging statistics ++Print paging statistics. ++.TP ++.B \-\-pid ++Show PID and PPID of the process if acct version 3 format is supported by kernel. + .TP + .B \-\-debug + Print verbose internal information. +diff -up ./lastcomm.c.ori ./lastcomm.c +--- ./lastcomm.c.ori 2017-02-08 17:06:24.909802191 +0100 ++++ ./lastcomm.c 2017-02-13 10:51:28.019625702 +0100 +@@ -77,6 +77,8 @@ char *program_name; /* name of the prog + + int show_paging = 0; /* If they want paging stats, print 'em */ + ++char show_pid = 0; ++ + static unsigned int hzval; + + /* Here are various lists for the user to specify entries that they +@@ -125,6 +127,9 @@ int main(int argc, char *argv[]) + { "show-paging", no_argument, NULL, 11 }, + #endif + { "forwards", no_argument, NULL, 12 }, ++#ifdef LINUX_MULTIFORMAT ++ { "pid", no_argument, NULL, 13}, ++#endif + { 0, 0, 0, 0 } + }; + +@@ -209,6 +214,9 @@ int main(int argc, char *argv[]) + } + backwards = 0; + break; ++ case 13: ++ show_pid = 1; ++ break; + case 'h': + case 3: + /* This should fall through to default! */ +@@ -304,6 +312,7 @@ void give_usage(void) + #ifdef HAVE_PAGING + "[--show-paging] " + #endif ++ "[--pid] " + "[--ahz ] [--version] [--help]\n", program_name); + print_acct_file_location (); + } +@@ -392,8 +401,8 @@ void parse_entries(void) + (void)putchar(' '); + + btime = (time_t) rec->ac_btime; +- if ( show_paging == 0 ) +- (void)printf(" %-8.8s %-8.8s %6.2f secs %-16.16s\n", ++ if ( show_paging == 0) ++ (void)printf(" %-8.8s %-8.8s %6.2f secs %-16.16s", + this_uid, this_dev, + #ifdef LINUX_MULTIFORMAT + ((ut + st) / (double) rec->ac_ahz), +@@ -403,7 +412,7 @@ void parse_entries(void) + ctime (&btime)); + else + #ifdef HAVE_PAGING +- (void)printf(" %6.0fmin %6.0fmaj %4.0fswp %6.2f secs %-16.16s\n", ++ (void)printf(" %6.0fmin %6.0fmaj %4.0fswp %6.2f secs %-16.16s", + minf, majf, swap, + #ifdef LINUX_MULTIFORMAT + ((ut + st) / (double) rec->ac_ahz), +@@ -412,8 +421,24 @@ void parse_entries(void) + #endif + ctime (&btime)); + #else +- (void)printf(" --- No paging statistics! --- \n" ); ++ (void)printf(" --- No paging statistics! --- " ); + #endif ++ ++ ++ if (show_pid) ++ { ++#ifdef LINUX_MULTIFORMAT ++ if ((rec->ac_version & 0x7f) == 3) ++ { ++ (void) printf(" %d %d", rec->ac_pid, rec->ac_ppid); ++ } ++#else ++ (void)printf(" --- No PID information available! --- " ); ++#endif ++ } ++ ++ ++ (void) printf("\n"); + } + } + } diff --git a/SOURCES/psacct-6.6.1-man-dump-acct.patch b/SOURCES/psacct-6.6.1-man-dump-acct.patch new file mode 100644 index 0000000..654f17e --- /dev/null +++ b/SOURCES/psacct-6.6.1-man-dump-acct.patch @@ -0,0 +1,57 @@ +diff -Naur acct-6.6.1.orig/dump-acct.8 acct-6.6.1/dump-acct.8 +--- acct-6.6.1.orig/dump-acct.8 2013-07-31 18:56:57.000000000 +0200 ++++ acct-6.6.1/dump-acct.8 2013-07-31 19:19:21.606615965 +0200 +@@ -0,0 +1,53 @@ ++.\" Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. ++.\" Written by Ivana Hutarova Varekova ++.TH DUMP_ACCT 8 "2009 December 2" "Linux accounting system" ++ ++.SH NAME ++dump\-acct \- print an acct/pacct file in human-readable format ++ ++.SH SYNOPSIS ++.B dump-acct ++[\fB\-r\fR|\fB\-\-reverse\fR] ++[\fB\-R\fR|\fB\-\-raw\fR] ++[\fB\-n\fR|\fB\-\-num\fR\ \fIrecs\fR] ++[\fB\-\-byte\-swap\fR] ++[\fB\-\-format\fR] ++[\fB\-\-ahz\fR\ \fIfreq\fR] ++[\fB\-h\fR|\fB\-\-help\fR] ++[\fIfiles\fR] ++ ++.SH DESCRIPTION ++The dump-acct command transforms the output \fBfile\fR from the ++accton format to the human-readable format: one record per line. ++Each record consists of severald fields which are separated by ++character "|" (the meaning of concreate field depends on the ++version of kernel package - with which the accton file was created). ++ ++.SH OPTIONS ++The following options are supported: ++.TP ++.B -r, --reverse ++Print the output in reverse order. ++.TP ++.B -R, --raw ++The records will be printed without any parsing. ++.TP ++.B -n, --num NUMRECS ++Display only the first NUMRECS number of records. ++.TP ++.B --byteswap ++Swap the bytes (relative to your system's native byte order) in --raw output. ++.TP ++.B --format ++Set output format with --raw option. ++.TP ++.B --ahz FREQ ++Set the AHZ (platform dependent frequency in Hertz) to FREQ. ++.TP ++.B -h, --help ++Print a help message and the default location of the process accounting file ++and exit. ++ ++.SH SEE ALSO ++accton (8), lastcomm (1) ++ diff --git a/SOURCES/psacct-6.6.1-unnumberedsubsubsec.patch b/SOURCES/psacct-6.6.1-unnumberedsubsubsec.patch new file mode 100644 index 0000000..6dbc128 --- /dev/null +++ b/SOURCES/psacct-6.6.1-unnumberedsubsubsec.patch @@ -0,0 +1,30 @@ +diff -Naur acct-6.6.1.orig/accounting.texi acct-6.6.1/accounting.texi +--- acct-6.6.1.orig/accounting.texi 2011-03-16 23:50:13.000000000 +0100 ++++ acct-6.6.1/accounting.texi 2013-04-11 14:34:30.895000000 +0200 +@@ -468,7 +468,7 @@ + wrong order. GNU @code{ac} automatically compensates for this, but some + other @code{ac}s may not... beware. + +-@unnumberedsubsubsec The FTP Problem ++@unnumberedsubsec The FTP Problem + + I've tested the standard @code{ac} in Ultrix 4.2 (DECstation/DECsystem), + SunOS 4.1.1 (Sun3, Sun4, Sparc), Mach 2.5 (Omron/Luna), and DomainOS +@@ -491,7 +491,7 @@ + @code{ac} (provided you specify the other flags that will make GNU + @code{ac} behave like the system's). + +-@unnumberedsubsubsec The Shutdown/Reboot Problem ++@unnumberedsubsec The Shutdown/Reboot Problem + + On Suns, @code{init} is a little screwed up. For some reason, after a + shutdown record is written, a reboot record is written with a time-stamp +@@ -513,7 +513,7 @@ + 60 second default is that of all of the machines with this problem, the + largest timewarp was 45. + +-@unnumberedsubsubsec Stupid System V Machines ++@unnumberedsubsec Stupid System V Machines + + Some @code{ac}'s on System V machines (I've tried SGI Indigo & SGI Indy) + forget to pay attention to the @code{ut_type} field in a @code{struct diff --git a/SOURCES/psacct-logrotate.in b/SOURCES/psacct-logrotate.in new file mode 100644 index 0000000..f3f2d3f --- /dev/null +++ b/SOURCES/psacct-logrotate.in @@ -0,0 +1,15 @@ +# Logrotate file for psacct RPM + +/var/account/pacct { + compress + delaycompress + notifempty + daily + rotate 31 + create 0600 root root + postrotate + if %{_bindir}/systemctl --quiet is-active psacct.service ; then + %{_sbindir}/accton /var/account/pacct | %{_bindir}/grep -v "Turning on process accounting, file set to '/var/account/pacct'." | %{_bindir}/cat + fi + endscript +} diff --git a/SOURCES/psacct.service b/SOURCES/psacct.service new file mode 100644 index 0000000..832c0c5 --- /dev/null +++ b/SOURCES/psacct.service @@ -0,0 +1,14 @@ +[Unit] +Description=Kernel process accounting +After=syslog.target +ConditionPathExists=/var/account + +[Service] +Type=oneshot +ExecStartPre=/usr/libexec/psacct/accton-create +ExecStart=/usr/sbin/accton /var/account/pacct +ExecStop=/usr/sbin/accton off +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/psacct.spec b/SPECS/psacct.spec new file mode 100644 index 0000000..3be4b05 --- /dev/null +++ b/SPECS/psacct.spec @@ -0,0 +1,529 @@ +# Our /usr/bin/last is in the SysVInit package +%global with_last 0 +%global _hardened_build 1 + +Summary: Utilities for monitoring process activities +Name: psacct +Version: 6.6.1 +Release: 13%{?dist} +License: GPLv3+ +Group: Applications/System +URL: http://www.gnu.org/software/acct/ + +Source: ftp://ftp.gnu.org/pub/gnu/acct/acct-%{version}.tar.gz +Source1: psacct.service +Source2: psacct-logrotate.in +Source3: accton-create + +Patch1: psacct-6.3.2-lastcomm_man.patch +Patch2: acct-6.3.2-sa_manpage.patch +# The upstream man page is more correct than the usage +# .. the C sources need to be fixed, not the man page +#Patch3: psacct-6.3.2-man-pages.patch +Patch4: psacct-6.6.1-unnumberedsubsubsec.patch +Patch5: psacct-6.6.1-RH-man-page-scan.patch +# Partial replacement for Patch3: psacct-6.3.2-man-pages.patch +Patch6: psacct-6.6.1-man-dump-acct.patch +Patch7: psacct-6.6.1-dump-acct-to-dump-utmp.patch +Patch8: psacct-6.6.1-lastcomm-show-pid.patch +Patch9: psacct-6.6.1-lastcomm-bad-file-sigsegv.patch + +Conflicts: filesystem < 3 +Conflicts: systemd < 39-1 +Requires: /sbin/install-info +Requires: coreutils +Requires(post): chkconfig +Requires(post): systemd-sysv +Requires(post): systemd-units >= 39-2 +Requires(preun): systemd-units +Requires(postun): systemd-units + +BuildRequires: autoconf +BuildRequires: systemd-units >= 39-2 + + +%description +The psacct package contains several utilities for monitoring process +activities, including ac, lastcomm, accton and sa. The ac command +displays statistics about how long users have been logged on. The +lastcomm command displays information about previous executed +commands. The accton command turns process accounting on or off. The +sa command summarizes information about previously executed +commands. + + +%prep +%setup -q -n acct-%{version} + +%patch1 -p1 -b .man +%patch2 -p1 -b .pct +#%%patch3 -p1 -b .new +%patch4 -p1 -b .subsubsec +%patch5 -p1 -b .rh-man-scan +%patch6 -p1 -b .man-dump-acct +%patch7 -p1 -b .man-dump-utmp +%patch8 -p1 +%patch9 -p1 + +# fixing 'gets' undeclared +sed -i 's|.*(gets,.*||g' lib/stdio.in.h + +# workaround for broken autotools stuff +sed -i 's|@ACCT_FILE_LOC@|/var/account/pacct|g' files.h.in +sed -i 's|@SAVACCT_FILE_LOC@|/var/account/savacct|g' files.h.in +sed -i 's|@USRACCT_FILE_LOC@|/var/account/usracct|g' files.h.in + + +%build +%configure --enable-linux-multiformat + +make + + +%install +mkdir -p %{buildroot}{/sbin,%{_bindir},%{_mandir},%{_sbindir}} +make install prefix=%{buildroot}%{_prefix} \ + bindir=%{buildroot}%{_bindir} sbindir=%{buildroot}%{_sbindir} \ + infodir=%{buildroot}%{_datadir}/info mandir=%{buildroot}%{_mandir} +cp dump-acct.8 %{buildroot}%{_mandir}/man8/ + +# remove unwanted file +rm -f %{buildroot}%{_infodir}/dir + +mkdir -p %{buildroot}/var/account +touch %{buildroot}/var/account/pacct && chmod 0600 %{buildroot}/var/account/pacct + +# create logrotate config file +mkdir -p %{buildroot}/etc/logrotate.d +sed -e 's|%%{_bindir}|%{_bindir}|g' -e 's|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} > %{buildroot}/etc/logrotate.d/psacct + +# install systemd unit file +mkdir -p %{buildroot}%{_unitdir} +install -m 644 %{SOURCE1} %{buildroot}%{_unitdir} + +# install accton-create script +install -d -m 0755 %{buildroot}%{_libexecdir}/psacct +install -m 755 %{SOURCE3} %{buildroot}%{_libexecdir}/psacct/ + +%if ! %{with_last} +rm -f %{buildroot}%{_bindir}/last %{buildroot}%{_mandir}/man1/last.1* +%endif + + +%post +%systemd_post psacct.service + +/sbin/install-info %{_infodir}/accounting.info %{_infodir}/dir || : +touch /var/account/pacct && chmod 0600 /var/account/pacct + + +%preun +%systemd_preun psacct.service + +if [ $1 -eq 0 ]; then + # Package removal, not upgrade + /sbin/install-info --delete %{_infodir}/accounting.info %{_infodir}/dir || : +fi + + +%postun +%systemd_postun_with_restart psacct.service + +%triggerun -- psacct < 6.5.5-3 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply psacct +# to migrate them to systemd targets +%{_bindir}/systemd-sysv-convert --save psacct >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del psacct >/dev/null 2>&1 || : +/bin/systemctl try-restart psacct.service >/dev/null 2>&1 || : + + +%files +%doc README COPYING +%dir /var/account +%{_unitdir}/psacct.service +%attr(0600,root,root) %ghost %config /var/account/pacct +%attr(0644,root,root) %config(noreplace) /etc/logrotate.d/* +%{_sbindir}/accton +%{_sbindir}/sa +%{_sbindir}/dump-utmp +%{_sbindir}/dump-acct +%{_libexecdir}/psacct/accton-create +%{_bindir}/ac +%if %{with_last} +%{_bindir}/last +%endif +%{_bindir}/lastcomm +%{_mandir}/man1/ac.1* +%if %{with_last} +%{_mandir}/man1/last.1* +%endif +%{_mandir}/man1/lastcomm.1* +%{_mandir}/man8/sa.8* +%{_mandir}/man8/accton.8* +%{_mandir}/man8/dump-acct.8* +%{_mandir}/man8/dump-utmp.8* +%{_infodir}/accounting.info.gz + + +%changelog +* Mon Mar 20 2017 Jan Rybar - 6.6.1.13 +- lastcomm: fix of segfault if invalid file given +- Resolves: rhbz#1398620 + +* Thu Feb 09 2017 Jan Rybar - 6.6.1.12 +- lastcomm: processes are now printed with their PIDs and PPIDs +- Resolves: rhbz#1255183 + +* Thu Jul 28 2016 Jan Rybar - 6.6.1.11 +- Fixing occurrences of dump-acct in dump-utmp man page +- Resolves: rhbz#1240948 + +* Tue Jun 28 2016 Jan Rybar - 6.6.1.10 +- Fixing mode assignment of /var/account/pacct +- Resolves: rhbz#1249665 + +* Wed Oct 01 2014 Jaromir Capik - 6.6.1-9 +- Hardening the build (#1092540) +- Resolves: rhbz#1092540 + +* Fri Jan 24 2014 Daniel Mach - 6.6.1-8 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 6.6.1-7 +- Mass rebuild 2013-12-27 + +* Wed Aug 21 2013 Jaromir Capik - 6.6.1-6 +- Unifying the default file paths (#985150) + +* Wed Jul 31 2013 Jaromir Capik - 6.6.1-5 +- Dropping psacct-6.3.2-man-pages.patch +- (Re)introducing modified dump-acct man page + +* Wed Jul 31 2013 Jaromir Capik - 6.6.1-4 +- RH man page scan (#948523) + +* Mon Jun 17 2013 Jaromir Capik - 6.6.1-3 +- Service fails to start if accounting file already exists (#974716) + +* Thu Apr 11 2013 Jaromir Capik - 6.6.1-2 +- Logfile creation in the systemd unit file (#918132) + +* Tue Apr 09 2013 Jaromir Capik - 6.6.1-1 +- Update to 6.6.1 +- Fixing bogus dates in the changelog + +* Thu Feb 14 2013 Fedora Release Engineering - 6.5.5-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Jan 16 2013 Jaromir Capik - 6.5.5-8 +- #759321 - psacct logrotate script references init.d service +- #735300 - Enabling psacct causes daily cron spam + +* Tue Aug 28 2012 Jaromir Capik - 6.5.5-7 +- Migration to new systemd scriptlet macros +- Fixing the build (new glibc) - 'gets' undeclared + +* Sat Jul 21 2012 Fedora Release Engineering - 6.5.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Jan 25 2012 Harald Hoyer 6.5.5-5 +- install everything in /usr + https://fedoraproject.org/wiki/Features/UsrMove + +* Sat Jan 14 2012 Fedora Release Engineering - 6.5.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Jun 29 2011 Jaromir Capik - 6.5.5-3 +- Migration to systemd unit file + +* Wed Feb 09 2011 Fedora Release Engineering - 6.5.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Nov 09 2010 Jan Görig - 6.5.5-1 +- upgrade to new upstream release +- remove obsolete patches +- remove FHS_compliant condition +- remove obsolete conflicts with initscripts +- info installation fix +- modified man-pages patch +- spec fixes + +* Mon Aug 16 2010 Ivana Hutarova Varekova - 6.5.4-6 +- fix two man-pages links + +* Mon Jun 28 2010 Ivana Hutarova Varekova - 6.5.4-5 +- remove obsolete patches + +* Fri Jun 18 2010 Ivana Hutarova Varekova - 6.5.4-4 +- Resolves: #575975 + Build psacct with --enable-linux-multiformat +- remove obsolete change +- fix sa problem with hzval variable + +* Mon Apr 19 2010 Ivana Hutarova Varekova - 6.5.4-3 +- add force-reload action to init script + +* Fri Mar 5 2010 Ivana Hutarova Varekova - 6.5.4-2 +- add the documentation + fix init script + +* Fri Feb 12 2010 Ivana Hutarova Varekova - 6.5.4-1 +- update to 6.5.4 +- remove obsolete patches +- fix license tag + +* Thu Jan 28 2010 Ivana Hutarova Varekova - 6.5.1-5 +- Fix the logrotate script and split its template to a separate file. + (Michal Schmidt patch, thanks) + +* Thu Jan 28 2010 Ivana Hutarova Varekova - 6.5.1-4 +- fix the logrotate change + +* Wed Jan 27 2010 Ivana Hutarova Varekova - 6.5.1-3 +- Resolves: #523774 + process accounting enabled unconditionally from daily cron job + +* Mon Jan 4 2010 Ivana Hutarova Varekova - 6.5.1-2 +- fix initscript (accton parameters changed) +- fix lastcomm setings (#550229 - confusion about accounting file + location) + +* Fri Dec 18 2009 Ivana Hutarova Varekova - 6.5.1-1 +- update to 6.5.1 + remove unnecessary patches, spec file changes + +* Wed Dec 9 2009 Ivana Hutarova Varekova - 6.2.3-57 +- fix the initscript (service restart does not work) + +* Wed Dec 2 2009 Ivana Hutarova Varekova - 6.2.3-56 +- add dump-utmp.8 and dump-acct.8 man-pages + +* Wed Sep 16 2009 Ivana Varekova - 6.2.3-55 +- fix init script (#521195) + +* Sun Jul 26 2009 Fedora Release Engineering - 6.3.2-54 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 6.3.2-53 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Nov 13 2008 Ivana Varekova - 6.3.2-52 +- remove link to nonexisting page from sa man-page + +* Tue Jun 3 2008 Ivana Varekova - 6.3.2-51 +- remove unwanted file + +* Wed Feb 20 2008 Fedora Release Engineering - 6.3.2-50 +- Autorebuild for GCC 4.3 + +* Fri Jan 18 2008 Ivana Varekova - 6.3.2-49 +- rebuilt + +* Tue Aug 28 2007 Fedora Release Engineering - 6.3.2-48 +- Rebuild for selinux ppc32 issue. + +* Wed Jul 25 2007 Ivana Varekova - 6.3.2-47 +- fix status service + +* Wed Jul 25 2007 Ivana Varekova - 6.3.2-46 +- Resolves: #247034 + fix init script + +* Mon May 28 2007 Ivana Varekova - 6.3.2-45 +- fix the return value of "service psacct status" command + +* Thu Apr 5 2007 Ivana Varekova - 6.3.2-44 +- small spec changes +- change buildroot +- remove makeinstall macro + +* Tue Jan 23 2007 Ivana Varekova - 6.3.2-43 +- Resolves: 223728 + psacct logrotate file looks for non existant directory + +* Tue Jan 2 2007 Ivana Varekova - 6.3.2-42 +- Resolves: 221069 + (fix lastcomm man page) +- spec file cleanup + +* Wed Jul 12 2006 Jesse Keating - 6.3.2-41.1 +- rebuild + +* Mon Feb 27 2006 Peter Jones - 6.3.2-41 +- add touch to prereq + +* Mon Feb 27 2006 Ivana Varekova - 6.3.2-40 +- add chkconfig to prereq - bug 182848 + +* Mon Feb 20 2006 Ivana Varekova - 6.3.2-39 +- add Large File Support + +* Fri Feb 10 2006 Jesse Keating - 6.3.2-38.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 6.3.2-38.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Tue Jan 3 2006 Ivana Varekova 6.3.2-38 +- fix typo bug 176811 + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Fri Mar 4 2005 Ivana Varekova 6.3.2-37 +- rebuilt + +* Tue Feb 15 2005 Ivana Varekova 6.3.2-36 +- fix sa manpage - necessary becouse of bug #43294 and previous patch + +* Tue Feb 15 2005 Ivana Varekova 6.3.2-35 +- fix #147782 logrotate script error + +* Thu Feb 3 2005 Charles Bennett 6.3.2-33.fc4 +- rhbz 133077: logrotate fixed to continue accounting during rotate +- rhbz 141802: lastcomm was not handling all forms of --strict-match +- rhbz 141971: rpm -e no longer leaves /var/lock/subsys/psacct +- rhbz 43294: sa will never report any io because the kernel doesn't + provide it. Tweaked to ignore ac_io in acct.h +- integrate lastcomm hz patch from RH support + +* Wed Sep 1 2004 root - 6.3.2-31 +- integrate JFenlason's hz patch, improve pts device reporting + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Thu Dec 26 2002 Florian La Roche +- make /etc/info-dir an optional file + +* Wed Nov 13 2002 Mike A. Harris 6.3.2-25 +- Added with_last conditional to disable /usr/bin/last because ours is in + the SysVInit package. This fixes unpackaged files terminate build prob. + +* Thu Aug 22 2002 Mike A. Harris 6.3.2-24 +- Fixed initscript reload/restart by creating start/stop functions and + making everything use them (#72261) + +* Tue Aug 6 2002 Mike A. Harris 6.3.2-23 +- Fixed chkconfig issue in rpm scripts (#61191) +- Excludearch ia64, not taking the time to debug/troubleshoot random + buildsystem failure due to higher priorities. + +* Mon Jul 08 2002 Elliot Lee +- Take the time to make sure things get through on all archs, by simply + running it through the build system. + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Wed Mar 27 2002 Mike A. Harris 6.3.2-19 +- Made initscript touch/chmod accounting file if it is not present during + startup, to ensure accounting works properly when enabled. + +* Tue Mar 26 2002 Mike A. Harris 6.3.2-18 +- Fixed duh in initscript pointing to wrong accounting file (#61939) + +* Sun Mar 17 2002 Mike A. Harris 6.3.2-17 +- Removed the files usracct and savacct, which are not used by psacct + utilities at all, but by the sa program. Our sa uses files in a different + location, and so these files are unused and unnecessary. + +* Sat Mar 16 2002 Mike A. Harris 6.3.2-16 +- Added chkconfig to post and preun scripts for bug (#61191) + +* Tue Mar 12 2002 Mike A. Harris 6.3.2-15 +- Added new feature - psacct initscript now controls process accounting so + that it is not just forced on if installed as was the previous behaviour +- Modified the initscripts package to not force psacct on anymore and made + the new psacct-6.3.2-15 conflict with previous initscripts packages. +- Fixed logrotate config to set perms/owner of new log files, and closed + bug (#54165) + +* Thu Mar 7 2002 Mike A. Harris 6.3.2-14 +- Fixed 64bit bug in calls to ctime() in lastcomm and dump-utmp (#60712) + +* Wed Mar 6 2002 Mike A. Harris 6.3.2-13 +- Removed Build_7x flag, added FHS_compliant flag, reworked specfile to use new + flag, and fixed bug (#60716) + +* Thu Feb 28 2002 Bill Nottingham 6.3.2-12 +- rebuild in new environment for FHS correctness + +* Thu Jan 31 2002 Mike A. Harris 6.3.2-11 +- Conditionalized acct-6.3.2-config.patch to only be applied for RHL 7.x + builds, as it breaks FHS compliance by putting files in nonstandard + locations. Also fixed up other places in specfile for FHS 2.2. +- Added acct-6.3.2-I-HATE-GNU-AUTOCONK.patch because I hate GNU autoconk + really really badly. + +- Bumped to -11 to avoid buildsystem stupidness + +* Thu Sep 06 2001 Mike A. Harris 6.3.2-9 +- Fixed bug (#53307) psacct is enabled by default, and the log files + are huge, and will fill the disk up very quickly. logrotate will + now compress them daily. + +* Sat Sep 01 2001 Florian La Roche 6.3.2-8 +- do not fail for ENOSYS to silently support kernels without + process accounting + +* Sun Aug 26 2001 Mike A. Harris 6.3.2-7 +- Change spec tag Copyright -> License +- change logrotate to rotate daily, and keep 1 month (31 days) of data + +* Sun Jun 24 2001 Elliot Lee +- Bump release + rebuild. + +* Fri Feb 02 2001 Helge Deller +- added logrotate file for /var/log/pacct (#24900) + +* Wed Jul 12 2000 Prospector +- automatic rebuild + +* Mon Jun 5 2000 Nalin Dahyabhai +- FHS fixes + +* Sat May 6 2000 Bill Nottingham +- fix for new patch + +* Thu Feb 03 2000 Nalin Dahyabhai +- update to 6.3.2 + +* Mon Apr 05 1999 Preston Brown +- wrap post script with reference count. + +* Tue Mar 23 1999 Preston Brown +- install-info sucks. Still. + +* Sun Mar 21 1999 Cristian Gafton +- auto rebuild in the new build environment (release 8) + +* Thu Mar 18 1999 Bill Nottingham +- #define HAVE_LINUX_ACCT_H too, so it works. :) + +* Sun Aug 16 1998 Jeff Johnson +- accton needs to be accessible to /etc/rc.d/init.d/halt + +* Fri May 08 1998 Erik Troan +- install-info sucks + +* Mon Apr 27 1998 Prospector System +- translations modified for de, fr, tr + +* Thu Oct 23 1997 Donnie Barnes +- updated from 6.2 to 6.3 + +* Mon Jul 21 1997 Erik Troan +- built against glibc