-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeb_package.sh
executable file
·65 lines (52 loc) · 1.53 KB
/
deb_package.sh
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
#!/bin/bash
# This script is based on the one you can find here: https://github.com/maoschanz/drawing
# (https://github.com/maoschanz/drawing/blob/master/utils-bash/deb_package.sh)
PACKAGE_NAME="pyopentracks"
VERSION="0.1.0"
#VERSION="$(git describe --tags --abbrev=0)"
#if [ $? != 0 ]
#then
# echo "fatal: last version couldn't be got from git"
# exit 1
#fi
function separator () {
echo ""
echo "---------------------------------------------------------------------"
echo ""
}
echo "Package name: $PACKAGE_NAME"
echo "Package version: $VERSION"
echo ""
echo "Is it correct? [Return/^C]"
read confirmation
separator
# Remember current directory (theorically, the project's root) to bring the package here in the end
previous_dir=`pwd`
# Set up specific structure required by debian scripts
DIR_PATH=/tmp/building-dir
DIR_NAME=$PACKAGE_NAME'-'$VERSION
FILE_NAME=$PACKAGE_NAME'_'$VERSION
mkdir -p $DIR_PATH/$DIR_NAME/
cp -r build-aux $DIR_PATH/$DIR_NAME/
cp -r data $DIR_PATH/$DIR_NAME/
cp -r debian $DIR_PATH/$DIR_NAME/
cp -r po $DIR_PATH/$DIR_NAME/
cp -r pyopentracks $DIR_PATH/$DIR_NAME/
cp meson.build $DIR_PATH/$DIR_NAME/
cd $DIR_PATH/
tar -Jcvf $FILE_NAME.orig.tar.xz $DIR_NAME
cd $DIR_PATH/$DIR_NAME/
separator
# Automatic creation of additional files for the build process
dh_make -i -y
separator
# Actually building the package
dpkg-buildpackage -i -us -uc -b
separator
# Get the package in /tmp and move it where the user is
cp $DIR_PATH/*.deb $previous_dir
# Cleaning
ls $DIR_PATH
ls $DIR_PATH/$DIR_NAME
rm -r $DIR_PATH
cd $previous_dir