#!/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/backend 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 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 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 git commit -m "Setup local paths" git push ) ikiwiki --verbose $SRCDIR $DESTDIR --url=http://"$host" --setup $CFGDIR/ikiwiki.setup