-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdoom2d_deb_maker
executable file
·105 lines (105 loc) · 4.2 KB
/
doom2d_deb_maker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
#
# Copyright (C) Andriy Shinkarchuck <[email protected]> 2011
#
# This file is part of the Doom2D:Rembo project.
#
# Doom2D:Rembo is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# Doom2D:Rembo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/> or
# write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
set -e
echo "Usage: doom2d_deb_maker <SOURCE_DIR> <DEST_DIR> <PACKAGE_NAME> <VERSION> <ARCH>"
echo "<SOURCE_DIR> and <DEST_DIR> should be absolute pathes"
WORK_DIR=`pwd`
if [ $# -ne 5 ]; then
echo "Error: Not enough actual parametres.";
echo "Usage: doom2d_deb_maker <SOURCE_DIR> <DEST_DIR> <PACKAGE_NAME> <VERSION> <ARCH>"
exit 1
else
SOURCE_DIR=$1
DEST_DIR=$2
PACKAGE_NAME=$3
VERSION=$4
ARCH=$5
if [ -d $DEST_DIR ]; then
echo $DEST_DIR" is already created. mkdir skipping"
else
mkdir $DEST_DIR
chmod -fR 755 $DEST_DIR
echo "mkdir "$DEST_DIR" success"
fi
if [ "$(ls -A $DEST_DIR)" ]; then
echo "Error: "$DEST_DIR" is not empty. Please, check it content and delete if it is unnecesary before starting"
exit 1
fi
if [ -d $SOURCE_DIR ]; then
if [ -d $SOURCE_DIR/src ]; then
if [ -d $SOURCE_DIR/music ]; then
if [ -d $SOURCE_DIR/src/build ]; then
rm -rf $SOURCE_DIR/src/build
echo "Cleaning "$SOURCE_DIR"/src/build after previous build"
fi
cd $SOURCE_DIR/src
mkdir $SOURCE_DIR/src/build
cd $SOURCE_DIR/src/build
echo "Compilation of "$PACKAGE_NAME" started"
cmake ..
make
echo "Compilation of "$PACKAGE_NAME" finished succesfully"
else
echo "Error: Your source tree in "$SOURCE_DIR" is damaged. Check your sources tarball consistency"
exit 1
fi
else
echo "Error: Your source tree in "$SOURCE_DIR" is damaged. Check your sources tarball consistency"
exit 1
fi
else
echo "Error: "$SOURCE_DIR" not found. Please, check parametres"
exit 1
fi
echo "mkdir debian package folder structure in "$DEST_DIR
mkdir $DEST_DIR/DEBIAN
mkdir $DEST_DIR/usr
mkdir $DEST_DIR/usr/bin
mkdir $DEST_DIR/usr/share
mkdir $DEST_DIR/usr/share/doom2d-rembo
chmod -fR 755 $DEST_DIR/
echo "Done"
echo "Copying binary and data files"
cp -fR $SOURCE_DIR/music $DEST_DIR/usr/share/doom2d-rembo/
cp -f $SOURCE_DIR/src/*.wad $DEST_DIR/usr/share/doom2d-rembo/
cp -f $SOURCE_DIR/src/*.cfg $DEST_DIR/usr/share/doom2d-rembo/
cp -f $SOURCE_DIR/src/build/doom2d $DEST_DIR/usr/bin
echo "Done"
touch $DEST_DIR/DEBIAN/control
echo "control file generating"
echo "Package: "$PACKAGE_NAME >> $DEST_DIR/DEBIAN/control
echo "Version: "$VERSION >> $DEST_DIR/DEBIAN/control
echo "Architecture: "$ARCH >> $DEST_DIR/DEBIAN/control
echo "Maintainer: Rembo <[email protected]>" >> $DEST_DIR/DEBIAN/control
echo "Installed-Size: "`du -ks $DEST_DIR/usr/ | grep -o \[0-9\]*` >> $DEST_DIR/DEBIAN/control
echo "Depends: libc6 (>= 2.3), libsdl-mixer1.2 (>= 1.2.6), libsdl1.2debian (>= 1.2.10-1)" >> $DEST_DIR/DEBIAN/control
echo "Section: games" >> $DEST_DIR/DEBIAN/control
echo "Priority: optional" >> $DEST_DIR/DEBIAN/control
echo "Homepage: http://code.google.com/p/doom2d-rembo/" >> $DEST_DIR/DEBIAN/control
echo "Description: Doom2D:Rembo is a Linux port of Doom2D game," >> $DEST_DIR/DEBIAN/control
echo " free DOS two-dimensional arcade created by" >> $DEST_DIR/DEBIAN/control
echo " Russian video game company \"Prikol Software\"" >> $DEST_DIR/DEBIAN/control
echo " in early 1996 being inspired by original DOOM game by id Software." >> $DEST_DIR/DEBIAN/control
echo "Done"
ARCHIVE_NAME=$PACKAGE_NAME"_"$VERSION"_"$ARCH.deb
fakeroot dpkg-deb --build $DEST_DIR $ARCHIVE_NAME
echo $ARCHIVE_NAME" was created succesfully at "$SOURCE_DIR"/src/build/"
fi