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.
 
 
 
 
 

60 lines
1.6 KiB

  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. prev_version=$(sed -n '1s/^[^(]*(\([^)]*\).*/\1/p' debian/changelog)
  19. if [ "$DEB_VERSION" != "$prev_version" ]; then
  20. cat - debian/changelog > debian/changelog.new <<- EOF
  21. ostinato (${DEB_VERSION}) unstable; urgency=low
  22. * Revision $(git rev-parse --short=12 --verify HEAD)
  23. -- Bernhard Ehlers <none@b-ehlers.de> $(TZ=CET date -R)
  24. EOF
  25. mv debian/changelog.new debian/changelog
  26. fi
  27. # install build dependencies
  28. # https://stackoverflow.com/questions/47632014/how-to-install-a-debian-packages-build-depends-and-depends
  29. apt-get install -y --no-install-recommends build-essential $(awk '
  30. /^(Build-)?Depends:/ || /^ / && deps {
  31. sub(/^[^ ]+: /, "")
  32. deps = 1
  33. dep_str = dep_str ", " $0
  34. next
  35. }
  36. { deps=0 }
  37. END {
  38. split(dep_str, dep_array, /, */)
  39. for (d in dep_array) {
  40. dep = dep_array[d]
  41. gsub(/[^a-z0-9_.-].*$/, "", dep)
  42. if (dep && !seen[dep]++) print dep
  43. }
  44. }' debian/control)
  45. # build package
  46. dpkg-buildpackage -us -uc -b
  47. if [ -d /build ]; then
  48. install -m 644 -o "$(stat -c %u /build)" -g "$(stat -c %g /build)" -p ../ostinato_*.deb /build/
  49. fi