#!/bin/bash
dir="wiki"   # name of the wiki's directory that will be created
ver="2.2.91"   # pmwiki version - see http://www.pmwiki.org/wiki/PmWiki/Download
url="http://localhost/"   # url for the directory where this script is
if [ -e $dir ] ; then
  echo "$dir exists"; exit
fi
if [ ! -f pmwiki-$ver.tgz ] ; then
  wget http://www.pmwiki.org/pub/pmwiki/pmwiki-$ver.tgz
fi
tar -zxvf pmwiki-$ver.tgz
mv pmwiki-$ver $dir
cd $dir/local/
wget http://www.pmwiki.org/pmwiki/uploads/Cookbook/InstaWiki-latest.tar.gz
tar -zxvf InstaWiki-latest.tar.gz -C ../
chmod 2777 ../   # ../ is the wiki's main/ directory
wget -O- $url$dir/ >/dev/null   # retrieve the page
chmod 0775 ../
chmod g-s ../