tA's crappy blog
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1023B

  1. #!/bin/bash
  2. set -e
  3. ./result/bin/site rebuild
  4. if ! [ -d gopherhole ]; then
  5. mkdir gopherhole
  6. fi
  7. cd gopherhole
  8. if ! [ -d .git ]; then
  9. git init
  10. echo "_gopherhole/" >> .gitignore
  11. echo ".gitignore" >> .gitignore
  12. git remote add origin "git@git.lain.church:/tA/gopherhole.git"
  13. fi
  14. if [ -d "_gopherhole" ]; then
  15. rm -rf "_gopherhole"
  16. fi
  17. cp -r "../posts/" "_gopherhole"
  18. if test -n "$(find ./ -maxdepth 1 -name '*.txt' -print -quit)"; then
  19. rm *.txt
  20. fi
  21. cd "_gopherhole"
  22. for f in ./*.md; do
  23. g=$(basename "$f" .md)
  24. t=$(sed '3q;d' "${f}" | cut -d ' ' -f 2)
  25. n="${t}-${g}.txt"
  26. title=$(sed '2q;d' "${f}" | cut -d ' ' -f2-)
  27. echo "# ${title}" > "../${n}"
  28. tail -n +5 "${f}" >> "../${n}"
  29. done
  30. for f in ../../*.md; do
  31. g=$(basename "$f" .md)
  32. [[ $g =~ ^(ChangeLog|README|index)$ ]] && continue
  33. n="0001-$g.txt"
  34. title=$(sed '2q;d' "${f}" | cut -d ' ' -f2-)
  35. echo "# ${title}" > "../${n}"
  36. tail -n +4 "${f}" >> "../${n}"
  37. done
  38. cd ../
  39. git add .
  40. git commit -m "$(date +%s)"
  41. git push -u origin master