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.

45 lines
1.0KB

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