25 lines
1014 B
Bash
25 lines
1014 B
Bash
#!/usr/bin/env bash
|
|
# Private bridge to the existing crypt/environment validation and rclone flags.
|
|
set -Eeuo pipefail
|
|
LIB_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
|
# shellcheck source=lib/common.sh
|
|
source "$LIB_DIR/common.sh"
|
|
CONFIG_FILE=${1:?Missing config}
|
|
shift
|
|
load_config
|
|
if [[ ${1:-} == space ]]; then
|
|
# Local maintenance requested between components, while the parent holds FD 9.
|
|
[[ /proc/$PPID/fd/9 -ef $LOCKFILE ]] || die 'Space recovery requires the parent backup lock'
|
|
[[ ${2:-} =~ ^[0-9]+$ && $# == 2 ]] || die 'Invalid space request'
|
|
guard_workspaces
|
|
# shellcheck source=lib/space.sh
|
|
source "$LIB_DIR/space.sh"
|
|
clean_backup_scratch
|
|
MIN_FREE_GB=$(python3 -c 'import math,sys; print(math.ceil(float(sys.argv[1])))' "$RESTORE_TEST_MIN_FREE_GB")
|
|
ensure_space "$WORKDIR" "$2"
|
|
exit 0
|
|
fi
|
|
check_remote >&2
|
|
# rclone is restricted to read operations here, including metadata reads.
|
|
case ${1:-} in lsf|cat) rc "$@" ;; *) die 'Unsupported restore-test remote operation' ;; esac
|