#!/bin/sh

# Copyright CERN, 2011
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org

LOGDIR=./log_fmcadc100m14b4cha

mkdir -p $LOGDIR
sudo rm -fr $LOGDIR/pts*

serial=$1
if [ x$1 = x"" ]; then
	echo -n "Please scan CERN serial number bar-code, then press [ENTER]: "
        read serial
fi

if [ x$serial = x"" ]; then
	serial=0000
fi

extra_serial=0000

if [ -e serial.txt ]; then
    sudo rm -f serial.txt
fi

echo $serial >> serial.txt

sudo ./pts.py -b FmcAdc100M14b4cha -s $serial -e $extra_serial -t./test/fmcadc100m14b4cha/python -l $LOGDIR 00 22 19 23 25

echo -n "End of the test, do you want to switch the computer OFF? [y,n]"
read reply
if [ "$reply" = "y" ]
then
    sudo halt
fi
