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.

122 lines
2.8 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. # copy-in the ROM
  87. cp ${RELEASE_IMAGE} .
  88. RELEASE_IMAGE_FILE=$(basename "${RELEASE_IMAGE}")
  89. # copy-in device independent stuff
  90. cp ../SOURCE.md sources/
  91. tar -cJf skulls-x230-${version}.tar.xz \
  92. README.md \
  93. NEWS \
  94. util \
  95. LICENSE* \
  96. x230_update.sh \
  97. x230_before_first_install.sh \
  98. external_install_bottom.sh \
  99. external_install_top.sh \
  100. sources \
  101. ${RELEASE_IMAGE_FILE}
  102. rm ${RELEASE_IMAGE_FILE}
  103. rm sources/SOURCE.md
  104. git commit -a -m "update to ${version}"
  105. git tag -s ${version} -m "skulls-x230 ${version}"
  106. sha256sum skulls-x230-${version}.tar.xz > skulls-x230-${version}.tar.xz.sha256
  107. sha512sum skulls-x230-${version}.tar.xz > skulls-x230-${version}.tar.xz.sha512
  108. gpg -b -a skulls-x230-${version}.tar.xz