DEADSOFTWARE

portability: avoid errors on some compilers
[flatwaifu.git] / doom2d_tarball_maker
1 #!/bin/bash
2 #
3 # Copyright (C) Andriy Shinkarchuck <adriano32.gnu@gmail.com> 2011
4 #
5 # This file is part of the Doom2D:Rembo project.
6 #
7 # Doom2D:Rembo is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
10 #
11 # Doom2D:Rembo is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <http://www.gnu.org/licenses/> or
18 # write to the Free Software Foundation, Inc.,
19 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #
21 set -e
22 echo "Usage: doom2d_tarball_maker <TARBALL_NAME>"
23 echo "Example: doom2d_tarball_maker doom2d-1.35.1-src"
24 WORK_DIR=`pwd`
25 if [ $# -ne 1 ]; then
26 echo "Usage: doom2d_tarball_maker <TARBALL_NAME>"
27 echo "Example: doom2d_tarball_maker doom2d-1.35.1-src"
28 exit 1
29 else
30 TARBALL_NAME=$1
31 mkdir $WORK_DIR/tmp
32 cd $WORK_DIR/tmp
33 if [ -x `which hg` ]; then
34 hg clone https://code.google.com/p/doom2d-rembo/ doom2d-rembo
35 fi
36 if [ "$(ls -A $WORK_DIR/tmp/doom2d-rembo/)" ]; then
37 if [ -d $WORK_DIR/tmp/doom2d-rembo/src ]; then
38 if [ -d $WORK_DIR/tmp/doom2d-rembo/music ]; then
39 rm -fR $WORK_DIR/tmp/doom2d-rembo/.hg
40 cd $WORK_DIR/tmp
41 tar cf - doom2d-rembo/ | gzip -f9 > $TARBALL_NAME.tar.gz
42 else
43 echo "Error: Your source tree in "$WORK_DIR" is damaged. Check it for consistency"
44 exit 1
45 fi
46 else
47 echo "Error: Your source tree in "$WORK_DIR" is damaged. Check it for consistency"
48 exit 1
49 fi
50 else
51 echo "Error: Your source tree in "$WORK_DIR" is empty. Check it for consistency"
52 exit 1
53 fi
54 cd $WORK_DIR
55 cp $WORK_DIR/tmp/$TARBALL_NAME.tar.gz $WORK_DIR
56 rm -fR $WORK_DIR/tmp
57 echo $TARBALL_NAME".tar.gz created succesfully in "$WORK_DIR". Temporary files were removed"
58 fi