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# set_basedir 9# Author: Myron Turner 10set_basedir() { 11BARN=`pwd | awk -F/ '{ print $NF }'` 12echo "'/"$BARN"/$1/'" 13} 14 15ANIMAL=${PWD}/${1} 16ANIMAL_TITLE=$1 17 18if [ -d $ANIMAL ]; then 19 echo "ERROR: $ANIMAL exists already!" 20 exit 1 21fi 22 23echo ">> adding animal $1" 24 25echo ">> creating directory structure ..." 26mkdir -p ${ANIMAL}/{data/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp},conf} 27find ${ANIMAL}/ -type d -exec chmod 777 {} \; 28touch ${ANIMAL}/conf/{local.php,local.protected.php,acl.auth.php,users.auth.php,plugins.local.php} 29chmod 666 ${ANIMAL}/conf/{local.php,acl.auth.php,users.auth.php,plugins.local.php} 30 31echo ">> creating basic configuration ..." 32echo "<?php 33\$conf['title'] = '${ANIMAL_TITLE}'; 34\$conf['lang'] = 'en'; 35\$conf['useacl'] = 1; 36\$conf['animal'] = '${ANIMAL_TITLE}'; 37\$conf['animal_inc'] = '${ANIMAL}/'; 38\$conf['superuser'] = '@admin';" > ${ANIMAL}/conf/local.php 39 40echo ">> setting fixed configuration ..." 41echo "<?php 42\$conf['savedir'] = DOKU_CONF.'../data'; 43\$conf['basedir'] = `set_basedir $1`; 44\$conf['updatecheck'] = 0;" > ${ANIMAL}/conf/local.protected.php 45 46echo ">> setting basic permissions ..." 47echo "# <?php exit()?> 48* @admin 255 49* @ALL 1" > ${ANIMAL}/conf/acl.auth.php 50 51echo ">> adding admin user ..." 52echo '# <?php exit()?> 53admin:$1$cce258b2$U9o5nK0z4MhTfB5QlKF23/:admin:admin@mail.org:admin,user' > ${ANIMAL}/conf/users.auth.php 54 55echo ">> IMPORTANT: Don't forget to change your admin username + password!" 56echo ">> finished!" 57echo ">> bye!" 58 59exit 0 60 61# vim:ts=4:sw=4:noet:enc=utf-8: