diff --git a/.bin/tarsnap-delete b/.bin/tarsnap-delete new file mode 100755 index 0000000..e8eba31 --- /dev/null +++ b/.bin/tarsnap-delete @@ -0,0 +1,21 @@ +#!/bin/sh +. $HOME/.bin/_config + +print "Tarsnap Delete:" + +if [ -z "$1" ]; then + doas tarsnap --list-archives | sort + printf "Usage: delete \n" + exit 2 +fi + +_delete="$(doas tarsnap --list-archives | grep "$1")" +if [ -z "$_delete" ]; then + print "No backup with key id $1 found." + exit 1 +fi + +print "Deleting: $_delete" +doas tarsnap -df "$_delete" +print "done." + diff --git a/.bin/tarsnap-restore b/.bin/tarsnap-restore new file mode 100755 index 0000000..acbe3f3 --- /dev/null +++ b/.bin/tarsnap-restore @@ -0,0 +1,20 @@ +#!/bin/sh +. $HOME/.bin/_config + +print "Tarsnap Restore:" + +if [ -z "$1" ]; then + doas tarsnap --list-archives | sort + printf "Usage: restore \n" + exit 2 +fi + +_backup="$(doas tarsnap --list-archives | grep "$1")" +if [ -z "$_backup" ]; then + print "No backup with key id $1 found." + exit 1 +fi + +mkdir "restore_$1" +doas tarsnap --humanize-numbers -xvf "$_backup" -C "restore_$1" +print "Data restored in $(readlink -f "restore_$1")"