diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-12-26 17:06:41 +0100 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-12-26 17:06:41 +0100 |
commit | 223186ddd425927b5af99306b40be6ef582047ae (patch) | |
tree | 4476fe08bdda239ef38d23962a906909e719e075 /keys | |
download | recover-223186ddd425927b5af99306b40be6ef582047ae.tar.gz recover-223186ddd425927b5af99306b40be6ef582047ae.zip |
Init
Diffstat (limited to 'keys')
-rwxr-xr-x | keys | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/keys b/keys new file mode 100755 index 0000000..d6e7029 --- /dev/null +++ b/keys @@ -0,0 +1,38 @@ +#!/bin/sh +## Script for copying my keychain +## +## This script is supposed to sit on a removable drive with these files: +## - id_rsa - private ssh key +## - id_rsa.pub - public ssh key +## - secret.gpg - private gpg key +## - public.gpg - public gpg key +## +## To setup your keys mount the drive, cd into it and run `./keys` + +set -euo pipefail + +echo "\$USER is $USER; \$HOME is $HOME" + +[ "$USER" != "pn" ] && echo "\nWarning: username is not 'pn'!\n" + +read -p "continue? [y/N]" choice + +case "$choice" in + y|Y) echo "Installing..." ;; + * ) echo "Mission aborted!"; exit 1 ;; +esac + +echo "Copying ssh key to $HOME/.ssh/id_rsa ..." +mkdir -p $HOME/.ssh +cp id_rsa $HOME/.ssh +cp id_rsa.pub $HOME/.ssh +chmod 700 $HOME/.ssh/id_rsa +echo "Ssh key done." + +echo "Importing gpg keys..." +cp public.gpg secret.gpg $HOME +gpg --import $HOME/public.gpg +echo "Key $HOME/public.gpg imported" +gpg --import $HOME/secret.gpg +echo "Key $HOME/secret.gpg imported" +echo "Gnupg keys done" |