Files
borg/docker/app/scripts/entrypoint.sh
marcio.fernandes 3180d653d3
All checks were successful
/ build-docker-image (push) Successful in 8s
borg container image feature/review-docker: pipelines and scripts revisions (#1)
Co-authored-by: Márcio Fernandes <marcio.fernandes@outlook.pt>
Reviewed-on: #1
2025-09-21 19:23:37 +00:00

36 lines
789 B
Bash
Executable File

#!/bin/bash
source /app/scripts/loadenv
#fix if its an string instead of an array
IFS=' ' read -r -a rsh_parts <<< "$BORG_RSH"
export BORG_RSH="${rsh_parts[@]}"
case "$MODE" in
BORG)
echo "executing borg cli"
borg "${@:1}" # Forward all arguments except $0 to another CLI so first argument (the name of this scripts don't passthrough)"
;;
SCRIPT)
# check if file exists
if [ ! -f /app/backup-scripts/backup ]; then
cat /app/README.md
exit 1
fi
echo "Executing: backup script with arguments: ${@:1} "
cd /app/backup-scripts && bash backup "${@:1}"
;;
SHELL)
echo "Executing: bash script."
bash -c "${@:1}"
;;
*)
echo "Unknown mode: $MODE."
echo "Valid modes are: BORG, SCRIPT, SHELL"
exit 1
;;
esac