summaryrefslogtreecommitdiff
path: root/localikiblogcreate
blob: 987c634110a2e38e6043827f6b877e27287206a1 (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. # allow overriding above
  15. [ ! -r /etc/local/ikiblog.conf ] || . /etc/local/ikiblog.conf
  16. gitdir="$BLOGGITDIR"
  17. workdir="$BLOGWORKDIR"
  18. webdir="$BLOGWORKDIR"
  19. baseurl="$BLOGPROTO://$BLOGHOST/~$USER"
  20. # clone/create public repositories
  21. mkdir -p "$gitdir"
  22. git clone --bare git://source.jones.dk/ikiwiki/site "$gitdir.git"
  23. git init --bare "$gitdir/content.git"
  24. # clone/create private working repositories
  25. mkdir -p "$(dirname "$workdir")"
  26. git clone --recursive "$gitdir.git" "$workdir"
  27. git clone "$gitdir/content.git" "$workdir/content"
  28. # populate content
  29. cd "$workdir/content"
  30. rsync -av /usr/share/ikiwiki/examples/blog/ .
  31. git add .
  32. git commit -m "Initial commit, from sample blog."
  33. git push
  34. # redirect compiled blog to public folder
  35. mkdir -p "$workdir/build"
  36. ln -s "$webdir" "$workdir/build/html"
  37. ln -s "$webdir" "$workdir/build/cgi"
  38. # Customize settings and bootstrap
  39. echo "# IkiWiki::Setup::Yaml" > "$workdir/config/ikiwiki.setup.in"
  40. echo "url: $baseurl" >> "$workdir/config/ikiwiki.setup.in"
  41. echo "cgiurl: $baseurl/ikiwiki.cgi" >> "$workdir/config/ikiwiki.setup.in"
  42. echo "theme: goab" >> "$workdir/config/ikiwiki.setup.in"
  43. make -C "$workdir" init
  44. # initialize blog
  45. make -C "$workdir"