blob: d6e70296603847143f463fe56e393e3aa6acf1e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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"
|