#!/bin/sh # Origin: http://ikiwiki.info/setup/ set -e host=$1 [ -z "$host" ] && echo "ERROR: Hostname must be supplied!" && exit 1 srchost=${2:-source.$host} SRCDIR=~/private_webdata/$host/content CFGDIR=~/private_webdata/$host DESTDIR=~/public_websites/$host DESTSRCDIR=~/public_websites/$srchost ## Init public RCS repositories mkdir -p $DESTSRCDIR GIT_DIR=$DESTSRCDIR/content.git git --bare init --shared GIT_DIR=$DESTSRCDIR/backend.git git --bare init --shared ## Create initial content mkdir -p $SRCDIR cat <$SRCDIR/index.mdwn Welcome to your new wiki. All wikis are supposed to have a SandBox, so this one does too. ---- This wiki is powered by [ikiwiki](http://ikiwiki.info). EOF #ikiwiki --verbose $SRCDIR $DESTDIR --url=http://"$host" ## Create initial backend mkdir -p $CFGDIR cp /usr/share/doc/ikiwiki/html/ikiwiki.setup $CFGDIR ## Init content RCS ( cd $SRCDIR git init echo /.ikiwiki > .gitignore git add . git commit -m "initial commit" git remote add origin $DESTSRCDIR/content.git git config branch.master.merge refs/heads/master git push --all ) ## Init backend RCS ( cd $CFGDIR git init echo /content > .gitignore git add . git commit -m "initial commit" git remote add origin $DESTSRCDIR/backend.git git config branch.master.merge refs/heads/master git push --all ) ## Adjust backend and add Makefile for further customization perl -pi -e ' s,^(\s*)#?(srcdir\s*=>\s*\")(.*)(\"\,\s*),$1$2'$SRCDIR'$4,; s,^(\s*)#?(destdir\s*=>\s*\")(.*)(\"\,\s*),$1$2'$DESTDIR'$4,; s,^(\s*)#?(url\s*=>\s*\")(.*)(\"\,\s*),$1$2http://'$host'$4,; s,^(\s*)#?(cgiurl\s*=>\s*\")(.*)(\"\,\s*),$1#$2$3$4,; s,^(\s*)#?(rcs\s*=>\s*\")(git)(\"\,\s*),$1$2$3$4,; ' $CFGDIR/ikiwiki.setup ( cd $CFGDIR git add ikiwiki.setup cat <$CFGDIR/Makefile #underlays = basewiki smiley templates underlays = templates #locale = danish master = master #master = master-LOCALE all: $(underlays) $(underlays): mkdir $@ cd $@ && git init cd $@ && git remote add -f -t $(master:LOCALE=$(locale)) -m $(master:LOCALE=$(locale)) origin http://source.jones.dk/ikiwiki_$@.git cd $@ && git merge origin EOF echo /Makefile > .gitignore git add Makefile git commit -m "Setup local paths" git push ) ikiwiki --verbose $SRCDIR $DESTDIR --url=http://"$host" --setup $CFGDIR/ikiwiki.setup