bump_revision.sh 877 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. #
  3. # This probably won't be useful to anyone outside ZeroTier itself.
  4. #
  5. #
  6. # This bumps the revision in version.h, which triggers a build and deploy
  7. # to the now/ subfolder on update.zerotier.com. This allows nodes tracking
  8. # the bleeding edge to track the bleedingest of the bleeding edge.
  9. #
  10. cur_rev=`grep -F ZEROTIER_ONE_VERSION_REVISION version.h | cut -d ' ' -f 3`
  11. next_rev=`expr $cur_rev + 1`
  12. echo Current revision: $cur_rev
  13. echo Next revision: $next_rev
  14. rm -f version.h.new
  15. cat version.h | sed "s/ZEROTIER_ONE_VERSION_REVISION $cur_rev/ZEROTIER_ONE_VERSION_REVISION $next_rev/g" >>version.h.new
  16. new_cur_rev=`grep -F ZEROTIER_ONE_VERSION_REVISION version.h.new | cut -d ' ' -f 3`
  17. if [ "$new_cur_rev" = "$next_rev" ]; then
  18. mv -f version.h.new version.h
  19. echo Done.
  20. else
  21. echo Error: version.h.new updated incorrectly, leaving in place.
  22. exit 1
  23. fi
  24. exit 0