home · contact · privacy
Add script to set up user's secrets from specific dir.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 2 May 2019 21:34:41 +0000 (23:34 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 2 May 2019 21:34:41 +0000 (23:34 +0200)
buster/setup_scripts/setup_secrets.sh [new file with mode: 0644]

diff --git a/buster/setup_scripts/setup_secrets.sh b/buster/setup_scripts/setup_secrets.sh
new file mode 100644 (file)
index 0000000..e33a52d
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+if [ "$#" -ne 1 ]; then
+    echo 'Need exactly one argument (directory).'
+    false
+fi
+directory="$1"
+borgkeys_dir=~/.config/borg/keys
+ssh_dir=~/.ssh
+
+cd "${directory}"
+mkdir -p "${ssh_dir}"
+cp id_rsa ~/.ssh
+ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
+tar xf borg_keyfiles.tar
+mkdir -p "${borgkeys_dir}"
+mv borg_keyfiles/* "${borgkeys_dir}"
+rmdir borg_keyfiles