2 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 # + This file is part of enGrid. +
6 # + Copyright 2008-2014 enGits GmbH +
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. +
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. +
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/>. +
21 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 # Check if all parameters are present
30 echo 'archives a git repository as <dir>_$(date +%Y%m%d_%H%M%S).tar.gz'
32 echo "$0 <GITDIR> <DESTDIR>"
33 echo "GITDIR = directory to archive. Usually 'engrid'"
34 echo "DESTDIR = Where the archive should be placed."
41 DESTDIR
=$
(readlink
-f $2)
45 DATE
=$
(date +%Y
%m
%d_
%H
%M
%S
)
46 ARCHIVE
=$DESTDIR/$BASE\_
$DATE.
tar.gz
51 echo "ERROR: Could not change directory"
58 echo "ERROR: No git repository found."
62 if [ $
( git status |
wc -l ) -ne 2 ]
64 echo "Please commit latest changes before archiving. ;)"
65 echo "If you want to force archival, use:"
67 echo " git archive --format=tar --prefix=$BASE/ HEAD | gzip >$ARCHIVE"
71 git archive
--format=tar --prefix=$BASE/ HEAD |
gzip >$ARCHIVE
75 echo "All archived in $ARCHIVE"
78 echo "ERROR: Archiving failed"