From 184445c54c453d5dd885afb36cdc2fbac11e7207 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 2 May 2019 23:34:41 +0200 Subject: [PATCH] Add script to set up user's secrets from specific dir. --- buster/setup_scripts/setup_secrets.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 buster/setup_scripts/setup_secrets.sh diff --git a/buster/setup_scripts/setup_secrets.sh b/buster/setup_scripts/setup_secrets.sh new file mode 100644 index 0000000..e33a52d --- /dev/null +++ b/buster/setup_scripts/setup_secrets.sh @@ -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 -- 2.30.2