forked from canonical/core-base-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-package.sh
executable file
·35 lines (33 loc) · 1.21 KB
/
build-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
#!/bin/bash
set -eu
case "$1" in
pull)
craftctl default
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get build-dep -y ./
;;
build)
# unset the LD_FLAGS and LD_LIBRARY_PATH vars that snapcraft sets for us
# as those will point to the $CRAFT_STAGE which on re-builds will
# contain things like libc and friends that confuse the debian package
# build system
# TODO: should we unset $PATH to not include $CRAFT_STAGE too?
unset LD_FLAGS
unset LD_LIBRARY_PATH
# run the real build (but just build the binary package, and don't
# bother compressing it too much)
dpkg-buildpackage -b -uc -us -Zgzip -zfast
mkdir -p "${CRAFT_PART_INSTALL}/local-debs"
source="$(dpkg-parsechangelog -SSource)"
version="$(dpkg-parsechangelog -SVersion)"
arch="$(dpkg --print-architecture)"
dcmd mv "../${source}_${version}_${arch}.changes" "${CRAFT_PART_INSTALL}/local-debs"
;;
stage)
craftctl default
cd "${CRAFT_STAGE}/local-debs"
dpkg-scanpackages . >Packages
apt-ftparchive release . >Release
;;
esac