summaryrefslogtreecommitdiff
path: root/testing/gitano-test-tool.in
diff options
context:
space:
mode:
Diffstat (limited to 'testing/gitano-test-tool.in')
-rw-r--r--testing/gitano-test-tool.in34
1 files changed, 28 insertions, 6 deletions
diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in
index 8436dd6..e892474 100644
--- a/testing/gitano-test-tool.in
+++ b/testing/gitano-test-tool.in
@@ -109,12 +109,28 @@ end
function cmd_createsshkey(username, keyname, optionaltype)
optionaltype = optionaltype or "rsa"
- run_program {
- "ssh-keygen", "-q",
- "-t", optionaltype,
- "-C", username .. "-" .. optionaltype .. "@" .. keyname,
- "-f", ssh_key_file(username, keyname),
- "-N", "" }
+ local targetkey = ssh_key_file(username, keyname)
+ local sourcekey = table.concat {
+ "testing/keys/", username, "@", keyname, "_", optionaltype }
+ local fh = io.open(sourcekey, "r")
+ if not fh then
+ run_program {
+ "ssh-keygen", "-q",
+ "-t", optionaltype,
+ "-C", username .. "-" .. optionaltype .. "@" .. keyname,
+ "-f", sourcekey,
+ "-N", "" }
+ fh = assert(io.open(sourcekey, "r"))
+ end
+ local ofh = assert(io.open(targetkey, "w"))
+ ofh:write(fh:read("*a"))
+ fh:close()
+ ofh:close()
+ fh = assert(io.open(sourcekey .. ".pub", "r"))
+ ofh = assert(io.open(targetkey .. ".pub", "w"))
+ ofh:write(fh:read("*a"))
+ fh:close()
+ ofh:close()
end
function cmd_setupstandard(owning_user, master_key)
@@ -122,6 +138,7 @@ function cmd_setupstandard(owning_user, master_key)
local fh = io.open(clodname, "w")
fh:write('setup.batch "true"\n')
fh:write(('paths.pubkey %q\n'):format(ssh_key_file(owning_user, master_key) .. ".pub"))
+ fh:write(('paths.repos %q\n'):format(user_home(owning_user) .. "/repos"))
fh:write('site.name "Gitano Test Instance"\n')
fh:write('log.prefix "gitano-test"\n')
fh:write(('admin.keyname %q\n'):format(master_key))
@@ -174,6 +191,11 @@ function cmd_findtoken()
print(token)
end
+function cmd_serverlocation(repo)
+ local h = user_home("testinstance")
+ print(table.concat({h, "repos", repo}, "/"))
+end
+
local cmd = table.remove(argv, 1)
if _G['cmd_' .. cmd] then
_G['cmd_' .. cmd](unpack(argv))