#!/bin/sh
#
# $FreeBSD: ports/www/twiki/files/pkg-install.in,v 1.4 2007/01/23 08:13:09 miwi Exp $
#
TWIKIDIR=%%TWIKIDIR%%
HOSTNAME=`hostname`
REINPLACE_CMD="%%REINPLACE_CMD%%"
WWWUSER=%%WWWUSER%%
WWWGROUP=%%WWWGROUP%%
case $2 in
PRE-INSTALL)
;;
POST-INSTALL)
# hmmm, if we modify this here, the file fails md5sum when deinstalling
# but if we do this in Makefile, then we have a hardcoded PREFIX. What to
# do?
for i in `find ${TWIKIDIR}/data -type f`; do
$REINPLACE_CMD -e "s/nobody:/${WWWUSER}:/g" $i;
done
find ${TWIKIDIR}/data -type f -name \*.bak | xargs rm
chown -R ${WWWUSER}:${WWWGROUP} ${TWIKIDIR}
chmod 755 ${TWIKIDIR}/bin/*
chmod 664 `find ${TWIKIDIR}/data -type f`
chmod 775 `find ${TWIKIDIR}/data -type d`
chmod 775 `find ${TWIKIDIR}/pub -type d`
# let the user know what's going on
cat << __EOF__
*****************************************************************
TWiki has been installed in ${TWIKIDIR}, with a sample
configuration file in ${TWIKIDIR}/lib/TWiki.cfg.sample
You need to copy this file to ${TWIKIDIR}/lib/TWiki.cfg
and possibly edit it before your installation will be complete.
In most cases, you can simply type:
cp ${TWIKIDIR}/lib/TWiki.cfg.sample ${TWIKIDIR}/lib/TWiki.cfg
Then you should be able to visit http://${HOSTNAME}/twiki/
You need to setup your webserver correctly for TWiki to work
An example for apache is below:
ScriptAlias /twiki/bin/ "${PKG_PREFIX}/www/twiki/bin/"
Alias /twiki/ "${PKG_PREFIX}/www/twiki/"
Options +ExecCGI
SetHandler cgi-script
Allow from all
SetEnv USER "${WWWUSER}"
Options FollowSymLinks +Includes
AllowOverride None
Allow from all
Note that this default configuration defines a completely
open TWiki - any visitor may make changes. Please consult the
documentation for other configuration options if this is not the
desired mode of operation.
Please visit http://TWiki.org/feedback.html and leave feedback
on your experiences with TWiki.
Good Luck!
*****************************************************************
__EOF__
;;
*)
echo "Unexpected Argument $2!!!"
exit 1
;;
esac
exit 0