Guest User

Untitled

a guest
Jan 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/bin/sh -e
  2.  
  3. #
  4. # This script creates/updates OpenWRT git mirror. Maintains two repositories:
  5. # - git-svn managed one
  6. # - "clean" with selected branches and tags
  7. #
  8.  
  9. REPO_LOCATION=${REPO_LOCATION:-$HOME/openwrt}
  10. CLEAN_REPO_LOCATION=${CLEAN_REPO_LOCATION:-$HOME/openwrt.clean}
  11.  
  12. [ -d $REPO_LOCATION ] || (
  13. mkdir -p $REPO_LOCATION
  14. cd $REPO_LOCATION
  15. git init --bare
  16. git svn init -s svn://svn.openwrt.org/openwrt/
  17. git svn fetch
  18. )
  19.  
  20. [ -d $CLEAN_REPO_LOCATION ] || (
  21. mkdir -p $CLEAN_REPO_LOCATION
  22. cd $CLEAN_REPO_LOCATION
  23. git init --bare
  24. )
  25.  
  26. cd $REPO_LOCATION
  27.  
  28. git svn fetch
  29.  
  30. #
  31. # Add more branches if needed
  32. #
  33. REFS="${REFS} remotes/trunk:refs/heads/trunk"
  34. REFS="${REFS} remotes/backfire:refs/heads/backfire"
  35.  
  36. for ref in $(git for-each-ref --format '%(refname)' refs/remotes/tags/); do
  37. case "$ref" in
  38. #
  39. # Add more excludes if needed
  40. #
  41. *BUILDROOT*|*HEAD*|*TESTED*|*kamikaze_pre1*)
  42. # Old tags removed from Subversion
  43. ;;
  44. *@*)
  45. # Conversion artifacts
  46. ;;
  47. *)
  48. REFS="${REFS} $ref:refs/tags/${ref#refs/remotes/tags/}"
  49. ;;
  50. esac
  51. done
  52.  
  53. git push -q $CLEAN_REPO_LOCATION $REFS
Add Comment
Please, Sign In to add comment