summaryrefslogtreecommitdiff
path: root/localikiwikicreatesite
blob: 7589aea8bc41581951d7bc46ad2d2a4a81ff1fe8 (plain)
  1. #!/bin/sh
  2. # Origin: http://ikiwiki.info/setup/
  3. set -e
  4. host=$1
  5. [ -z "$host" ] && echo "ERROR: Hostname must be supplied!" && exit 1
  6. SRCDIR=~/private_webdata/$host/content
  7. CFGDIR=~/private_webdata/$host/backend
  8. DESTDIR=~/public_websites/$host
  9. DESTSRCDIR=~/public_websites/source.$host
  10. ## Init public RCS repositories
  11. mkdir -p $DESTSRCDIR
  12. GIT_DIR=$DESTSRCDIR/content.git git --bare init --shared
  13. GIT_DIR=$DESTSRCDIR/backend.git git --bare init --shared
  14. ## Create initial content
  15. mkdir -p $SRCDIR
  16. cat <<EOF >$SRCDIR/index.mdwn
  17. Welcome to your new wiki.
  18. All wikis are supposed to have a <a href="../sandbox/">SandBox</a>,
  19. so this one does too.
  20. ----
  21. This wiki is powered by [ikiwiki](http://ikiwiki.info).
  22. EOF
  23. #ikiwiki --verbose $SRCDIR $DESTDIR --url=http://"$host"
  24. ## Create initial backend
  25. mkdir -p $CFGDIR
  26. cp /usr/share/doc/ikiwiki/html/ikiwiki.setup $CFGDIR
  27. ## Init content RCS
  28. (
  29. cd $SRCDIR
  30. git init
  31. echo /.ikiwiki > .gitignore
  32. git add .
  33. git commit -m "initial commit"
  34. git remote add origin $DESTSRCDIR/content.git
  35. git config branch.master.merge refs/heads/master
  36. git push --all
  37. )
  38. ## Init backend RCS
  39. (
  40. cd $CFGDIR
  41. git init
  42. git add .
  43. git commit -m "initial commit"
  44. git remote add origin $DESTSRCDIR/backend.git
  45. git config branch.master.merge refs/heads/master
  46. git push --all
  47. )
  48. ## Adjust backend
  49. perl -pi -e '
  50. s,^(\s*)#?(srcdir\s*=>\s*\")(.*)(\"\,\s*),$1$2'$SRCDIR'$4,;
  51. s,^(\s*)#?(destdir\s*=>\s*\")(.*)(\"\,\s*),$1$2'$DESTDIR'$4,;
  52. s,^(\s*)#?(url\s*=>\s*\")(.*)(\"\,\s*),$1$2http://'$host'$4,;
  53. s,^(\s*)#?(cgiurl\s*=>\s*\")(.*)(\"\,\s*),$1#$2$3$4,;
  54. s,^(\s*)#?(rcs\s*=>\s*\")(git)(\"\,\s*),$1$2$3$4,;
  55. ' $CFGDIR/ikiwiki.setup
  56. (
  57. cd $CFGDIR
  58. git add ikiwiki.setup
  59. git commit -m "Setup local paths"
  60. git push
  61. )
  62. ikiwiki --verbose $SRCDIR $DESTDIR --url=http://"$host" --setup $CFGDIR/ikiwiki.setup