#!/bin/bash # # Deploy an ikiwiki instance. # # Parameters NAME="$1" OWNER="$2" GROUP="$3" SITE=$BASE/$NAME INSTANCE="ikiwiki" CONF="/etc/ikiwiki" BASE="<%= scope.lookupvar('ikiwiki::sites_folder') %>" REPO_OWNER="<%= scope.lookupvar('ikiwiki::git_implementation') %>" REMOTE="$REPO_OWNER@localhost:$NAME" REPO="/var/git/repositories/$NAME.git" # Syntax check if [ -z "$INSTANCE" ]; then echo "Usage:`basename $0` " exit 1 elif [ ! -e "$CONF/$NAME.setup" ]; then echo "No config file for $NAME" exit 1 fi # Setup source folder mkdir -p $SITE/"$INSTANCE"_src_tmp/ rm -rf $SITE/"$INSTANCE"_src # Create initial page echo "Welcome to your new wiki powered by [ikiwiki](http://ikiwiki.info)." > $SITE/"$INSTANCE"_src_tmp/index.mdwn # Create ikiwiki repository ikiwiki-makerepo git $SITE/"$INSTANCE"_src_tmp $REPO # Clone it again git clone $REPO $SITE/"$INSTANCE"_src # Fix remotes ( cd $SITE/"$INSTANCE"_src && git remote rm origin && git remote add origin $REMOTE ) # Cleanup rm -rf $SITE/"$INSTANCE"_src_tmp