summaryrefslogtreecommitdiff
path: root/request-trove-account
blob: d62baf6f2fca2d5ba8c682d83ef79351c48b1191 (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
#!/bin/bash
# request-trove-account - E-mails codethink with your public key requesting
#                         an account on the Trove.

echo -n "Please enter your name: "
read name
echo -n "Please enter your E-mail address: "
read email
echo -n "Please enter a telephone number: "
read phone

if [ -e ~/.ssh/id_rsa.pub ]; then
	echo "RSA key found"
	sshkey=$(cat ~/.ssh/id_rsa.pub)
elif [ -e ~/.ssh/id_dsa.pub ]; then
	echo "DSA key found"
	sshkey=$(cat ~/.ssh/id_dsa.pub)
else
	echo "No SSH keys found. Generating an RSA key"
	ssh-keygen -t rsa
	sshkey=$(cat ~/.ssh/id_rsa.pub)
fi

# remove leading/trailing white space (esp. newlines) from user data
name=$(echo -n $name) 
email=$(echo -n $email)
phone=$(echo -n $phone)
sshkey=$(echo -n $sshkey)

curl "http://trove-accounts.genivi.baserock.com/?name=$name&email=$email&phone=$phone&pubkey=$sshkey" >/dev/null