summaryrefslogtreecommitdiffstats
path: root/.bin/bck-create
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2022-10-08 12:40:19 +0200
committerRomain Gonçalves <me@rgoncalves.se>2022-10-08 12:40:19 +0200
commitce6be946d024aa55a15d576388d05f90be671cf2 (patch)
treefa1053446a3fb06daee8438c1ff664cb36c0abcb /.bin/bck-create
parent703ed1915c69911a95cab6e1fb6524629c976800 (diff)
downloaddots-ce6be946d024aa55a15d576388d05f90be671cf2.tar.gz
Sat Oct 8 12:40:19 PM CEST 2022
Diffstat (limited to '.bin/bck-create')
-rwxr-xr-x.bin/bck-create21
1 files changed, 21 insertions, 0 deletions
diff --git a/.bin/bck-create b/.bin/bck-create
new file mode 100755
index 0000000..9714af6
--- /dev/null
+++ b/.bin/bck-create
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -xe
+
+directories="${HOME}/docs
+ ${HOME}/git.rgoncalves.se
+ ${HOME}/.local/share/gopass
+ ${HOME}/.local/share/mail
+ ${HOME}/.local/share/yadm
+ ${HOME}/.local/share/zk"
+
+pgp_id=$(gpg --list-secret-keys | grep -A 1 sec | tail -n 1 | tr -d " ")
+output_name="$(date -u +"%Y-%m-%dT%H_%M_%S%Z").tar.pgp"
+
+if [ -d "${1}" ]; then
+ output_name="${1}/${output_name}"
+elif [ -f "${1}" ] || [ "${1}" ]; then
+ output_name="${1}"
+fi
+
+tar cvf - ${directories} | lz4 | gpg -e -z 0 -r "${pgp_id}" > "${output_name}"
remember that computers suck.