-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian.sh
executable file
·66 lines (52 loc) · 1.73 KB
/
debian.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
#!/bin/bash
SOURCE_FILE='README.md'
APP=gnusocial
PREV_VERSION=1.2.0
VERSION=$(cat $SOURCE_FILE | grep 'Version:' | head -n 1 | awk -F ':' '{print $2}' | sed -e 's/^[ \t]*//')
RELEASE=$(cat $SOURCE_FILE | grep 'Release:' | head -n 1 | awk -F ':' '{print $2}' | sed -e 's/^[ \t]*//')
GNUSOCIAL_COMMIT=$(cat $SOURCE_FILE | grep 'Upstream commit:' | head -n 1 | awk -F ':' '{print $2}' | sed -e 's/^[ \t]*//')
ARCH_TYPE='all'
DIR=${APP}-${VERSION}
export DH_ALWAYS_EXCLUDE=.git
# Update version numbers automatically - so you don't have to
sed -i "s/VERSION=.*/VERSION='${VERSION}'/g" Makefile
sed -i "s/RELEASE=.*/RELEASE='${RELEASE}'/g" Makefile
sed -i "0,/RE/s/GNUSOCIAL_COMMIT=.*/GNUSOCIAL_COMMIT='${GNUSOCIAL_COMMIT}'/" upstream-to-debian.sh
sed -i "s/-'${PREV_VERSION}'.so/-'${VERSION}'.so/g" debian/*.links
if ! grep -q "$VERSION" debian/changelog; then
echo "Edit debian/changelog and add version $VERSION-$RELEASE at the top"
exit 1
fi
./upstream-to-debian.sh
make clean
make
if [ ! "$?" = "0" ]; then
exit 1
fi
# change the parent directory name to debian format
mv ../${APP}-debian ../${DIR}
# Create a source archive
make source
if [ ! "$?" = "0" ]; then
mv ../${DIR} ../${APP}-debian
exit 2
fi
# Build the package
dpkg-buildpackage -i -F
if [ ! "$?" = "0" ]; then
mv ../${DIR} ../${APP}-debian
exit 3
fi
# sign files
#gpg -ba ../${APP}_${VERSION}-1_${ARCH_TYPE}.deb
#gpg -ba ../${APP}_${VERSION}.orig.tar.gz
# restore the parent directory name
mv ../${DIR} ../${APP}-debian
if [ ! -f ../${APP}_${VERSION}-${RELEASE}_all.deb ]; then
echo "Failed to build ../${APP}_${VERSION}-${RELEASE}_all.deb"
exit 1
fi
echo 'Running lintian checks...'
lintian ../${APP}_${VERSION}-${RELEASE}_all.deb
echo 'Build complete'
exit 0