base: evomaintenance upstream update

This commit is contained in:
Jérémy Dubois 2022-06-30 17:52:35 +02:00
parent 674a4aa836
commit 8bfc0b1aea

View file

@ -97,13 +97,22 @@ get_who() {
}
get_begin_date() {
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
# XXX Begin end date isn't applicable when used in autosysadmin,
# so we use the same one as the end date.
if [ "${AUTOSYSADMIN}" -eq 1 ]; then
get_end_date
else
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
fi
}
get_ip() {
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
[ -z "${ip}" ] && ip="unknown (no tty)"
[ "${ip}" = ":0" ] && ip="localhost"
if [ "${AUTOSYSADMIN}" -eq 1 ] || [ "${ip}" = ":0" ]; then
ip="localhost"
elif [ -z "${ip}" ]; then
ip="unknown (no tty)"
fi
echo "${ip}"
}
@ -116,6 +125,14 @@ get_now() {
date +"%Y-%m-%dT%H:%M:%S%z"
}
get_user() {
if [ "${AUTOSYSADMIN}" -eq 1 ]; then
echo autosysadmin
else
logname
fi
}
get_complete_hostname() {
REAL_HOSTNAME=$(get_fqdn)
if [ "${HOSTNAME}" = "${REAL_HOSTNAME}" ]; then
@ -382,6 +399,7 @@ AUTO=${AUTO:-"0"}
EVOCHECK=${EVOCHECK:-"0"}
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
API_ENDPOINT=${API_ENDPOINT:-""}
AUTOSYSADMIN=${AUTOSYSADMIN:-0}
# initialize variables
MESSAGE=""
@ -536,6 +554,11 @@ EVOCHECK_BIN="/usr/share/scripts/evocheck.sh"
GIT_REPOSITORIES="/etc /etc/bind /usr/share/scripts"
# Add /etc directories from lxc containers if they are git directories
if [ -d /var/lib/lxc ]; then
GIT_REPOSITORIES="${GIT_REPOSITORIES} $(find /var/lib/lxc/ -maxdepth 3 -name 'etc' | tr '\n' ' ' | sed 's/[[:space:]]\+$//')"
fi
# initialize variable
GIT_STATUSES=""
# git statuses