#!/bin/sh
# MoinWikiMigrator 0.2 
# (c) 2007 by Thilo Pfennig <tpfennig AT foresightlinux.org>
# This is a simple shell wrapper
# Public Domain 

# The migrator needs the variable WIKI_CONFIG set!
# In a bash environment you would add this to ~/.bashrc
# WIKI_CONFIG="/path/to/wikiconfig"
# export WIKI_CONFIG
#
# If you have added that be sure to reload .bashrc with ". .bashrc" !

if [ -z $WIKI_CONFIG ]
 then
   echo "WIKI_CONFIG is not set"
   exit 1
fi

WIKI_NAME=$1
NAME="MoinWikiMigrator"
VERSION="0.2"

if echo "$WIKI_NAME" | grep -q "/$"
 then
    echo "$NAME $VERSION - Updating: $WIKI_NAME"
    echo "moin --config-dir=$WIKI_CONFIG --wiki-url=$WIKI_NAME migration data"
          moin --config-dir=$WIKI_CONFIG --wiki-url=$WIKI_NAME migration data
 else
    echo "$NAME"
    echo " wiki name: "$WIKI_NAME"  must end with Slash (/) "
    exit 1
fi


exit 0

