GNS3 Docker Images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

59 lines
1.6 KiB

#!/bin/sh
set -e -x
DEB_VERSION=$1
GIT_COMMIT=$2
cd
apt-get update
apt-get install -y --no-install-recommends git ca-certificates xz-utils
# get sources and debian build files
git clone https://github.com/pstavirs/ostinato.git
cd ostinato
[ -n "$GIT_COMMIT" ] && git checkout "$GIT_COMMIT"
tar xf /build/ostinato_*.debian.tar.xz
# empty DEB_VERSION: set it to APP_VERSION
if [ -z "$DEB_VERSION" ]; then
DEB_VERSION="$(sed -n 's/^APP_VERSION *= *\(.*\)/\1/p' version.pri)"
fi
# update changelog
prev_version=$(sed -n '1s/^[^(]*(\([^)]*\).*/\1/p' debian/changelog)
if [ "$DEB_VERSION" != "$prev_version" ]; then
cat - debian/changelog > debian/changelog.new <<- EOF
ostinato (${DEB_VERSION}) unstable; urgency=low
* Revision $(git rev-parse --short=12 --verify HEAD)
-- Bernhard Ehlers <none@b-ehlers.de> $(TZ=CET date -R)
EOF
mv debian/changelog.new debian/changelog
fi
# install build dependencies
# https://stackoverflow.com/questions/47632014/how-to-install-a-debian-packages-build-depends-and-depends
apt-get install -y --no-install-recommends build-essential $(awk '
/^(Build-)?Depends:/ || /^ / && deps {
sub(/^[^ ]+: /, "")
deps = 1
dep_str = dep_str ", " $0
next
}
{ deps=0 }
END {
split(dep_str, dep_array, /, */)
for (d in dep_array) {
dep = dep_array[d]
gsub(/[^a-z0-9_.-].*$/, "", dep)
if (dep && !seen[dep]++) print dep
}
}' debian/control)
# build package
dpkg-buildpackage -us -uc -b
if [ -d /build ]; then
install -m 644 -o "$(stat -c %u /build)" -g "$(stat -c %g /build)" -p ../ostinato_*.deb /build/
fi