1#!/bin/bash
2# This script is under public domain do with it whatever you want (yes, that includes eating it).
3if [ $# -lt 1 ]; then
4    echo "Usage: $(basename $0) [animal domain or directory]"
5    exit 1
6fi
7
8
9ANIMAL=${PWD}/${1}
10ANIMAL_TITLE=$1
11
12if [ -d $ANIMAL ]; then
13    echo "ERROR: $ANIMAL exists already!"
14    exit 1
15fi
16
17echo ">> adding animal $1"
18
19echo ">> creating directory structure ..."
20mkdir -p ${ANIMAL}/{data/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp},conf}
21find ${ANIMAL}/ -type d -exec chmod 777 {} \;
22touch ${ANIMAL}/conf/{local.php,local.protected.php,acl.auth.php,users.auth.php,plugins.local.php}
23chmod 666 ${ANIMAL}/conf/{local.php,acl.auth.php,users.auth.php,plugins.local.php}
24
25echo ">> creating basic configuration ..."
26echo "<?php
27\$conf['title'] = '${ANIMAL_TITLE}';
28\$conf['lang'] = 'en';
29\$conf['useacl'] = 1;
30\$conf['animal'] = '${ANIMAL_TITLE}';
31\$conf['animal_inc'] = '${ANIMAL}/';
32\$conf['superuser'] = '@admin';" > ${ANIMAL}/conf/local.php
33
34echo ">> setting fixed configuration ..."
35echo "<?php
36\$conf['savedir'] = DOKU_CONF.'../data';
37\$conf['updatecheck'] = 0;" > ${ANIMAL}/conf/local.protected.php
38
39echo ">> setting basic permissions ..."
40echo "# <?php exit()?>
41* @admin 255
42* @ALL 1" > ${ANIMAL}/conf/acl.auth.php
43
44echo ">> adding admin user ..."
45echo '# <?php exit()?>
46admin:$1$cce258b2$U9o5nK0z4MhTfB5QlKF23/:admin:admin@mail.org:admin,user' > ${ANIMAL}/conf/users.auth.php
47
48echo ">> IMPORTANT: Don't forget to change your admin username + password!"
49echo ">> finished!"
50echo ">> bye!"
51
52exit 0
53
54# vim:ts=4:sw=4:noet:enc=utf-8: