summaryrefslogtreecommitdiff
path: root/util/bkdir
diff options
context:
space:
mode:
authorGeorge Abbott <george@gabbott.dev>2023-10-31 17:54:07 +0000
committerGeorge Abbott <george@gabbott.dev>2023-10-31 17:54:07 +0000
commit4d0bd914e7c1ee65f4036e60149a7b891906a5d3 (patch)
treec2a6751823e064e003cd4f6166df07bfc106d7eb /util/bkdir
Commit all to date.
Diffstat (limited to 'util/bkdir')
-rwxr-xr-xutil/bkdir12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/bkdir b/util/bkdir
new file mode 100755
index 0000000..9bd7e3b
--- /dev/null
+++ b/util/bkdir
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Backup a directory using GPG.
+# Usage: bkdir directory-name
+# Requires: tar, gpg, sha256sum (i.e. GNU/Linux).
+
+DIRECTORY="$1"
+
+tar czvf "$DIRECTORY.tar.gz" "$DIRECTORY"
+gpg --encrypt --armor --symmetric --output "$DIRECTORY.tar.gz.gpg" "$DIRECTORY.tar.gz"
+sha256sum "$DIRECTORY.tar.gz.gpg" | cut -c1-64 > "$DIRECTORY.tar.gz.sum"
+