backups: implement list/create and dry-run restore

This commit is contained in:
lassulus
2023-12-07 18:23:22 +01:00
parent 45e9ab45f7
commit cf68bd41d6
4 changed files with 64 additions and 18 deletions

View File

@@ -67,11 +67,11 @@ in
clanCore.backups.providers.borgbackup = {
list = ''
ssh ${config.clan.networking.deploymentAddress} -- '
ssh ${config.clan.networking.deploymentAddress} <<EOF
${lib.concatMapStringsSep "\n" (dest: ''
borg-job-${dest.name} list --json
borg-job-${dest.name} list --json | jq -r '. + {"job-name": "${dest.name}"}'
'') (lib.attrValues cfg.destinations)}
'
EOF
'';
start = ''
ssh ${config.clan.networking.deploymentAddress} -- '
@@ -82,6 +82,11 @@ in
'';
restore = ''
ssh ${config.clan.networking.deploymentAddress} -- LOCATION="$LOCATION" ARCHIVE="$ARCHIVE_ID" JOB="$JOB" '
set -efux
cd /
borg-job-"$JOB" extract --list --dry-run "$LOCATION"::"$ARCHIVE"
'
'';
};
};