diff --git a/infrastructure/backup/image/resources/restore.sh b/infrastructure/backup/image/resources/restore.sh index 8fdf395..0d1052d 100755 --- a/infrastructure/backup/image/resources/restore.sh +++ b/infrastructure/backup/image/resources/restore.sh @@ -18,8 +18,8 @@ function main() { rm -rf /var/backups/gitea/* rm -rf /var/backups/git/repositories/* - cp -r /var/backups/restore/gitea /var/backups/ #ToDo: mv instead of cp or rm -rf after - cp -r /var/backups/restore/git/repositories /var/backups/git/ #ToDo: mv instead of cp or rm -rf after + mv /var/backups/restore/gitea /var/backups/ + mv /var/backups/restore/git/repositories /var/backups/git/ # adjust file permissions for the git user chown -R 1000:1000 /var/backups diff --git a/infrastructure/backup/test/resources/test.bb b/infrastructure/backup/test/resources/test.bb index 711736b..ae50704 100755 --- a/infrastructure/backup/test/resources/test.bb +++ b/infrastructure/backup/test/resources/test.bb @@ -2,7 +2,8 @@ (require '[babashka.tasks :as tasks] '[dda.backup.management :as mgm] - '[dda.backup.backup :as bak]) + '[dda.backup.backup :as bak] + '[dda.backup.restore :as rs]) (defn restic-repo-init! [] @@ -15,13 +16,15 @@ (tasks/shell "mkdir" "-p" "test-backup") (spit "test-backup/file" "I was here") (bak/backup! {:password-file "restic-pwd" - :restic-repository "restic-repo"} - ["test-backup"])) + :restic-repository "restic-repo" + :files ["test-backup"]})) (defn restic-restore! [] (tasks/shell "mkdir" "-p" "test-restore") - (tasks/shell "restic" "restore" "--password-file" "restic-pwd" "--repo" "restic-repo" "--target" "test-restore" "latest")) + (rs/restore! {:password-file "restic-pwd" + :restic-repository "restic-repo" + :target-directory "test-restore"})) (restic-repo-init!) (restic-backup!)