-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtemplate.lua
More file actions
executable file
·50 lines (43 loc) · 1.25 KB
/
template.lua
File metadata and controls
executable file
·50 lines (43 loc) · 1.25 KB
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
#!/usr/bin/env lua
function waitForEnter()
print("Press enter to continue: ")
io.read()
end
function createSshKeypair(username)
print("Run:")
print(string.format(" ssh-keygen -t rsa -f ~/%s", username))
waitForEnter()
end
function gitCommit(username)
print("Copy ~/new_key.pub into the `user_keys` Git repository, then run:")
print(string.format(" git commit %s", username))
print(" git push")
waitForEnter()
end
function waitForBuild()
build_url = "http://example.com/builds/user_keys"
print(string.format("Wait for the build job at %s to finish", build_url))
waitForEnter()
end
function retrieveUserEmail(username)
dir_url = "http://example.com/directory"
print(string.format("Go to %s", dir_url))
print(string.format("Find the email address for user `%s`", username))
print("Paste the email address and press enter: ")
local email = io.read()
print()
return email
end
function sendPrivateKey(email)
print("Go to 1Password")
print("Paste the contents of ~/new_key into a new document")
print(string.format("Share the document with %s", email))
waitForEnter()
end
username = arg[1]
createSshKeypair(username)
gitCommit(username)
waitForBuild()
email = retrieveUserEmail(username)
sendPrivateKey(email)
print("Done.")