-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·48 lines (40 loc) · 1.5 KB
/
install.sh
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
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# Script will setup pretty much everything you need
# Installing keyfob
if [ ! -x "$(command -v keyfob)" ]; then
echo "keyfob is not installed, so I'm going to go grab the mac one for you"
if [ ! -x "$(command -v brew)" ]; then
KEYFOB_RELEASE='0.4.0'
echo "Homebrew is not installed, so I'm going to grab the v${KEYFOB_RELEASE} current release from github"
wget -O - "https://github.com/StevenACoffman/keyfob/releases/download/v${KEYFOB_RELEASE}/keyfob_${KEYFOB_RELEASE}_Darwin_x86_64.tar.gz" | tar xzvf
mkdir -p /usr/local/bin
mv keyfob /usr/local/bin
else
echo "Using homebrew and tapping StevenACoffman/keyfob"
brew tap StevenACoffman/keyfob
brew install keyfob
fi
fi
if [ ! -x "$(command -v aws-vault)" ]; then
echo "keyfob is not installed, so I'm going to go grab the mac one for you"
if [ ! -x "$(command -v brew)" ]; then
echo "Homebrew is not installed, so I'm **NOT** going to install aws-vault for you automatically"
else
echo "Using homebrew cask to install aws-vault"
brew cask install aws-vault
fi
fi
filename="${HOME}/.2fa"
if [ -f $filename ]; then
echo "Snarfing secrets from 2fa for you"
cat $filename | while read line
do
SIZE="$(echo $line | awk '{print $2}')"
KEY="$(echo $line | awk '{print $1}')"
VALUE="$(echo $line | awk '{print $3}')"
echo "Processing $KEY" >/dev/tty
keyfob add "${KEY}" "${VALUE}"
done
else
echo "${filename} does not exist so not automatically copying any keys from 2fa"
fi