You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 lines
1.7 KiB

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