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.

build_ostinato 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. set -e -x
  3. DEB_VERSION=$1
  4. GIT_COMMIT=$2
  5. cd
  6. apt-get update
  7. apt-get install -y --no-install-recommends git ca-certificates xz-utils
  8. # get sources and debian build files
  9. git clone https://github.com/pstavirs/ostinato.git
  10. cd ostinato
  11. [ -n "$GIT_COMMIT" ] && git checkout "$GIT_COMMIT"
  12. tar xf /build/ostinato_*.debian.tar.xz
  13. # empty DEB_VERSION: set it to APP_VERSION
  14. if [ -z "$DEB_VERSION" ]; then
  15. DEB_VERSION="$(sed -n 's/^APP_VERSION *= *\(.*\)/\1/p' version.pri)"
  16. fi
  17. # update changelog
  18. cat - debian/changelog > debian/changelog.new << EOF
  19. ostinato (${DEB_VERSION}) unstable; urgency=low
  20. * Revision $(git rev-parse --short=12 --verify HEAD)
  21. -- Bernhard Ehlers <be@bernhard-ehlers.de> $(TZ=CET date -R)
  22. EOF
  23. mv debian/changelog.new debian/changelog
  24. # install build dependencies
  25. # https://stackoverflow.com/questions/47632014/how-to-install-a-debian-packages-build-depends-and-depends
  26. apt-get install -y --no-install-recommends build-essential $(awk '
  27. /^(Build-)?Depends:/ || /^ / && deps {
  28. sub(/^[^ ]+: /, "")
  29. deps = 1
  30. dep_str = dep_str ", " $0
  31. next
  32. }
  33. { deps=0 }
  34. END {
  35. split(dep_str, dep_array, /, */)
  36. for (d in dep_array) {
  37. dep = dep_array[d]
  38. gsub(/[^a-z0-9_.-].*$/, "", dep)
  39. if (dep && !seen[dep]++) print dep
  40. }
  41. }' debian/control)
  42. # build package
  43. dpkg-buildpackage -us -uc -b
  44. if [ -d /build ]; then
  45. install -m 644 -o "$(stat -c %u /build)" -g "$(stat -c %g /build)" -p ../ostinato_*.deb /build/
  46. fi