]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/expect -f | |
2 | set dest [lindex $argv 0] | |
3 | set password [lindex $argv 1] | |
4 | set git_branch [lindex $argv 2] | |
5 | set environment [lindex $argv 3] | |
6 | set script [lindex $argv 4] | |
7 | set files [lrange $argv 4 end] | |
8 | ||
9 | if {$password == "x"} { | |
10 | set ask_password 0 | |
11 | } else { | |
12 | set ask_password 1 | |
13 | } | |
14 | ||
15 | set scriptname [file tail $script] | |
16 | ||
17 | set sshopts [split "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no"] | |
18 | ||
19 | set timeout -1 | |
20 | spawn scp {*}$sshopts {*}$files $dest:/tmp | |
21 | if {$ask_password} { | |
22 | expect "assword:" | |
23 | send "$password\n" | |
24 | } | |
25 | expect eof | |
26 | spawn ssh {*}$sshopts $dest /tmp/$scriptname $git_branch $environment | |
27 | if {$ask_password} { | |
28 | expect "assword:" | |
29 | send "$password\n" | |
30 | } | |
31 | expect eof |