aboutsummaryrefslogtreecommitdiff
path: root/www/twiki/pkg-install
blob: cca9829fa5aa49af3a2ef0c53f3dbab7dcbae119 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh

LTWIKIDIR=www/twiki

TWIKIDIR=${PKG_PREFIX}/${LTWIKIDIR}

HOSTNAME=`hostname`

WWWUSER=www
WWWGROUP=www

case $2 in
    PRE-INSTALL)
        ;;
    POST-INSTALL)

	# create the empty dirs if necessary (the port creates them
        # but pkg_add does not)
        if [ ! -d "${TWIKIDIR}/pub/Main" ]; then
                mkdir ${TWIKIDIR}/pub/Main
        fi
        if [ ! -d "${TWIKIDIR}/pub/Sandbox" ]; then
                mkdir ${TWIKIDIR}/pub/Sandbox
        fi
        if [ ! -d "${TWIKIDIR}/pub/Trash" ]; then
                mkdir ${TWIKIDIR}/pub/Trash
        fi

	# 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?
        perl -pi -e "s#/home/httpd/twiki#${TWIKIDIR}#g" ${TWIKIDIR}/lib/TWiki.cfg.sample
        perl -pi -e "s#your.domain.com#`hostname`#"     ${TWIKIDIR}/lib/TWiki.cfg.sample
        perl -pi -e "s#/bin/egrep#/usr/bin/egrep#"      ${TWIKIDIR}/lib/TWiki.cfg.sample
        perl -pi -e "s#/bin/fgrep#/usr/bin/fgrep#"      ${TWIKIDIR}/lib/TWiki.cfg.sample

	perl -pi -e "s/nobody:/${WWWUSER}:/g"           ${TWIKIDIR}/data/*/*,v

        chown ${WWWUSER}:${WWWGROUP} `find ${TWIKIDIR}/data -type f`
        chown ${WWWUSER}:${WWWGROUP} `find ${TWIKIDIR}/data -type d`
        chown ${WWWUSER}:${WWWGROUP} `find ${TWIKIDIR}/pub -type f`
        chown ${WWWUSER}:${WWWGROUP} `find ${TWIKIDIR}/pub -type d`

        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/"
<Directory "${PKG_PREFIX}/www/twiki/bin">
  Options +ExecCGI
  SetHandler cgi-script
  Allow from all
  SetEnv USER "${WWWUSER}"
</Directory>
<Directory "${PKG_PREFIX}/www/twiki/pub">
  Options FollowSymLinks +Includes
  AllowOverride None
  Allow from all
</Directory>

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