Update 2025-07-16 09:55 OpenBSD/amd64-t14
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
#!/bin/sh
|
||||
. $HOME/.bin/_config
|
||||
|
||||
[ -d "$1" ] || ( printf "Usage: backup <target>\n" && exit 2; )
|
||||
_target=$(readlink -f "$1" 2> /dev/null)
|
||||
|
||||
[ ! "$_target" ] \
|
||||
&& printf "Usage: backup <target>\n" \
|
||||
&& exit 2;
|
||||
|
||||
print "pass Internet/Tarsnap.key > /root/tarsnap.key ..."
|
||||
pass Internet/Tarsnap.key | doas tee /root/tarsnap.key > /dev/null
|
||||
doas chown root:sdk /root/tarsnap.key
|
||||
doas chmod 640 /root/tarsnap.key
|
||||
doas chmod 750 /root
|
||||
|
||||
print "Tarsnap Backup:"
|
||||
|
||||
_target=$(readlink -f "$1")
|
||||
_key=$(pwgen -n1 8)
|
||||
_date=$(date "+%Y-%m-%d %H:%M")
|
||||
_host=$(uname -n)
|
||||
|
||||
doas tarsnap --humanize-numbers --checkpoint-bytes 52428800 --exclude "*/.git/*" -cvf "$_host: $_target $_date ($_key)" "$_target"
|
||||
doas tarsnap --humanize-numbers --checkpoint-bytes 52428800 --exclude "*/.git/*" -cvf "$_host: $_target $_date ($_key)" "$_target"
|
||||
|
||||
Reference in New Issue
Block a user