-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-launchpad.sh
executable file
·43 lines (34 loc) · 1.53 KB
/
build-launchpad.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
#!/bin/bash
# Make sure to install Go 1.21 before running this script
# or update the path to the Go binary accordingly.
# Define the GPG key ID
GPG_KEY_ID="EF536354988BF362947FC6FDBEB7932396E8FB23"
# Define the project root directory
project_root=`realpath $(pwd)`
export VERSION=$(grep Version constant/constants.go | awk -F '=' '{print $2}'| awk -F'"' '{print $2}')
# Run env subtitute
envsubst < dns-scout.metainfo.xml.tpl > dns-scout.metainfo.xml
envsubst < debian/files.tpl > debian/files
envsubst < debian/changelog.tpl > debian/changelog
# Remove existing upstream tarball if it exists
[ -f "../dns-scout_${VERSION}.orig.tar.gz" ] && rm "../dns-scout_${VERSION}.orig.tar.gz"
# Remove debian/patches/
[ -d debian/patches/ ] && rm -rf debian/patches/
# Remove GO vendor modules
[ -d vendor/ ] && rm -rf vendor/
# Create the upstream tarball and place it in the parent directory
echo "Creating upstream tarball..."
tar czvf "../dns-scout_${VERSION}.orig.tar.gz" --exclude='.git' --exclude='.gitattributes' --exclude='.github/*' --exclude='.gitignore' \
--exclude='*.tpl' \
--exclude='./bin/*' \
--exclude='./dns-scout-linux-*' \
--exclude='./generate_sitemap/*' \
-C "${project_root}" .
# Download required GO modules
go mod vendor
# Generate a patch file to include vendor module source for LaunchPad build server
# Set editor to bypass having to write description
EDITOR=/bin/true dpkg-source --commit ./ added-vendor-modules
# Build source package
dpkg-buildpackage -S -sa -k${GPG_KEY_ID}
echo "Source build complete."