Merge branch 'stable' into unstable
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Jérémy Lecour 2022-01-31 11:56:10 +01:00 committed by Jérémy Lecour
commit cd4822488c
3 changed files with 19 additions and 7 deletions

View file

@ -14,8 +14,12 @@ The **patch** part changes is incremented if multiple releases happen the same m
### Changed ### Changed
* rbenv: install Ruby 3.1.0 by default
* evolinux-base: backup-server-state: add "force" mode
### Fixed ### Fixed
* evolinux-base: backup-server-state: fix systemctl invocation
### Removed ### Removed
### Security ### Security

View file

@ -2,7 +2,7 @@
PROGNAME="backup-server-state" PROGNAME="backup-server-state"
VERSION="22.01.2" VERSION="22.01.3"
readonly VERSION readonly VERSION
backup_dir= backup_dir=
@ -14,7 +14,7 @@ show_version() {
cat <<END cat <<END
${PROGNAME} version ${VERSION} ${PROGNAME} version ${VERSION}
Copyright 2018-2021 Evolix <info@evolix.fr>, Copyright 2018-2022 Evolix <info@evolix.fr>,
Jérémy Lecour <jlecour@evolix.fr> Jérémy Lecour <jlecour@evolix.fr>
and others. and others.
@ -31,6 +31,7 @@ Usage: ${PROGNAME} --backup-dir=/path/to/backup/directory [OPTIONS]
Options Options
-d, --backup-dir path to the directory where the backup will be stored -d, --backup-dir path to the directory where the backup will be stored
-f, --force keep existing backup directory and its content
--etc backup copy of /etc --etc backup copy of /etc
--no-etc no backup copy of /etc (default) --no-etc no backup copy of /etc (default)
--dpkg backup copy of /var/lib/dpkg --dpkg backup copy of /var/lib/dpkg
@ -680,7 +681,7 @@ backup_systemctl() {
systemctl_bin=$(command -v systemctl) systemctl_bin=$(command -v systemctl)
if [ -n "${systemctl_bin}" ]; then if [ -n "${systemctl_bin}" ]; then
last_result=$(${systemctl_bin} systemctl --no-legend --state=failed --type=service > "${backup_dir}/systemctl-failed-services.txt") last_result=$(${systemctl_bin} --no-legend --state=failed --type=service > "${backup_dir}/systemctl-failed-services.txt")
last_rc=$? last_rc=$?
if [ ${last_rc} -eq 0 ]; then if [ ${last_rc} -eq 0 ]; then
@ -703,8 +704,10 @@ main() {
fi fi
if [ -d "${backup_dir}" ]; then if [ -d "${backup_dir}" ]; then
echo "ERROR: The backup directory ${backup_dir} already exists. Delete it first." >&2 if [ "${FORCE}" != "1" ]; then
exit 2 echo "ERROR: The backup directory ${backup_dir} already exists. Delete it first." >&2
exit 2
fi
else else
create_backup_dir create_backup_dir
fi fi
@ -794,6 +797,10 @@ while :; do
VERBOSE=1 VERBOSE=1
;; ;;
-f|--force)
FORCE=1
;;
-d|--backup-dir) -d|--backup-dir)
# with value separated by space # with value separated by space
if [ -n "$2" ]; then if [ -n "$2" ]; then
@ -982,6 +989,7 @@ done
# Default values # Default values
: "${VERBOSE:=0}" : "${VERBOSE:=0}"
: "${FORCE:=0}"
: "${DO_ETC:=0}" : "${DO_ETC:=0}"
: "${DO_DPKG_FULL:=0}" : "${DO_DPKG_FULL:=0}"
: "${DO_DPKG_STATUS:=1}" : "${DO_DPKG_STATUS:=1}"

View file

@ -1,6 +1,6 @@
--- ---
rbenv_version: v1.1.2 rbenv_version: v1.2.0
rbenv_ruby_version: 2.7.0 rbenv_ruby_version: 3.1.0
rbenv_root: "~/.rbenv" rbenv_root: "~/.rbenv"
rbenv_repo: "https://github.com/rbenv/rbenv.git" rbenv_repo: "https://github.com/rbenv/rbenv.git"
rbenv_plugins: rbenv_plugins: