vito/app/SSH/Storage/scripts/s3/download.sh
Richard Anderson a73476c1dd
Edit & Download (local) Backups (#436)
* Allow editing of backups

* pint updates

* setup of backup download

* allow download for local backup files

* delete uploaded files on delete of BackupFile

* pint updates

* S3 upload & download fixes

* Deletion of backup files

* support $ARCH selector for s3 installation

* delete files when deleting backup

* fixed ui issue

* adjustment

* Use system temp path for downloads

---------

Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
2025-01-25 21:59:35 +01:00

33 lines
738 B
Bash

#!/bin/bash
command_exists() {
command -v "$1" >/dev/null 2>&1
}
install_aws_cli() {
echo "Installing AWS CLI"
ARCH=$(uname -m)
curl "https://awscli.amazonaws.com/awscli-exe-linux-$ARCH.zip" -o "aws.zip"
unzip -q aws.zip
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
rm -rf aws.zip aws
}
if ! command_exists aws; then
install_aws_cli
fi
if ! command_exists aws; then
echo "Error: AWS CLI installation failed"
exit 1
fi
export AWS_ACCESS_KEY_ID=__key__
export AWS_SECRET_ACCESS_KEY=__secret__
export AWS_DEFAULT_REGION=__region__
export AWS_ENDPOINT_URL=__endpoint__
if aws s3 cp s3://__bucket__/__src__ __dest__; then
echo "Download successful"
fi