From c673ed10c68ef567797c82b3b784e2d53c8f23da Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 9 Oct 2023 16:24:47 +0200 Subject: [PATCH] evomaintenance: upstream release 23.10 --- CHANGELOG.md | 1 + evomaintenance/files/evomaintenance.sh | 54 ++++++++++++++++++-------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88490bd5..451d535c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The **patch** part changes is incremented if multiple releases happen the same m * elasticsearch: improve networking configuration * evolinux-base: include files under `sshd_config.d` * evolinux-users: remove Stretch references in tasks that also apply to next Debian versions +* evomaintenance: upstream release 23.10 * lxc-php: change LXC container in bookworm for php82 * minifirewall: update nrpe script to check active configuration * minifirewall: upstream release 23.07 diff --git a/evomaintenance/files/evomaintenance.sh b/evomaintenance/files/evomaintenance.sh index bce0e562..d3ea6de6 100644 --- a/evomaintenance/files/evomaintenance.sh +++ b/evomaintenance/files/evomaintenance.sh @@ -1,21 +1,16 @@ #!/bin/sh -# EvoMaintenance script -# Dependencies (all OS): git postgresql-client -# Dependencies (Debian): sudo - -# Copyright 2007-2022 Evolix , Gregory Colpart , -# Jérémy Lecour and others. - -VERSION="22.07" +VERSION="23.10" show_version() { cat <, +Copyright 2007-2023 Evolix , Gregory Colpart , - Jérémy Lecour + Jérémy Lecour , + Brice Waegeneire , + Mathieu Trossevin and others. evomaintenance comes with ABSOLUTELY NO WARRANTY. This is free software, @@ -47,11 +42,11 @@ Options --no-evocheck disable evocheck execution --auto use "auto" mode --no-auto use "manual" mode (default) - --autosysadmin author change as autosysadmin + -u, --user=USER force USER value (default: logname(1)) -v, --verbose increase verbosity -n, --dry-run actions are not executed --help print this message and exit - --version print version and exit + -V, --version print version and exit END } @@ -109,7 +104,7 @@ get_begin_date() { get_ip() { ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//") - if is_autosysadmin || [ "${ip}" = ":0" ]; then + if is_autosysadmin || [ "${ip}" = ":0" ]; then ip="localhost" elif [ -z "${ip}" ]; then ip="unknown (no tty)" @@ -127,8 +122,8 @@ get_now() { } get_user() { - if is_autosysadmin; then - echo autosysadmin + if [ -n "${USER}" ]; then + echo "${USER}" else logname fi @@ -193,7 +188,7 @@ print_session_data() { } is_autosysadmin() { - test "${AUTOSYSADMIN}" -eq 1 + test "${USER}" = "autosysadmin" } is_repository_readonly() { @@ -404,7 +399,7 @@ AUTO=${AUTO:-"0"} EVOCHECK=${EVOCHECK:-"0"} GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20} API_ENDPOINT=${API_ENDPOINT:-""} -AUTOSYSADMIN=${AUTOSYSADMIN:-0} +USER=${USER:-""} # initialize variables MESSAGE="" @@ -482,6 +477,31 @@ while :; do # use "auto" mode AUTO=1 ;; + --autosysadmin) + # Deprecated, backward compatibility + # author change as autosysadmin + printf 'WARNING: "--autosysadmin" is deprecated, use "--user autosysadmin".\n' >&2 + USER="autosysadmin" + ;; + -u|--user) + # user options, with value speparated by space + if [ -n "$2" ]; then + USER=$2 + shift + else + printf 'ERROR: "--user" requires a non-empty option argument.\n' >&2 + exit 1 + fi + ;; + --user=?*) + # message options, with value speparated by = + USER=${1#*=} + ;; + --user=) + # message options, without value + printf 'ERROR: "--user" requires a non-empty option argument.\n' >&2 + exit 1 + ;; -n|--dry-run) # disable actual commands DRY_RUN=1