-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathbuild-deb.sh
executable file
·47 lines (35 loc) · 1.29 KB
/
build-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
#!/bin/env bash
#
# This script wraps the steps required to locally build a deb package
# based on the in tree debian packaging (see invocation example bellow).
#
# After the build is finished the script will print out where the final
# artifact was generated.
#
# Invocation:
# VERSION=<version> RELEASE=<release> ./build-deb.sh
#
BUILD_DIR=$(mktemp -d)
PKGNAME="google-guest-agent"
if [ -z "${VERSION}" ]; then
echo "VERSION environment variable is not set"
exit 1
fi
if [ -z "${RELEASE}" ]; then
echo "RELEASE environment variable is not set"
exit 1
fi
TARBALL="${PKGNAME}_${VERSION}.orig.tar.gz"
echo "Creating tarball: ${TARBALL}"
tar czvf "${BUILD_DIR}/${TARBALL}" --exclude .git --exclude packaging \
--transform "s/^\./${PKGNAME}-${VERSION}/" .
tar -C "$BUILD_DIR" -xzvf "${BUILD_DIR}/${TARBALL}"
PKGDIR="${BUILD_DIR}/${PKGNAME}-${VERSION}"
cp -r packaging/debian "${BUILD_DIR}/${PKGNAME}-${VERSION}/"
cd "${BUILD_DIR}/${PKGNAME}-${VERSION}"
# We generate this to enable auto-versioning.
[[ -f debian/changelog ]] && rm debian/changelog
dch --create -M -v 1:${VERSION}-${RELEASE} --package $PKGNAME -D stable \
"Debian packaging for ${PKGNAME}"
DEB_BUILD_OPTIONS="noautodbgsym nocheck" debuild -e "VERSION=${VERSION}" -e "RELEASE=${RELEASE}" -us -uc
echo "Package built at: ${BUILD_DIR}"