-
Notifications
You must be signed in to change notification settings - Fork 1
/
deb-package.sh
executable file
·61 lines (51 loc) · 1.69 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
#/bin/bash
set -e
# Package needs to be build before creating the .deb file
# Recomended way to building the binary:
# ./configure --disable-lib-build
# make -j4
if [[ ! -f build/tekstitv ]]; then
echo "build/tekstitv not found."
echo "Binary needs to be build before creating the .deb file"
exit 1
fi
architecture=`uname -m`
major_version=`awk '/TEKSTITV_MAJOR_VERSION/{print $3}' include/tekstitv.h`
minor_version=`awk '/TEKSTITV_MINOR_VERSION/{print $3}' include/tekstitv.h`
case "$architecture" in
x86_64)
architecture=amd64
;;
x86)
architecture=i386
;;
# TODO: deal with more arm stuff
armv7l)
architecture=armhf
;;
*)
echo "Invalid architecture: $architecture"
exit 1
;;
esac
deb_file_name="tekstitv_$major_version.$minor_version-1_$architecture"
echo "Building: $deb_file_name"
# Generate the DEBIAN control
echo "Package: tekstitv" > DEBIAN/control
echo "Version: $major_version.$minor_version" >> DEBIAN/control
echo "Architecture: $architecture" >> DEBIAN/control
cat DEBIAN/control.in >> DEBIAN/control
# Set up DEBIAN
mkdir -p "build/$deb_file_name"
cp -r DEBIAN "build/$deb_file_name"
# control.in doesn't belong in to the .deb package
rm build/$deb_file_name/DEBIAN/control.in
# Setup the files that are going to be installed
mkdir -p "build/$deb_file_name/usr/bin"
cp build/tekstitv "build/$deb_file_name/usr/bin"
mkdir -p "build/$deb_file_name/etc/bash_completion.d"
cp tekstitv-completion.sh "build/$deb_file_name/etc/bash_completion.d/tekstitv"
# Finally create the actual .deb package
cd build
dpkg-deb --build --root-owner-group $deb_file_name
echo "build/$deb_file_name.deb build succesfully!"