From: Christian Heller Date: Thu, 2 May 2019 21:34:41 +0000 (+0200) Subject: Add script to set up user's secrets from specific dir. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/tasks?a=commitdiff_plain;h=184445c54c453d5dd885afb36cdc2fbac11e7207;p=config Add script to set up user's secrets from specific dir. --- 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