| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# Copyright (C) 2013 Anders Logg and Martin Sandve Alnaes |
| 4 |
# |
| 5 |
# This file is part of FIAT. |
| 6 |
# |
| 7 |
# FIAT is free software: you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU Lesser General Public License as published by |
| 9 |
# the Free Software Foundation, either version 3 of the License, or |
| 10 |
# (at your option) any later version. |
| 11 |
# |
| 12 |
# FIAT is distributed in the hope that it will be useful, |
| 13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
# GNU Lesser General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU Lesser General Public License |
| 18 |
# along with FIAT. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
# |
| 20 |
# First added: 2013-04-22 |
| 21 |
# Last changed: 2013-08-21 |
| 22 |
# |
| 23 |
# This script overwrites the reference data with the current output |
| 24 |
# and stores the new reference data as part of the FIAT reference data |
| 25 |
# repository. |
| 26 |
|
| 27 |
# Parameters |
| 28 |
source ./scripts/parameters |
| 29 |
|
| 30 |
# Get reference repository |
| 31 |
if [ ! -d "$DATA_DIR" ]; then |
| 32 |
echo "Cloning reference data repository" |
| 33 |
if [ -n "$DATA_REPO_GIT" ]; then |
| 34 |
git clone $DATA_REPO_GIT |
| 35 |
fi |
| 36 |
if [ ! -d "$DATA_DIR" ]; then |
| 37 |
git clone $DATA_REPO_HTTPS |
| 38 |
fi |
| 39 |
else |
| 40 |
pushd $DATA_DIR |
| 41 |
echo "Found existing reference data repository, pulling new data" |
| 42 |
git checkout master |
| 43 |
if [ $? -ne 0 ]; then |
| 44 |
echo "Failed to checkout master, check state of reference data directory." |
| 45 |
exit 1 |
| 46 |
fi |
| 47 |
git fetch |
| 48 |
if [ $? -ne 0 ]; then |
| 49 |
echo "WARNING: Failed to fetch latest reference data from server." |
| 50 |
else |
| 51 |
git pull |
| 52 |
if [ $? -ne 0 ]; then |
| 53 |
echo "Failed to pull latest reference data from server, possibly a merge situation." |
| 54 |
exit 1 |
| 55 |
fi |
| 56 |
fi |
| 57 |
popd |
| 58 |
fi |
| 59 |
|
| 60 |
# Check that we had success with getting reference repository |
| 61 |
if [ ! -d "$DATA_DIR" ]; then |
| 62 |
echo "Failed to update reference data directory '$DATA_DIR'." |
| 63 |
exit 1 |
| 64 |
fi |