#!/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"