drupal-setup.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. ##
  3. ## drupal-setup
  4. ##
  5. # determine MySQL administrator username/password
  6. username=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\
  7. sed -e 's;^user[^=]*= *;;' -e 's; *$;;'`
  8. password=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
  9. sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
  10. # create the MySQL database for Drupal
  11. @l_prefix@/bin/mysqladmin --user=$username --password=$password create drupal
  12. @l_prefix@/bin/mysql --user=$username --password=$password mysql <<EOF
  13. GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES \
  14. ON drupal.* \
  15. TO drupal@localhost IDENTIFIED BY 'drupal';
  16. FLUSH PRIVILEGES;
  17. EOF
  18. # configure settings.php accordingly
  19. @l_prefix@/lib/openpkg/shtool subst --quiet \
  20. -e 's|^\( *\$db_url\) *=.*$|\1 = "mysql://drupal:drupal@localhost/drupal";|' \
  21. @l_prefix@/share/drupal/sites/default/settings.php
  22. # check php script memory limit
  23. d=`sed <@l_prefix@/etc/apache/apache-php.ini -e 's/ *;.*$//' | awk -F= '/^memory_limit/ { print $2 }' | sed -e 's/M//'`
  24. [ $d -lt 16 ] && echo "please consider increasing memory_limit to 16M or more in @l_prefix@/etc/apache/apache-php.ini"
  25. # further instructions for the user
  26. d=`awk <@l_prefix@/etc/drupal/drupal-apache.conf '/^Listen/ { print $2 }'`
  27. echo "configure IP address in \"@l_prefix@/etc/drupal/drupal-apache.conf\""
  28. echo "run \"@l_prefix@/bin/openpkg rc drupal start\""
  29. echo "visit http://$d/install.php"