~sophie-middleton08/maus/devel

« back to all changes in this revision

Viewing changes to third_party/bash/71test_data.bash

  • Committer: Chris Rogers
  • Date: 2013-06-06 13:19:58 UTC
  • mfrom: (659.1.70 release-candidate)
  • Revision ID: chris.rogers@stfc.ac.uk-20130606131958-3kqbba50996sv73h
Tags: MAUS-v0.5, MAUS-v0.5.4
MAUS-v0.5.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
 
 
3
run=04235
 
4
filename=${run}.tar
 
5
url=http://www.hep.ph.ic.ac.uk/micedata/MICE/Step1/04200/${filename}
 
6
 
 
7
stagedir=${MAUS_THIRD_PARTY}/third_party/source/
 
8
stagefile=${stagedir}/${filename}
 
9
 
 
10
destdir=${MAUS_THIRD_PARTY}/third_party/install/share/${run}
 
11
destfile=${destdir}/${filename}
 
12
 
 
13
# the point of staging to third_party/source/ is that then this will get 
 
14
# included in the release tarball (which pulls from third_party/source/)
 
15
 
 
16
if [ -n "${MAUS_THIRD_PARTY+x}" ]; then
 
17
 
 
18
    if [ -e "${stagefile}" ]
 
19
    then
 
20
        echo "INFO: Found source archive"
 
21
    else
 
22
        echo "INFO: Source archive doesn't exist.  Downloading..."
 
23
        wget ${url} -O "${stagefile}" 
 
24
    fi
 
25
    if [ -d "$destdir" ]
 
26
    then
 
27
        echo "INFO: $destdir exists"
 
28
    else
 
29
        mkdir -p $destdir
 
30
        echo "INFO: making $destdir"
 
31
    fi
 
32
    cp ${stagefile} ${destfile}
 
33
 
 
34
    if [ -e "${destfile}" ]
 
35
    then
 
36
        echo "INFO: Unpacking"
 
37
        echo
 
38
        cd "${destdir}"
 
39
        tar -xf ${filename}
 
40
        sleep 1
 
41
        echo "INFO: Checking md5sum"
 
42
        md5sum -c ${run}.md5 || { echo "FATAL: Failed checksum"; rm "${destdir}"; exit 1; }
 
43
        sleep 1
 
44
        echo
 
45
        echo
 
46
        echo "INFO: Data for $run now available for testing against"
 
47
    else
 
48
        echo "FATAL: Failed to get the data file - giving up">&2
 
49
        exit 1;
 
50
    fi
 
51
else
 
52
    echo
 
53
    echo "FATAL: MAUS_THIRD_PARTY is not set" >&2
 
54
    exit 1
 
55
fi