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.

115 lines
2.7 KiB

  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-3.0+
  3. # Copyright (C) 2018, Martin Kepplinger <martink@posteo.de>
  4. #
  5. # Script to build release-archives with. This requires a checkout from git.
  6. # WARNING: This script is very dangerous! It may delete any untracked files.
  7. set -e
  8. have_version=0
  9. have_image=0
  10. usage()
  11. {
  12. echo "Usage: $0 -v version -i release_image"
  13. }
  14. args=$(getopt -o v:i: -- "$@")
  15. if [ $? -ne 0 ] ; then
  16. usage
  17. exit 1
  18. fi
  19. eval set -- "$args"
  20. while [ $# -gt 0 ]
  21. do
  22. case "$1" in
  23. -i)
  24. RELEASE_IMAGE=$2
  25. have_image=1
  26. shift
  27. ;;
  28. -v)
  29. version=$2
  30. have_version=1
  31. shift
  32. ;;
  33. --)
  34. shift
  35. break
  36. ;;
  37. *)
  38. echo "Invalid option: $1"
  39. usage
  40. exit 1
  41. ;;
  42. esac
  43. shift
  44. done
  45. # Do we have a desired version number?
  46. if [ "$have_version" -gt 0 ] ; then
  47. echo "trying to build version $version"
  48. else
  49. echo "please specify a version"
  50. usage
  51. exit 1
  52. fi
  53. # Version number sanity check
  54. if grep ${version} NEWS
  55. then
  56. echo "configurations seems ok"
  57. else
  58. echo "please check the NEWS file"
  59. exit 1
  60. fi
  61. # Check that we are on master
  62. branch=$(git rev-parse --abbrev-ref HEAD)
  63. echo "we are on branch $branch"
  64. if [ ! "${branch}" = "master" ] ; then
  65. echo "you don't seem to be on the master branch"
  66. exit 1
  67. fi
  68. if git diff-index --quiet HEAD --; then
  69. # no changes
  70. echo "there are no uncommitted changes (version bump)"
  71. exit 1
  72. fi
  73. echo "======================================================"
  74. echo " are you fine with the following version bump?"
  75. echo "======================================================"
  76. git diff
  77. echo "======================================================"
  78. read -p " Press enter to continue"
  79. echo "======================================================"
  80. filesize=$(wc -c <"${RELEASE_IMAGE}")
  81. reference_filesize=4194304
  82. if [ ! $filesize -eq "$reference_filesize" ] ; then
  83. echo "filesize of release image is wrong"
  84. exit 1
  85. fi
  86. cp ${RELEASE_IMAGE} .
  87. RELEASE_IMAGE_FILE=$(basename "${RELEASE_IMAGE}")
  88. tar -cJf coreboot-x230-${version}.tar.xz \
  89. README.md \
  90. NEWS \
  91. util \
  92. LICENSE* \
  93. prepare_internal_flashing.sh \
  94. flashrom_rpi_bottom_unlock.sh \
  95. flashrom_rpi_top_write.sh \
  96. ${RELEASE_IMAGE_FILE}
  97. git commit -a -m "update to ${version}"
  98. git tag -s ${version} -m "coreboot-x230 ${version}"
  99. sha256sum coreboot-x230-${version}.tar.xz > coreboot-x230-${version}.tar.xz.sha256
  100. sha512sum coreboot-x230-${version}.tar.xz > coreboot-x230-${version}.tar.xz.sha512
  101. gpg -b -a coreboot-x230-${version}.tar.xz
  102. rm ${RELEASE_IMAGE_FILE}