example_create.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # - Makes index for repositories in a single directory.
  3. # - Makes static pages for each repository directory.
  4. #
  5. # NOTE, things to do manually (once) before running this script:
  6. # - copy style.css, logo.png and favicon.png manually, a style.css example
  7. # is included.
  8. #
  9. # - write clone URL, for example "git://git.codemadness.org/dir" to the "url"
  10. # file for each repo.
  11. # - write owner of repo to the "owner" file.
  12. # - write description in "description" file.
  13. #
  14. # Usage:
  15. # - mkdir -p htmldir && cd htmldir
  16. # - sh example_create.sh
  17. # path must be absolute.
  18. reposdir="/var/www/domains/git.codemadness.nl/home/src"
  19. curdir="$(pwd)"
  20. # make index.
  21. stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
  22. # make files per repo.
  23. for dir in "${reposdir}/"*/; do
  24. # strip .git suffix.
  25. r=$(basename "${dir}")
  26. d=$(basename "${dir}" ".git")
  27. printf "%s... " "${d}"
  28. mkdir -p "${curdir}/${d}"
  29. cd "${curdir}/${d}" || continue
  30. stagit -c ".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}"
  31. # symlinks
  32. ln -sf log.html index.html
  33. ln -sf ../style.css style.css
  34. ln -sf ../logo.png logo.png
  35. ln -sf ../favicon.png favicon.png
  36. echo "done"
  37. done