-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
80 lines (70 loc) · 2.25 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
# This script installs ssm to current directory
echo "==========================="
echo " INSTALLING SSM"
echo "==========================="
echo ""
echo "[INFO] This script will install ssm (https://github.com/houen/ssm) to your current directory."
current_dir=$(pwd)
install_dir="$current_dir/ssm"
echo "[INFO] Installing to $install_dir"
# ====================================
# Have user confirm installation directory
# ====================================
echo ""
read -p "[INPUT] Are you sure you want to install here? (Y/n): " do_install
do_install=${do_install:-Y}
if [ "$do_install" = "n" ] || [ "$do_install" = "N" ]; then
echo "[INFO] Aborting installation"
exit 1
fi
# ====================================
# Check that gpg command exists
# ====================================
echo ""
echo "[INFO] Checking that gpg is installed..."
gpg_path=$(command -v gpg)
if [ -z $gpg_path ]; then
echo "[ERROR] gpg is not installed"
exit 1
fi
echo "...ok!"
# ====================================
# Clone ssm master from github and remove ssm .git dir
# ====================================
echo ""
echo "[INFO] Pulling ssm from git and installing to $install_dir..."
git clone --depth 1 -q -- [email protected]:houen/ssm.git ssm && rm -Rf ssm/.git
echo "...ok!"
# ====================================
# Adapt gitignore
# - ignore .ssm.tmp files
# - do not ignore .ssm.gpg files
# ====================================
echo ""
echo "[INFO] Marking .ssm.tmp files as ignored in .gitignore..."
echo '*.ssm.tmp' >> .gitignore
echo "[INFO] Marking .ssm.gpg files as not ignored in .gitignore..."
# Add gitginore exception
echo '!*.ssm.gpg' >> .gitignore
# Add EOF newline
echo '' >> .gitignore
echo "...ok!"
# ====================================
# Post-install instructions
# ====================================
echo ""
echo ""
echo "==========================="
echo "Success! ssm is now installed."
echo "==========================="
echo ""
echo "Next steps:"
echo ""
echo "- Add your gpg key with ssm/bin/import_pubkey YOUR_KEY_ID"
echo "- Add secrets with ssm/bin/add_secret_file relative/path/to/file"
echo "- Encrypt secrets with ssm/bin/encrypt_secrets"
echo ""
echo "For more information, see README at https://github.com/houen/ssm)"
echo ""
echo "."