git2targz.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. # Create source tarball from unsf git repo, with generated version
  3. # number. We don't include the git history in the tarball.
  4. # Note that this script doesn't need to be run as root. It does
  5. # need to be able to write to the current directory it's run from.
  6. PRGNAM=unsf
  7. CLONE_URL=https://github.com/psi29a/$PRGNAM.git
  8. # Last released version. Normally we'd use a git tag for this, but
  9. # upstream mentions a version 1.1 in their README... and there's no
  10. # 1.1 release tag!
  11. RELVER=1.1
  12. set -e
  13. GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX )
  14. rm -rf $GITDIR
  15. git clone $CLONE_URL $GITDIR
  16. CWD="$( pwd )"
  17. cd $GITDIR
  18. # Extract date from last entry in git log. git has so many useful
  19. # options that it's a PITA to find the one you need...
  20. DATE=$( git log --date=format:%Y%m%d --pretty=format:%cd -n1 )
  21. VERSION=${RELVER}+git$DATE
  22. rm -rf .git
  23. find . -name .gitignore -print0 | xargs -0 rm -f
  24. cd "$CWD"
  25. rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz
  26. mv $GITDIR $PRGNAM-$VERSION
  27. tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION
  28. cat <<EOF
  29. Archive created: $PRGNAM-$VERSION.tar.xz
  30. Update $PRGNAM.info with:
  31. VERSION="$VERSION"
  32. DOWNLOAD="https://slackware.uk/~urchlay/src/$PRGNAM-$VERSION.tar.xz"
  33. MD5SUM="$( md5sum $PRGNAM-$VERSION.tar.xz | cut -d' ' -f1 )"
  34. Don't forget to upload the new source!
  35. EOF