Add self-contained automated server upgrade package
This commit is contained in:
1 parent
4d58fc7b66
commit
8e6c9a058f
14 files changed
+908
-26
No files matched your search
+10
-9
@@ -98,13 +98,9 @@ guard_workspaces() {
|
||||
init_runtime() {
|
||||
need python3; need flock
|
||||
guard_workspaces
|
||||
# Both backup and restore, and the installer, take the same lock.
|
||||
[[ $LOCKFILE == /* && ! -L $LOCKFILE ]] || die "Unsafe lock path"
|
||||
if [[ -e $LOCKFILE ]]; then
|
||||
[[ -f $LOCKFILE && ! -s $LOCKFILE && $(stat -c %u "$LOCKFILE") == 0 ]] || die "Unsafe existing lock file"
|
||||
fi
|
||||
exec 9>"$LOCKFILE"
|
||||
flock -n 9 || die "Another backup/restore/update holds $LOCKFILE"
|
||||
# shellcheck source=lib/locking.sh
|
||||
source "$LIB_DIR/locking.sh"
|
||||
acquire_backup_lock
|
||||
for p in "$WORKDIR" "$STAGING_ROOT" "$ARCHIVE_DIR" "$RESTORE_ROOT" "$LOG_DIR"; do
|
||||
[[ $p == /* && $p != / && $p != *$'\n'* && $p != *$'\t'* ]] || die "Unsafe working path: $p"
|
||||
[[ ! -L $p ]] || die "Symlink working directory refused: $p"
|
||||
@@ -221,8 +217,8 @@ check_remote() {
|
||||
done
|
||||
# Pipe directly into the parser: compatibility with older rclone without
|
||||
# config redacted. Secret values never go to the log or a temporary file.
|
||||
"$RCLONE_BIN" --config "$RCLONE_CONFIG" config show "$name" | helper crypt "$name"
|
||||
RCLONE_ARGS=(--config "$RCLONE_CONFIG" --no-check-certificate=false --crypt-filename-encryption standard
|
||||
"$RCLONE_BIN" --ask-password=false --config "$RCLONE_CONFIG" config show "$name" | helper crypt "$name"
|
||||
RCLONE_ARGS=(--ask-password=false --config "$RCLONE_CONFIG" --no-check-certificate=false --crypt-filename-encryption standard
|
||||
--crypt-directory-name-encryption=true --crypt-no-data-encryption=false
|
||||
--retries "$RCLONE_RETRIES" --low-level-retries "$RCLONE_LOW_LEVEL_RETRIES"
|
||||
--retries-sleep "$RCLONE_RETRIES_SLEEP" --timeout "$RCLONE_TIMEOUT" --contimeout "$RCLONE_CONTIMEOUT"
|
||||
@@ -289,6 +285,11 @@ quiesce() {
|
||||
if [[ $MAIL_BACKUP_MODE == stop ]]; then stop_service postfix; stop_service dovecot
|
||||
else echo "WARNING: live mail copy is not a consistent snapshot"; fi
|
||||
fi
|
||||
if [[ $ENABLE_NEXTCLOUD == true ]]; then
|
||||
# Cron daemons may leave an already launched PHP child running after stop.
|
||||
# Wait for direct cron.php / occ processes to finish; never kill them blindly.
|
||||
helper wait-nextcloud "$NC_DIR" "${WRITER_DRAIN_TIMEOUT:=300}"
|
||||
fi
|
||||
}
|
||||
# Survives SIGKILL/power loss, which Bash traps cannot handle. This is an
|
||||
# instruction record for the operator, not an automatically executed recovery.
|
||||
|
||||
Reference in new issue
Block a user