-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_helper_notty.sh
executable file
·26 lines (23 loc) · 1.01 KB
/
docker_helper_notty.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
#!/bin/sh
VERSION=$(cat VERSION)
SSH_KEY=${SSH_KEY:-"${HOME}/.ssh/id_rsa"}
if [ ! -f "$HOME/.homelabos_vault_pass" ]; then
echo "Oops, I cannot find your vault password in $HOME/.homelabos_vault_pass"
echo "This is unusual, but could be caused by the user being changed during setup."
read -p "Press ctrl-c and create the file in the right place. Then file a bug report."
fi
if [ -f "${SSH_KEY}" -a -f "${SSH_KEY}.pub" -a -f "$HOME/.homelabos_vault_pass" ]; then
docker run --rm \
-v ${SSH_KEY}:/root/.ssh/id_rsa:Z \
-v ${SSH_KEY}.pub:/root/.ssh/id_rsa.pub:Z \
-v $(pwd):/data:Z \
-v $HOME/.homelabos_vault_pass:/ansible_vault_pass:Z \
nickbusey/homelabos:${VERSION} "$@"
else
echo "You have no SSH keys in your home directory: $HOME"
echo "Please generate a set of keys using the command:"
echo " ssh-keygen -t rsa"
echo "or copy your id_rsa and id_rsa.pub keys to $HOME/.ssh/"
echo "Then retry the operation"
read -p "Press ctrl-c and fix your ssh keys"
fi