build-version.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # (c) 2014-2015 Freifunk Paderborn <maschinenraum@paderborn.freifunk.net>
  3. #
  4. # calls build.sh with information found in given version
  5. MY_DIR=$(dirname $0)
  6. MY_DIR=$(readlink -f "$MY_DIR")
  7. pushd $MY_DIR > /dev/null
  8. . functions.sh
  9. version=$1
  10. versionfile="${MY_DIR}/versions/${version}"
  11. [ -r $versionfile ] || abort "Failed to find the version '$version'."
  12. [ -n "${BROKEN}" ] || BROKEN=0
  13. base=`awk 'BEGIN { FS="=" } /^GLUON=([a-f0-9]+)(\s*#.+)?$/ { print $2; }' $versionfile | awk 'BEGIN { FS="#" } { print $1; }'`
  14. branch=`awk 'BEGIN { FS="=" } /^BRANCH=([a-z]+)$/ { print $2; }' $versionfile`
  15. version=`awk 'BEGIN { FS="=" } /^VERSION=([0-9\.\-+~a-z]+)$/ { print $2; }' $versionfile`
  16. site=`awk 'BEGIN { FS="=" } /^SITE=([a-f0-9]+)(\s*#.+)?$/ { print $2; }' $versionfile | awk 'BEGIN { FS="#" } { print $1; }'`
  17. targets=`awk 'BEGIN { FS="=" } /^TARGETS=.+$/ { print $2; }' $versionfile`
  18. ts=`awk 'BEGIN { FS="=" } /^TS=.+$/ { print $2; }' $versionfile`
  19. [ -z "$base" ] && abort "Failed to parse Gluon base commit-id from version file."
  20. [ -z "$branch" ] && abort "Failed to parse branch name from version file."
  21. [ -z "$version" ] && abort "Failed to parse version from version file."
  22. [ -z "$site" ] && abort "Failed to parse site repo commit-id from version file."
  23. [ -z "$ts" ] && abort "Failed to parse timestamp from version file."
  24. # remove all spaces from git-commit-ids
  25. base="${base// /}"
  26. site="${site// /}"
  27. info "Building $branch version '$version' again ..."
  28. echo " * Gluon base = $base"
  29. echo " * Site repo = $site"
  30. echo " * Timestamp = $ts"
  31. echo " * Targets = $targets"
  32. echo
  33. # invoke build script
  34. if [ "$NO_DOCKER" == "1" ]; then
  35. BASE="$base" BRANCH="$branch" SITE="$site" VERSION="$version" BUILD_TS="$ts" TARGETS="$targets" BROKEN="$BROKEN" ./build.sh
  36. else
  37. BASE="$base" BRANCH="$branch" SITE="$site" VERSION="$version" BUILD_TS="$ts" TARGETS="$targets" BROKEN="$BROKEN" ./docker-build.sh
  38. fi