current-package-version 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #! /bin/bash
  2. #
  3. # bin/current-package-version
  4. # Part of ComixCursors, a desktop cursor theme.
  5. #
  6. # Copyright © 2010–2013 Ben Finney <ben+opendesktop@benfinney.id.au>
  7. #
  8. # This work is free software: you can redistribute it and/or modify it
  9. # under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This work is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this work. If not, see <http://www.gnu.org/licenses/>.
  20. # Parse the NEWS document and output the current version string.
  21. bindir="$(dirname $0)"
  22. newsfile="$(dirname ${bindir})"/NEWS
  23. current_release_header=$(
  24. "${bindir}"/news-to-specfile-changelog < "${newsfile}" | head -n 1)
  25. current_version=$(
  26. printf "${current_release_header}" | sed -e 's/^.\+ - \([^ ]\+\)$/\1/')
  27. printf ${current_version}