#!/bin/bash
GROUP="apache"
#
# Create user files
#
if test -f forum/data/users.xml
then
echo "forum/data/users.xml already exists."
else
echo "Creating forum/data/users.xml"
echo "" > forum/data/users.xml
echo "" >> forum/data/users.xml
echo " " >> forum/data/users.xml
echo "" >> forum/data/users.xml
chgrp $GROUP forum/data/users.xml
chmod g+wr forum/data/users.xml
fi
if test -f data/users.xml
then
echo "data/users.xml already exists."
else
echo "Creating data/users.xml"
echo "" > data/users.xml
echo "" >> data/users.xml
echo " " >> data/users.xml
echo "" >> data/users.xml
chgrp $GROUP data/users.xml
chmod g+wr data/users.xml
fi
#
# Create config files
#
if test -f htdocs/config.php
then
echo "htdocs/config.php already exists"
else
echo "Creating htdocs/config.php"
cp htdocs/config.php.defaults htdocs/config.php
fi
if test -f forum/htdocs/config.php
then
echo "forum/htdocs/config.php already exists"
else
echo "Creating forum/htdocs/config.php"
cp forum/htdocs/config.php.defaults forum/htdocs/config.php
fi
#
# Create symlink to forum
#
if test -L htdocs/forum
then
echo "htdocs/forum symlink already exists"
else
echo "Creating htdocs/forum symlink"
(cd htdocs; ln ../forum/htdocs forum -s)
fi
#
# Create a forum
#
if test -d forum/data/forum
then
echo "forum/data/forum already exists"
else
mkdir forum/data/forum
echo "" > forum/data/forum/forums.xml
echo "" >> forum/data/forum/forums.xml
echo " " >> forum/data/forum/forums.xml
echo "" >> forum/data/forum/forums.xml
mkdir forum/data/forum/1
chgrp $GROUP forum/data/forum/1
chmod g+w forum/data/forum/1
fi
#
# Create imagecache
#
if test -d forum/data/imagecache
then
echo "forum/data/imagecache already exists"
else
mkdir forum/data/imagecache
chgrp $GROUP forum/data/imagecache
chmod g+w forum/data/imagecache
fi
#
# Create files
#
if test -d forum/data/files
then
echo "forum/data/files already exists"
else
mkdir forum/data/files
chgrp $GROUP forum/data/files
chmod g+w forum/data/files
fi