about summary refs log tree commit diff
path: root/bundles/restic-backup/files/resticrestore
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-09-07 17:32:13 +0200
committerRobert Günzler <r@gnzler.io>2025-09-07 17:42:42 +0200
commit38be6c13f76e893cf47636257071b440dec0c5b2 (patch)
treef7ded3235a7e3362cbd1ed3d91523968fe0faf90 /bundles/restic-backup/files/resticrestore
initial commit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/restic-backup/files/resticrestore')
-rw-r--r--bundles/restic-backup/files/resticrestore29
1 files changed, 29 insertions, 0 deletions
diff --git a/bundles/restic-backup/files/resticrestore b/bundles/restic-backup/files/resticrestore
new file mode 100644
index 0000000..68a10f1
--- /dev/null
+++ b/bundles/restic-backup/files/resticrestore
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -eu
+
+backup_tag=foobar
+backup_restore_snapshot=latest
+
+main() {
+	# remove stale locks
+	resticw unlock
+
+	# run restore
+	resticw restore \
+		--verify \
+		--tag "${backup_tag}" \
+		--include "${1:-*}" \
+		--target / \
+		"${backup_restore_snapshot}"
+
+	# TODO: restic check
+	# TODO: dump stats to file in metrics format to /run/prom/restic
+}
+
+exit_hook() {
+	resticw unlock
+}
+trap exit_hook INT EXIT
+
+[ "$1" = "-h" ] && printf 'usage: resticrestore [TARGET]\n\n' && exit 0
+main "$1"