#!/bin/bash

set -e

targ=cs-ccr-dev4

ssh wrci@${targ} "mkdir -p /user/wrci/ci-wr2rf/\"$CI_JOB_ID\""
# copy software directory
scp -r software wrci@${targ}:/user/wrci/ci-wr2rf/"$CI_JOB_ID"

ssh wrci@${targ} "\
    cd /user/wrci/ci-wr2rf/\"$CI_JOB_ID\"/software/libwr2rf;\
    make VMEBRIDGE=/acc/local/L867/drv/vmebus/current;\
    "

# copy wr2rf tool and version information
scp wrci@${targ}:/user/wrci/ci-wr2rf/"$CI_JOB_ID"/software/libwr2rf/{wr2rf,libwr2rf.a,spi_echo} .
