-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreatePersephoneClient.sh
executable file
·34 lines (24 loc) · 1 KB
/
createPersephoneClient.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
#
# createPersephoneClient.sh
set -euo pipefail
# -----------------------------
# Main Script
# -----------------------------
# Prompt for Restic repository password
read -rp "Enter your repository password: " RESTIC_PASS
echo "Storing Restic password in /root/.restic-password..."
echo "${RESTIC_PASS}" | sudo tee /root/.restic-password
sudo chmod 600 /root/.restic-password
# Define the repository URL
# Adjust 'henry@backup' and path to match your actual backup server + path
read -p "What is the location of your persephone repository? (eg. user@backup-host:/path/to/persephone/repo): " PERS_REPO
echo "Initializing Restic repository at ${PERS_REPO}/$(hostname)..."
sudo restic -r "${PERS_REPO}/$(hostname)" init
echo "Restic repository initialized at ${PERS_REPO}/$(hostname)."
echo "${PERS_REPO}" | sudo tee /root/.restic-repo
sudo chmod 600 /root/.restic-repo
echo "Restic repository configuration files created:"
echo " - /root/.restic-password"
echo " - /root/.restic-repo"
echo "Done."