From c15f2234474ff8a8266e26856702b3c561050667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 16 Mar 2018 00:22:38 +0100 Subject: Move scripts to separate chunks --- scripts/send_and_run.tcl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/send_and_run.tcl (limited to 'scripts/send_and_run.tcl') 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 -- cgit v1.2.3