build-version.sh 1.6 KB

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