-
Notifications
You must be signed in to change notification settings - Fork 2
/
makeDebPkg.sh
executable file
·188 lines (144 loc) · 4.29 KB
/
makeDebPkg.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/bash
DIR=$(dirname $(readlink -f $0))
if [ `arch` == 'x86_64' ]; then
ARCH=x86_64
ARCHITECTURE=amd64
else
ARCH=i386
ARCHITECTURE=i386
fi
VERSION=`cat "$DIR/VERSION"`
BINDIR=$DIR/build/bin
SHAREDIR=$BINDIR/share
BUILDDIR=$BINDIR/deb
OUTDIR=$DIR/build/packages
LIBDIVE=$BINDIR/libdivecomputer.so
APPDIVEBOARD=$BINDIR/DiveboardAgent
PKGNAME=diveboard-agent-$VERSION-$ARCH.deb
INSTALLED_BYTES=`du -bsc $LIBDIVE $APPDIVEBOARD |tail -n 1 |cut -f 1`
INSTALLED_SIZE=`expr $INSTALLED_BYTES / 1024`
CONTROL="Package:diveboard-agent
Version: $VERSION
Section: web
Priority: optional
Architecture: $ARCHITECTURE
Depends: libc6 (>= 2.11), libconfig9, libcurl3|libcurl4, libjpeg8, libpng12-0|libpng16-16, libssl1.1, libtiff5, libwebkitgtk-3.0-0, zlib1g (>= 1.1.4)
Replaces: diveboard (<= 1.1.1)
Maintainer: Diveboard <[email protected]>
Installed-Size: $INSTALLED_SIZE
Description: Dive Computer Agent for DiveBoard:
http://www.diveboard.com
.
With the DiveBoard-Agent program you can upload your dive
profiles direct from a supported dive computer to the web.
This plugin links with Jef Driesen's LibDiveComputer
http://www.libdivecomputer.org/
"
CHANGELOG="diveboard-agent ($VERSION) xenial; urgency=medium
* diveboard-agent version $VERSION
for more information and a detailed changelog
see the diveboard-agent repo on github
-- Thomas Horner <[email protected]> Fri, 20 Apr 2018 18:00:00 +0200
"
COPYRIGHT="Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: diveboard-agent
Source: diveboard
Files: *
Copyright: Copyright 2018 TBD <[email protected]>
License: TBD
TBD
"
MANPAGE=".\\\"Manpages for DiveboardAgent
.\\\"http://sourceforge.net/projects/gmanedit2
.TH man 1 \"April 20, 2018\" \"0.1\" \"DiveboardAgent\"
.SH NAME
DiveboardAgent \\- Dive Computer Agent for DiveBoard: http://www.diveboard.com
.SH SYNOPSIS
.B DiveboardAgent
.RI [ -h ] [ --help ] [ --verbose ]
.br
.SH DESCRIPTION
With the
.B DiveboardAgent
program you can upload your dive
profiles direct from a supported dive computer to the web.
This plugin links with Jef Driesen's LibDiveComputer
http://www.libdivecomputer.org/
.SH OPTIONS
.B
.IP -h
shows a help message
.B
.IP --help
shows a help message
.B
.IP --verbose
generate verbose log messages
.SH BUGS
For the list of known bugs see the diveboard-agent repo on github.
.SH \"SEE ALSO\"
For more information see the diveboard-agent repo on github.
"
#
# Put the package together
#
if [ ! -f $APPDIVEBOARD ]; then
echo Unable to find DiveBoard - did you build it?
echo MISSING: $APPDIVEBOARD
exit 1
fi
if [ ! -f $LIBDIVE ]; then
echo Unable to find libdivecomputer - did you build it?
echo MISSING: $LIBDIVE
exit 1
fi
echo Creating build structure...
mkdir -p $OUTDIR
rm -f $OUTDIR/$PKGNAME
rm -rf $BUILDDIR
mkdir -p $BUILDDIR/usr/lib/diveboard
mkdir -p $BUILDDIR/usr/bin/
echo Copying package contents...
cp $APPDIVEBOARD $BUILDDIR/usr/bin/DiveboardAgent
cp $LIBDIVE $BUILDDIR/usr/lib/diveboard/libdivecomputer.so
cp -r $SHAREDIR $BUILDDIR/usr/
echo Stripping binaries...
strip $BUILDDIR/usr/bin/DiveboardAgent
strip $BUILDDIR/usr/lib/diveboard/libdivecomputer.so
echo Creating required debian files
mkdir -p $BUILDDIR/usr/share/doc/diveboard-agent
echo -e "$CHANGELOG" |gzip -n -9 > $BUILDDIR/usr/share/doc/diveboard-agent/changelog.gz
echo -e "$COPYRIGHT" > $BUILDDIR/usr/share/doc/diveboard-agent/copyright
mkdir -p $BUILDDIR/usr/share/man/man1
echo -e "$MANPAGE" |gzip -n -9 > $BUILDDIR/usr/share/man/man1/DiveboardAgent.1.gz
echo Fixing permissions...
find $BUILDDIR/usr -type d -exec chmod 755 {} \;
find $BUILDDIR/usr -type f -exec chmod 644 {} \;
chmod 755 $BUILDDIR/usr/bin/DiveboardAgent
chmod 644 $BUILDDIR/usr/lib/diveboard/libdivecomputer.so
#chmod 644 $BUILDDIR/usr/share/* -R
echo Creating control file...
mkdir -p $BUILDDIR/DEBIAN
echo -e "$CONTROL" > $BUILDDIR/DEBIAN/control
echo Creating postinst script...
cat > $BUILDDIR/DEBIAN/postinst <<EOF
#!/bin/bash
set -e
exit 0
EOF
EOF
chmod 755 $BUILDDIR/DEBIAN/postinst
echo Creating prerm script...
cat > $BUILDDIR/DEBIAN/prerm <<EOF
#!/bin/bash
set -e
exit 0
EOF
EOF
chmod 755 $BUILDDIR/DEBIAN/prerm
echo Building Package...
fakeroot dpkg-deb --build $BUILDDIR $OUTDIR/$PKGNAME
if [ ! -f $OUTDIR/$PKGNAME ];then
echo Something went wrong!
exit 1
fi