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.

44 lines
1.0KB

  1. #!/run/current-system/sw/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 "_working/" >> .gitignore
  11. echo ".gitignore" >> .gitignore
  12. git remote add origin "git@git.lain.church:/tA/gopherhole.git"
  13. fi
  14. if [ -d "_working" ]; then
  15. rm -rf "_working"
  16. fi
  17. cp -r "../_input/posts/" "_working"
  18. if test -n "$(find ./ -maxdepth 1 -name '*.txt' -print -quit)"; then
  19. rm *.txt
  20. fi
  21. cd "_working"
  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 ../../_input/*.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. rm -rf _working
  40. git add .
  41. git commit -m "$(date +%s)"
  42. git push -u origin master