X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fsend_and_run.tcl;fp=scripts%2Fsend_and_run.tcl;h=a087a2dbf964e77b369363ab4242fc3240153be8;hb=c15f2234474ff8a8266e26856702b3c561050667;hp=0000000000000000000000000000000000000000;hpb=985b53a258ee18eaca8d437ae532c232a6d19921;p=perso%2FImmae%2FProjets%2FPuppet.git 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 @@ +#!/usr/bin/expect -f +set dest [lindex $argv 0] +set password [lindex $argv 1] +set git_branch [lindex $argv 2] +set environment [lindex $argv 3] +set script [lindex $argv 4] +set files [lrange $argv 4 end] + +if {$password == ""} { + set ask_password 0 +} else { + set ask_password 1 +} + +set scriptname [file tail $script] + +set sshopts [split "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no"] + +set timeout -1 +spawn scp {*}$sshopts {*}$files $dest:/tmp +if {$ask_password} { + expect "assword:" + send "$password\n" +} +expect eof +spawn ssh {*}$sshopts $dest /tmp/$scriptname $git_branch $environment +if {$ask_password} { + expect "assword:" + send "$password\n" +} +expect eof