diff options
author | 2017-07-27 16:03:48 +0200 | |
---|---|---|
committer | 2017-07-27 16:04:04 +0200 | |
commit | ce3320b8f7c1530d7438cd4774a72a75266e1c0b (patch) | |
tree | 0dd7476d4c5a0960a47236ca065f798fb32298c8 /sys-process/acct/files | |
parent | dev-php/pecl-ssh2: Upstream recommends libssh2 have -gcrypt (diff) | |
download | gentoo-ce3320b8f7c1530d7438cd4774a72a75266e1c0b.tar.gz gentoo-ce3320b8f7c1530d7438cd4774a72a75266e1c0b.tar.bz2 gentoo-ce3320b8f7c1530d7438cd4774a72a75266e1c0b.zip |
sys-process/acct: Bump to v6.6.4
Ebuild changes:
===============
- Migrated to EAPI=6
- Dropped usage of base eclass which is no longer needed
- *-no-gets.patch dropped which is no longer necessary since upstream
updated gnulib in v6.6.1
- Runscript improved
- A running instance will now remember the accounting file
- Make use of start_pre() function
- Logrotate script will now work for systemd users as well (bug #508512)
Gentoo-Bug: https://bugs.gentoo.org/508512
Package-Manager: Portage-2.3.5, Repoman-2.3.2
Diffstat (limited to 'sys-process/acct/files')
-rw-r--r-- | sys-process/acct/files/acct-6.6.4-cross-compile.patch | 220 | ||||
-rw-r--r-- | sys-process/acct/files/acct.confd-r1 | 11 | ||||
-rw-r--r-- | sys-process/acct/files/acct.initd-r2 | 65 | ||||
-rw-r--r-- | sys-process/acct/files/acct.logrotate-r1 | 18 |
4 files changed, 314 insertions, 0 deletions
diff --git a/sys-process/acct/files/acct-6.6.4-cross-compile.patch b/sys-process/acct/files/acct-6.6.4-cross-compile.patch new file mode 100644 index 000000000000..c4938d956dd3 --- /dev/null +++ b/sys-process/acct/files/acct-6.6.4-cross-compile.patch @@ -0,0 +1,220 @@ +Don't generate files.h at build-time using an execution test. + +The *_LOC variables are never used in the build itself, but only in the +built code; this means that they don't need to be known to ./configure at +all. + +Since the previous method made acct not cross-compilable at all, this is +much preferred. + +Author: Diego Elio Pettenò <flameeyes@gmail.com> +Upstream: https://savannah.gnu.org/patch/?7473 + +--- a/Makefile.am ++++ b/Makefile.am +@@ -69,11 +69,6 @@ SYS_LASTCOMM = @SYS_LASTCOMM@ + SYS_AC = @SYS_AC@ + SYS_SA = @SYS_SA@ + +-WTMP_FILE_LOC = @WTMP_FILE_LOC@ +-ACCT_FILE_LOC = @ACCT_FILE_LOC@ +-SAVACCT_FILE_LOC = @SAVACCT_FILE_LOC@ +-USRACCT_FILE_LOC = @USRACCT_FILE_LOC@ +- + compare-ac: ac + @echo + @echo "Running tests for ac" +--- a/configure.ac ++++ b/configure.ac +@@ -229,97 +229,6 @@ AC_CHECK_HEADER(sys/acct.h, + AC_EGREP_HEADER([comp_t],[sys/acct.h],[AC_DEFINE(HAVE_COMP_T, 1, Define if <sys/acct.h> uses the COMP_T type.)]) + ) ] + ) +-dnl +-dnl find out where utmp/pacct are stored +-dnl +-AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +-#include <stdio.h> +-#include <stdlib.h> +-#include <sys/types.h> +-#include <stdint.h> /* GNU/kFreeBSD */ +-#include <sys/acct.h> +-#include <utmp.h> +- +-#ifndef WTMP_FILE +-# if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__) \ +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__) +-# define WTMP_FILE "/var/log/account/wtmp" +-# else +-# if defined(sun) || defined(AMIX) +-# define WTMP_FILE "/var/adm/wtmp" +-# else +-# if defined(sgi) || defined(SVR4) +-# define WTMP_FILE "/usr/adm/wtmp" +-# else +-# define WTMP_FILE "/usr/adm/wtmp" +-# endif +-# endif +-# endif +-#endif +- +-#ifndef ACCT_FILE +-# if defined(__FreeBSD__) || defined(__linux__) \ +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__) +-# define ACCT_FILE "/var/log/account/pacct" +-# else +-# if defined(__NetBSD__) +-# define ACCT_FILE "/var/log/account/acct" +-# else +-# if defined(sun) || defined(AMIX) +-# define ACCT_FILE "/var/adm/pacct" +-# else +-# if defined(sgi) || defined(SVR4) || defined(M_XENIX) +-# define ACCT_FILE "/usr/adm/pacct" +-# else +-# define ACCT_FILE "/usr/adm/acct" +-# endif +-# endif +-# endif +-# endif +-#endif +- +-#ifndef SAVACCT_FILE +-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \ +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__) +-# define SAVACCT_FILE "/var/log/account/savacct" +-# else +-# if defined(sun) || defined(AMIX) +-# define SAVACCT_FILE "/var/adm/savacct" +-# else +-# if defined(sgi) || defined(SVR4) +-# define SAVACCT_FILE "/usr/adm/savacct" +-# else +-# define SAVACCT_FILE "/usr/adm/savacct" +-# endif +-# endif +-# endif +-#endif +- +-#ifndef USRACCT_FILE +-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \ +- || defined(__FreeBSD_kernel__) || defined(__GLIBC__) +-# define USRACCT_FILE "/var/log/account/usracct" +-# else +-# if defined(sun) || defined(AMIX) +-# define USRACCT_FILE "/var/adm/usracct" +-# else +-# if defined(sgi) || defined(SVR4) +-# define USRACCT_FILE "/usr/adm/usracct" +-# else +-# define USRACCT_FILE "/usr/adm/usracct" +-# endif +-# endif +-# endif +-#endif +-]], [[ +- FILE *fp; +- fp = fopen ("locs", "w"); +- fprintf (fp, "WTMP_FILE_LOC=%s\n", WTMP_FILE); +- fprintf (fp, "ACCT_FILE_LOC=%s\n", ACCT_FILE); +- fprintf (fp, "SAVACCT_FILE_LOC=%s\n", SAVACCT_FILE); +- fprintf (fp, "USRACCT_FILE_LOC=%s\n", USRACCT_FILE); +- fclose (fp); +-]])],[. ./locs; rm locs],[echo "Error -- could not locate your wtmp and acct files."; exit 1],[echo "Sorry -- you cannot cross-compile this package (FIXME)."; exit 1 ]) + + dnl types + AC_TYPE_PID_T dnl for sys/acct.h +@@ -363,12 +272,6 @@ AC_SUBST(ACCTON_MAN) + AC_SUBST(LASTCOMM_MAN) + AC_SUBST(SA_MAN) + +-dnl Substitutions for file locations +-AC_SUBST(WTMP_FILE_LOC) +-AC_SUBST(ACCT_FILE_LOC) +-AC_SUBST(SAVACCT_FILE_LOC) +-AC_SUBST(USRACCT_FILE_LOC) +- + dnl Dump the makefiles and etc. + AC_CONFIG_FILES([Makefile lib/Makefile files.h version.h]) + AC_OUTPUT +--- a/files.h.in ++++ b/files.h.in +@@ -30,6 +30,78 @@ + + #include <utmp.h> + ++#ifndef WTMP_FILE ++# if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__) \ ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__) ++# define WTMP_FILE "/var/log/account/wtmp" ++# else ++# if defined(sun) || defined(AMIX) ++# define WTMP_FILE "/var/adm/wtmp" ++# else ++# if defined(sgi) || defined(SVR4) ++# define WTMP_FILE "/usr/adm/wtmp" ++# else ++# define WTMP_FILE "/usr/adm/wtmp" ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef ACCT_FILE ++# if defined(__FreeBSD__) || defined(__linux__) \ ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__) ++# define ACCT_FILE "/var/log/account/pacct" ++# else ++# if defined(__NetBSD__) ++# define ACCT_FILE "/var/log/account/acct" ++# else ++# if defined(sun) || defined(AMIX) ++# define ACCT_FILE "/var/adm/pacct" ++# else ++# if defined(sgi) || defined(SVR4) || defined(M_XENIX) ++# define ACCT_FILE "/usr/adm/pacct" ++# else ++# define ACCT_FILE "/usr/adm/acct" ++# endif ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef SAVACCT_FILE ++# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \ ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__) ++# define SAVACCT_FILE "/var/log/account/savacct" ++# else ++# if defined(sun) || defined(AMIX) ++# define SAVACCT_FILE "/var/adm/savacct" ++# else ++# if defined(sgi) || defined(SVR4) ++# define SAVACCT_FILE "/usr/adm/savacct" ++# else ++# define SAVACCT_FILE "/usr/adm/savacct" ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef USRACCT_FILE ++# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) \ ++ || defined(__FreeBSD_kernel__) || defined(__GLIBC__) ++# define USRACCT_FILE "/var/log/account/usracct" ++# else ++# if defined(sun) || defined(AMIX) ++# define USRACCT_FILE "/var/adm/usracct" ++# else ++# if defined(sgi) || defined(SVR4) ++# define USRACCT_FILE "/usr/adm/usracct" ++# else ++# define USRACCT_FILE "/usr/adm/usracct" ++# endif ++# endif ++# endif ++#endif ++ + #define WTMP_FILE_LOC "@WTMP_FILE_LOC@" + #define ACCT_FILE_LOC "@ACCT_FILE_LOC@" + #define SAVACCT_FILE_LOC "@SAVACCT_FILE_LOC@" diff --git a/sys-process/acct/files/acct.confd-r1 b/sys-process/acct/files/acct.confd-r1 new file mode 100644 index 000000000000..4a05da34bcc5 --- /dev/null +++ b/sys-process/acct/files/acct.confd-r1 @@ -0,0 +1,11 @@ +# /etc/conf.d/acct + +# ACCT_LOG specifies the accounting logging file. +# Remember to create it manually if it doesn't yet exist. +#ACCT_LOG="/var/account/pacct" + +# REPORT_OPTS contains arguments for the "sa" command, +# used for console-reporting. +# Please run "sa --help" or "man sa" to get a description +# of available options. +#REPORT_OPTS="--sort-real-time --list-all-names --percentage" diff --git a/sys-process/acct/files/acct.initd-r2 b/sys-process/acct/files/acct.initd-r2 new file mode 100644 index 000000000000..4b3a5f3a50b6 --- /dev/null +++ b/sys-process/acct/files/acct.initd-r2 @@ -0,0 +1,65 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + + : ${ACCT_LOG:=/var/account/pacct} + : ${REPORT_OPTS:="--sort-real-time --list-all-names --percentage"} + +extra_started_commands="report" + +depend() { + need localmount +} + +_checkconfig() { + if [ -z "${ACCT_LOG}" ]; then + eerror "No accounting file specified!" + return 1 + fi + + checkpath -f -m 600 "${ACCT_LOG}" +} + +_get_service_value() { + local _name=$1 + + local _default_value= + if [ -n "${2}" ]; then + _default_value=$2 + fi + + local _service_value=$(service_get_value ${_name}) + if [ -n "${_service_value}" ]; then + echo "${_service_value}" + else + echo "${_default_value}" + fi + + return 0 +} + +ACCT_LOG=$(_get_service_value ACCT_LOG "${ACCT_LOG}") + +start_pre() { + _checkconfig || return 1 +} + +start() { + ebegin "Starting accounting" + accton "${ACCT_LOG}" >/dev/null + eend $? +} + +start_post() { + service_set_value ACCT_LOG "${ACCT_LOG}" +} + +stop() { + ebegin "Stopping accounting" + accton off >/dev/null + eend $? +} + +report() { + sa ${REPORT_OPTS} "${ACCT_LOG}" +} diff --git a/sys-process/acct/files/acct.logrotate-r1 b/sys-process/acct/files/acct.logrotate-r1 new file mode 100644 index 000000000000..3587e5acfa68 --- /dev/null +++ b/sys-process/acct/files/acct.logrotate-r1 @@ -0,0 +1,18 @@ +# Logrotate file for acct + +/var/account/pacct { + compress + delaycompress + notifempty + daily + rotate 31 + create 0600 root root + missingok + postrotate + if type -p systemctl 2>&1 1>/dev/null && systemctl is-system-running 2>&1 1>/dev/null ; then + systemctl try-restart acct 1>/dev/null + else + /etc/init.d/acct --quiet --ifstarted restart + fi + endscript +} |