summaryrefslogtreecommitdiff
path: root/request-trove-account
blob: 1f5ec8a19b4491c7190d04c76ec72e0c7aa46052 (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 -G --data-urlencode "name=$name" --data-urlencode "email=$email" --data-urlencode "phone=$phone" --data-urlencode "pubkey=$sshkey" http://trove-accounts.genivi.baserock.com >/dev/null