summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Geddes <crgeddes@us.ibm.com>2018-04-20 11:46:24 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-04-23 20:57:22 -0400
commit6c6d831148fcb57e243ed49087f9d7d268626af8 (patch)
tree0f8d16c93f9cd4e8da8682cb399bc9e15a085dc5
parent812ee5cce1558fc488ce88774fdcf41adad5618b (diff)
downloadtalos-hostboot-6c6d831148fcb57e243ed49087f9d7d268626af8.tar.gz
talos-hostboot-6c6d831148fcb57e243ed49087f9d7d268626af8.zip
Create utility script to help automate scp calls to a given system
This script will leverage expect to automate scp calls to a given system target. Change-Id: Ica5ebdbe8d3b7674b445ffcd9e7b433ee0ae0359 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57564 Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Brian E. Bakke <bbakke@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rwxr-xr-xsrc/build/tools/auto_scp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/build/tools/auto_scp b/src/build/tools/auto_scp
new file mode 100755
index 000000000..e7f74293e
--- /dev/null
+++ b/src/build/tools/auto_scp
@@ -0,0 +1,50 @@
+#!/usr/bin/expect
+
+# Description : The purpose of this script is to create a tool which will use
+# expect to make scp calls to the FSP easier to do in a script.
+
+# Take in parameters
+set MACHINE [lindex $argv 0];
+set PASSWORD [lindex $argv 1];
+set FILE [lindex $argv 2];
+set OUTDIR [lindex $argv 3];
+
+set USER root
+if {$argc==5} {
+set USER [lindex $argv 4]
+}
+
+# Handle empty parameters
+if {$MACHINE==""} {
+ puts "\nError!! No target machine provided\n"
+}
+
+if {$PASSWORD=="" && $MACHINE!="-h" && $MACHINE!="--help"} {
+ puts "\nError!! No password provided\n"
+}
+
+if {$FILE=="" && $MACHINE!="-h" && $MACHINE!="--help" } {
+ puts "\nError!! No filepath to copy provided\n"
+}
+
+if {$OUTDIR=="" && $MACHINE!="-h" && $MACHINE!="--help" } {
+ puts "\nError!! No output directory on FSP provided\n"
+}
+
+# All parameters are required except USER, if any are missing , or if help flag is set dump
+# out some help text to the console
+if {$FILE=="" || $MACHINE=="" || $PASSWORD=="" || $OUTDIR=="" || $FILE=="-h" || $FILE=="--help" } {
+ puts "\nauto_scp <targetMachine> <password> <fileToCopy> <outDirOnFsp> <user(optional)>\n"
+ puts "Description: This script will copy a given file onto a given directory on a given fsp."
+ puts " If no user is provided script will default user to be \"root\"\n"
+ exit 1;
+}
+
+# Kick off the SCP command
+spawn scp -F /gsa/ausgsa/home/h/o/hostboot/fsp.ssh_config $FILE $USER@$MACHINE:$OUTDIR/
+
+# This expect part will automatically enter the password passed in as the 2nd param
+expect {
+password: {send "$PASSWORD\r"; exp_continue}
+}
+
OpenPOWER on IntegriCloud