Compare commits
No commits in common. "master" and "0.6.4" have entirely different histories.
56
CHANGELOG.md
56
CHANGELOG.md
|
@ -5,52 +5,6 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
* Add contrib/post-release.sh to help with post-release tasks
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
* Define $USER before it is used
|
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
## [24.05] - 2024-05-15
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
* Add missing (but documented) `--(no-)evocheck` options
|
|
||||||
|
|
||||||
## [23.10.1] - 2023-10-09
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
* Use a special variable name since USER is always defined from the environment
|
|
||||||
|
|
||||||
## [23.10] - 2023-10-09
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
* Force a user name with `-u,--user` option (default is still `logname(1)`).
|
|
||||||
* More people credited
|
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
|
|
||||||
* `--autosysadmin` is replaced by `--user autosysadmin`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [22.07] - 2022-07-05
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
* Add `--autosysadmin` flag
|
|
||||||
* Commit change in /etc of lxc containers
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
@ -61,16 +15,6 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
## [22.01] - 2022-01-25
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
* version/host/user headers in sent email
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
New version pattern
|
|
||||||
|
|
||||||
## [0.6.4] - 2021-06-17
|
## [0.6.4] - 2021-06-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Git pre-checkout hook restoring permissions and ownerships.
|
|
||||||
mtree -u < .mtree
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Git pre-commit hook storing permissions and ownerships.
|
|
||||||
|
|
||||||
mtreeignore=$(mktemp --suffix mtree)
|
|
||||||
|
|
||||||
mtree_exclude() {
|
|
||||||
echo .git
|
|
||||||
# Get ignored files from git https://stackoverflow.com/a/467053
|
|
||||||
find . -not -path './.git/*' | git check-ignore --stdin
|
|
||||||
}
|
|
||||||
|
|
||||||
# In case .mtree doens't exists yet, we still want it in the specification
|
|
||||||
# to be generated.
|
|
||||||
if [ -f .mtree ]; then
|
|
||||||
touch .mtree
|
|
||||||
fi
|
|
||||||
|
|
||||||
mtree_exclude > "$mtreeignore"
|
|
||||||
trap 'rm --force "$mtreeignore"' EXIT
|
|
||||||
|
|
||||||
mtree -x -c \
|
|
||||||
-p . \
|
|
||||||
-k uname,gname,mode \
|
|
||||||
-X "$mtreeignore" > .mtree
|
|
||||||
|
|
||||||
git add .mtree
|
|
|
@ -1,46 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# Post-release script
|
|
||||||
#
|
|
||||||
# It must me executed after a release,
|
|
||||||
# to copy parts to the correct downstream projects.
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
|
|
||||||
# Exit immediately if a pipeline (which may consist of a single simple command),
|
|
||||||
# a list, or a compound command (see SHELL GRAMMAR above), exits with a non-zero
|
|
||||||
# status.
|
|
||||||
set -o errexit
|
|
||||||
# If expansion is attempted on an unset variable or parameter, the shell prints an
|
|
||||||
# error message, and, if not interactive, exits with a non-zero status.
|
|
||||||
set -o nounset
|
|
||||||
# The pipeline's return status is the value of the last (rightmost) command
|
|
||||||
# to exit with a non-zero status, or zero if all commands exit successfully.
|
|
||||||
set -o pipefail
|
|
||||||
# Enable trace mode if called with environment variable TRACE=1
|
|
||||||
if [[ "${TRACE-0}" == "1" ]]; then
|
|
||||||
set -o xtrace
|
|
||||||
fi
|
|
||||||
|
|
||||||
REPOSITORIES_PARENT_DIR="${HOME}/GIT"
|
|
||||||
|
|
||||||
echo "Copy to ansible-roles.git :"
|
|
||||||
|
|
||||||
dest="${REPOSITORIES_PARENT_DIR}/ansible-roles/evomaintenance/files/upstream"
|
|
||||||
|
|
||||||
if [ ! -d "${dest}" ]; then
|
|
||||||
echo "Target doesn't look like an evomaintenance upstream directory. Check before running again."
|
|
||||||
else
|
|
||||||
cp CHANGELOG.md README.md evomaintenance.sh "${dest}/" && echo "Done!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Copy to EvoBSD.git :"
|
|
||||||
|
|
||||||
dest="${REPOSITORIES_PARENT_DIR}/EvoBSD/roles/evomaintenance/files/upstream"
|
|
||||||
|
|
||||||
if [ ! -d "${dest}" ]; then
|
|
||||||
echo "Target doesn't look like an evomaintenance upstream directory. Check before running again."
|
|
||||||
else
|
|
||||||
cp CHANGELOG.md README.md evomaintenance.sh "${dest}/" && echo "Done!"
|
|
||||||
fi
|
|
|
@ -1,16 +1,21 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
VERSION="24.05"
|
# EvoMaintenance script
|
||||||
|
# Dependencies (all OS): git postgresql-client
|
||||||
|
# Dependencies (Debian): sudo
|
||||||
|
|
||||||
|
# Copyright 2007-2021 Evolix <info@evolix.fr>, Gregory Colpart <reg@evolix.fr>,
|
||||||
|
# Jérémy Lecour <jlecour@evolix.fr> and others.
|
||||||
|
|
||||||
|
VERSION="0.6.4"
|
||||||
|
|
||||||
show_version() {
|
show_version() {
|
||||||
cat <<END
|
cat <<END
|
||||||
evomaintenance version ${VERSION}
|
evomaintenance version ${VERSION}
|
||||||
|
|
||||||
Copyright 2007-2024 Evolix <info@evolix.fr>,
|
Copyright 2007-2021 Evolix <info@evolix.fr>,
|
||||||
Gregory Colpart <reg@evolix.fr>,
|
Gregory Colpart <reg@evolix.fr>,
|
||||||
Jérémy Lecour <jlecour@evolix.fr>,
|
Jérémy Lecour <jlecour@evolix.fr>
|
||||||
Brice Waegeneire <bwaegeneire@evolix.fr>,
|
|
||||||
Mathieu Trossevin <mtrossevin@evolix.fr>
|
|
||||||
and others.
|
and others.
|
||||||
|
|
||||||
evomaintenance comes with ABSOLUTELY NO WARRANTY. This is free software,
|
evomaintenance comes with ABSOLUTELY NO WARRANTY. This is free software,
|
||||||
|
@ -42,11 +47,10 @@ Options
|
||||||
--no-evocheck disable evocheck execution
|
--no-evocheck disable evocheck execution
|
||||||
--auto use "auto" mode
|
--auto use "auto" mode
|
||||||
--no-auto use "manual" mode (default)
|
--no-auto use "manual" mode (default)
|
||||||
-u, --user=USER force USER value (default: logname(1))
|
|
||||||
-v, --verbose increase verbosity
|
-v, --verbose increase verbosity
|
||||||
-n, --dry-run actions are not executed
|
-n, --dry-run actions are not executed
|
||||||
--help print this message and exit
|
--help print this message and exit
|
||||||
-V, --version print version and exit
|
--version print version and exit
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,22 +97,13 @@ get_who() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_begin_date() {
|
get_begin_date() {
|
||||||
# XXX A begin date isn't applicable when used in autosysadmin, so we
|
|
||||||
# use the same date as the end date.
|
|
||||||
if is_autosysadmin; then
|
|
||||||
get_end_date
|
|
||||||
else
|
|
||||||
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
|
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_ip() {
|
get_ip() {
|
||||||
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
||||||
if is_autosysadmin || [ "${ip}" = ":0" ]; then
|
[ -z "${ip}" ] && ip="unknown (no tty)"
|
||||||
ip="localhost"
|
[ "${ip}" = ":0" ] && ip="localhost"
|
||||||
elif [ -z "${ip}" ]; then
|
|
||||||
ip="unknown (no tty)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "${ip}"
|
echo "${ip}"
|
||||||
}
|
}
|
||||||
|
@ -121,14 +116,6 @@ get_now() {
|
||||||
date +"%Y-%m-%dT%H:%M:%S%z"
|
date +"%Y-%m-%dT%H:%M:%S%z"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_user() {
|
|
||||||
if [ -n "${FORCE_USER}" ]; then
|
|
||||||
echo "${FORCE_USER}"
|
|
||||||
else
|
|
||||||
logname
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_complete_hostname() {
|
get_complete_hostname() {
|
||||||
REAL_HOSTNAME=$(get_fqdn)
|
REAL_HOSTNAME=$(get_fqdn)
|
||||||
if [ "${HOSTNAME}" = "${REAL_HOSTNAME}" ]; then
|
if [ "${HOSTNAME}" = "${REAL_HOSTNAME}" ]; then
|
||||||
|
@ -187,10 +174,6 @@ print_session_data() {
|
||||||
printf "Message : %s\n" "${MESSAGE}"
|
printf "Message : %s\n" "${MESSAGE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_autosysadmin() {
|
|
||||||
test "${USER}" = "autosysadmin"
|
|
||||||
}
|
|
||||||
|
|
||||||
is_repository_readonly() {
|
is_repository_readonly() {
|
||||||
if [ "$(get_system)" = "OpenBSD" ]; then
|
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||||
partition=$(stat -f '%Sd' $1)
|
partition=$(stat -f '%Sd' $1)
|
||||||
|
@ -320,9 +303,6 @@ From: ${FULLFROM}
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
X-Evomaintenance-Version: ${VERSION}
|
|
||||||
X-Evomaintenance-Host: ${HOSTNAME_TEXT}
|
|
||||||
X-Evomaintenance-User: ${USER}
|
|
||||||
To: ${EVOMAINTMAIL}
|
To: ${EVOMAINTMAIL}
|
||||||
Subject: [evomaintenance] Intervention sur ${HOSTNAME_TEXT} (${USER})
|
Subject: [evomaintenance] Intervention sur ${HOSTNAME_TEXT} (${USER})
|
||||||
|
|
||||||
|
@ -399,7 +379,6 @@ AUTO=${AUTO:-"0"}
|
||||||
EVOCHECK=${EVOCHECK:-"0"}
|
EVOCHECK=${EVOCHECK:-"0"}
|
||||||
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
||||||
API_ENDPOINT=${API_ENDPOINT:-""}
|
API_ENDPOINT=${API_ENDPOINT:-""}
|
||||||
FORCE_USER=${FORCE_USER:-""}
|
|
||||||
|
|
||||||
# initialize variables
|
# initialize variables
|
||||||
MESSAGE=""
|
MESSAGE=""
|
||||||
|
@ -437,14 +416,6 @@ while :; do
|
||||||
printf 'ERROR: "--message" requires a non-empty option argument.\n' >&2
|
printf 'ERROR: "--message" requires a non-empty option argument.\n' >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
--no-evocheck)
|
|
||||||
# disable evocheck hook
|
|
||||||
EVOCHECK=0
|
|
||||||
;;
|
|
||||||
--evocheck)
|
|
||||||
# enable evocheck hook
|
|
||||||
EVOCHECK=1
|
|
||||||
;;
|
|
||||||
--no-commit)
|
--no-commit)
|
||||||
# disable commit hook
|
# disable commit hook
|
||||||
HOOK_COMMIT=0
|
HOOK_COMMIT=0
|
||||||
|
@ -485,31 +456,6 @@ while :; do
|
||||||
# use "auto" mode
|
# use "auto" mode
|
||||||
AUTO=1
|
AUTO=1
|
||||||
;;
|
;;
|
||||||
--autosysadmin)
|
|
||||||
# Deprecated, backward compatibility
|
|
||||||
# author change as autosysadmin
|
|
||||||
printf 'WARNING: "--autosysadmin" is deprecated, use "--user autosysadmin".\n' >&2
|
|
||||||
FORCE_USER="autosysadmin"
|
|
||||||
;;
|
|
||||||
-u|--user)
|
|
||||||
# user options, with value speparated by space
|
|
||||||
if [ -n "$2" ]; then
|
|
||||||
FORCE_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 =
|
|
||||||
FORCE_USER=${1#*=}
|
|
||||||
;;
|
|
||||||
--user=)
|
|
||||||
# message options, without value
|
|
||||||
printf 'ERROR: "--user" requires a non-empty option argument.\n' >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
-n|--dry-run)
|
-n|--dry-run)
|
||||||
# disable actual commands
|
# disable actual commands
|
||||||
DRY_RUN=1
|
DRY_RUN=1
|
||||||
|
@ -545,10 +491,10 @@ set -u
|
||||||
HOSTNAME_TEXT=$(get_complete_hostname)
|
HOSTNAME_TEXT=$(get_complete_hostname)
|
||||||
# TTY=$(get_tty)
|
# TTY=$(get_tty)
|
||||||
# WHO=$(get_who)
|
# WHO=$(get_who)
|
||||||
USER=$(get_user)
|
|
||||||
IP=$(get_ip)
|
IP=$(get_ip)
|
||||||
BEGIN_DATE=$(get_begin_date)
|
BEGIN_DATE=$(get_begin_date)
|
||||||
END_DATE=$(get_end_date)
|
END_DATE=$(get_end_date)
|
||||||
|
USER=$(logname)
|
||||||
|
|
||||||
PATH=${PATH}:/usr/sbin
|
PATH=${PATH}:/usr/sbin
|
||||||
|
|
||||||
|
@ -587,11 +533,6 @@ EVOCHECK_BIN="/usr/share/scripts/evocheck.sh"
|
||||||
|
|
||||||
GIT_REPOSITORIES="/etc /etc/bind /usr/share/scripts"
|
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 -L /var/lib/lxc/ -maxdepth 3 -name 'etc' | tr '\n' ' ' | sed 's/[[:space:]]\+$//')"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# initialize variable
|
# initialize variable
|
||||||
GIT_STATUSES=""
|
GIT_STATUSES=""
|
||||||
# git statuses
|
# git statuses
|
||||||
|
|
Loading…
Reference in a new issue