aboutsummaryrefslogtreecommitdiff
path: root/scripts/send_and_run.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/send_and_run.tcl')
-rwxr-xr-xscripts/send_and_run.tcl31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/send_and_run.tcl b/scripts/send_and_run.tcl
new file mode 100755
index 0000000..a087a2d
--- /dev/null
+++ b/scripts/send_and_run.tcl
@@ -0,0 +1,31 @@
1#!/usr/bin/expect -f
2set dest [lindex $argv 0]
3set password [lindex $argv 1]
4set git_branch [lindex $argv 2]
5set environment [lindex $argv 3]
6set script [lindex $argv 4]
7set files [lrange $argv 4 end]
8
9if {$password == ""} {
10 set ask_password 0
11} else {
12 set ask_password 1
13}
14
15set scriptname [file tail $script]
16
17set sshopts [split "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no"]
18
19set timeout -1
20spawn scp {*}$sshopts {*}$files $dest:/tmp
21if {$ask_password} {
22 expect "assword:"
23 send "$password\n"
24}
25expect eof
26spawn ssh {*}$sshopts $dest /tmp/$scriptname $git_branch $environment
27if {$ask_password} {
28 expect "assword:"
29 send "$password\n"
30}
31expect eof