summaryrefslogtreecommitdiff
path: root/localikiblogcreate
blob: ae619487d926df0af17b4e720381caec4a49be42 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/bin/localwebresolve
  4. # Copyright 2013 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # Bootstrap Ikiwiki-based blog site
  7. #
  8. set -e
  9. BLOGGITDIR="$HOME/private_git/blog"
  10. BLOGWORKDIR="$HOME/private_webdata/blog"
  11. BLOGWORKDIR="$HOME/public_html"
  12. BLOGPROTO="http"
  13. BLOGHOST="user.homebase.dk"
  14. # The above can be overridden
  15. LOCALCONFIG="/etc/local/ikiblog.conf"
  16. . "$LOCALCONFIG" || true
  17. gitdir="$BLOGGITDIR"
  18. workdir="$BLOGWORKDIR"
  19. webdir="$BLOGWORKDIR"
  20. baseurl="$BLOGPROTO://$BLOGHOST/~$USER"
  21. # clone/create public repositories
  22. mkdir -p "$gitdir"
  23. git clone --bare git://source.jones.dk/ikiwiki/site "$gitdir.git"
  24. git init --bare "$gitdir/content.git"
  25. # clone/create private working repositories
  26. mkdir -p "$(dirname "$workdir")"
  27. git clone --recursive "$gitdir.git" "$workdir"
  28. git clone "$gitdir/content.git" "$workdir/content"
  29. # populate content
  30. cd "$workdir/content"
  31. rsync -av /usr/share/ikiwiki/examples/blog/ .
  32. git add .
  33. git commit -m "Initial commit, from sample blog."
  34. git push
  35. # redirect compiled blog to public folder
  36. mkdir -p "$workdir/build"
  37. ln -s "$webdir" "$workdir/build/html"
  38. ln -s "$webdir" "$workdir/build/cgi"
  39. # Customize settings and bootstrap
  40. echo "# IkiWiki::Setup::Yaml" > "$workdir/config/ikiwiki.setup.in"
  41. echo "url: $baseurl" >> "$workdir/config/ikiwiki.setup.in"
  42. echo "cgiurl: $baseurl/ikiwiki.cgi" >> "$workdir/config/ikiwiki.setup.in"
  43. echo "theme: goab" >> "$workdir/config/ikiwiki.setup.in"
  44. make -C "$workdir" init
  45. # initialize blog
  46. make -C "$workdir"