-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_deb.sh
executable file
·58 lines (50 loc) · 1.53 KB
/
generate_deb.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
#!/usr/bin/env bash
set -eo pipefail
PREFIX="usr"
SPREFIX=${PREFIX}
SUBPREFIX="opt/${PROJECT}/${VERSION}"
SSUBPREFIX="opt\/${PROJECT}\/${VERSION}"
RELEASE="${VERSION_SUFFIX}"
# default release to "1" if there is no suffix
if [[ -z $RELEASE ]]; then
RELEASE="1"
fi
NAME="${PROJECT}_${VERSION_NO_SUFFIX}-${RELEASE}_amd64"
if [[ -f /etc/upstream-release/lsb-release ]]; then
source /etc/upstream-release/lsb-release
elif [[ -f /etc/lsb-release ]]; then
source /etc/lsb-release
else
echo "Unrecognized Debian derivative. Not generating .deb file."
exit 1
fi
if [ ${DISTRIB_RELEASE} = "16.04" ]; then
RELEASE_SPECIFIC_DEPS="libssl1.0.0, libicu55"
elif [ ${DISTRIB_RELEASE} = "18.04" ]; then
RELEASE_SPECIFIC_DEPS="libssl1.1, libicu60"
else
echo "Unrecognized Ubuntu version. Update generate_deb.sh. Not generating .deb file."
exit 1
fi
mkdir -p ${PROJECT}/DEBIAN
chmod 0755 ${PROJECT}/DEBIAN || exit 1
echo "Package: ${PROJECT}
Version: ${VERSION_NO_SUFFIX}-${RELEASE}
Section: devel
Priority: optional
Depends: libc6, libgcc1, ${RELEASE_SPECIFIC_DEPS}, libstdc++6, libtinfo5, zlib1g, libusb-1.0-0, libcurl3-gnutls
Architecture: amd64
Homepage: ${URL}
Maintainer: ${EMAIL}
Description: ${DESC}" &> ${PROJECT}/DEBIAN/control
cat ${PROJECT}/DEBIAN/control
export PREFIX
export SUBPREFIX
export SPREFIX
export SSUBPREFIX
. ./generate_tarball.sh ${NAME}
echo "Unpacking tarball: ${NAME}.tar.gz..."
tar -xzvf ${NAME}.tar.gz -C ${PROJECT} || exit 1
dpkg-deb --build ${PROJECT} || exit 1
mv ${PROJECT}.deb ${NAME}.deb || exit 1
rm -r ${PROJECT} || exit 1