updated to modern VTK
[engrid-github.git] / src / scripts / makedist.bash
blob72430894d97335ece551b050dfcbe748776e0a4a
1 #!/usr/bin/env bash
2 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 # + +
4 # + This file is part of enGrid. +
5 # + +
6 # + Copyright 2008-2014 enGits GmbH +
7 # + +
8 # + enGrid is free software: you can redistribute it and/or modify +
9 # + it under the terms of the GNU General Public License as published by +
10 # + the Free Software Foundation, either version 3 of the License, or +
11 # + (at your option) any later version. +
12 # + +
13 # + enGrid is distributed in the hope that it will be useful, +
14 # + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 # + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 # + GNU General Public License for more details. +
17 # + +
18 # + You should have received a copy of the GNU General Public License +
19 # + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 # + +
21 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 # set -x
25 # Check if all parameters are present
26 # If no, exit
27 if [ $# -ne 2 ]
28 then
29 echo
30 echo 'archives a git repository as <dir>_$(date +%Y%m%d_%H%M%S).tar.gz'
31 echo "usage :"
32 echo "$0 <GITDIR> <DESTDIR>"
33 echo "GITDIR = directory to archive. Usually 'engrid'"
34 echo "DESTDIR = Where the archive should be placed."
35 echo
36 exit 0
39 DIR=$(readlink -f $1)
40 BASE="engrid"
41 DESTDIR=$(readlink -f $2)
43 ORIG=`pwd`
45 DATE=$(date +%Y%m%d_%H%M%S)
46 ARCHIVE=$DESTDIR/$BASE\_$DATE.tar.gz
48 cd $DIR
49 if [ $? -ne 0 ]
50 then
51 echo "ERROR: Could not change directory"
52 exit 2
55 git status
56 if [ $? -eq 128 ]
57 then
58 echo "ERROR: No git repository found."
59 exit 2
62 if [ $( git status | wc -l ) -ne 2 ]
63 then
64 echo "Please commit latest changes before archiving. ;)"
65 echo "If you want to force archival, use:"
66 echo " cd $DIR"
67 echo " git archive --format=tar --prefix=$BASE/ HEAD | gzip >$ARCHIVE"
68 exit 2
71 git archive --format=tar --prefix=$BASE/ HEAD | gzip >$ARCHIVE
73 if [ $? -eq 0 ]
74 then
75 echo "All archived in $ARCHIVE"
76 exit 0
77 else
78 echo "ERROR: Archiving failed"
79 exit 1
82 cd $ORIG