| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/sh
- ##
- ## drupal-setup.sh -- Drupal RDBMS Setup Utility
- ##
- # database configuration
- db_name="drupal"
- db_user="drupal"
- db_pass="drupal"
- # determine RDBMS-specific details
- db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\
- sed -e 's;^user[^=]*= *;;' -e 's; *$;;'`
- db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
- sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
- # dispatch operation
- cmd="${1:-"install"}"
- case "$cmd" in
- install )
- # create the database
- @l_prefix@/bin/mysqladmin --user="$db_suser" --password="$db_spass" create "$db_name"
- ( echo "GRANT ALL PRIVILEGES ON $db_name.* TO $db_user@localhost IDENTIFIED BY '$db_pass';"
- echo "FLUSH PRIVILEGES;"
- ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql
- # activate configuration directory
- # (is automatically deactivated by installer afterwards)
- chmod 777 @l_prefix@/share/drupal/sites/default
- ;;
- uninstall )
- # remove the database
- ( echo "DROP DATABASE $db_name;"
- ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql
- # remove the generated configuration
- rm -f @l_prefix@/share/drupal/sites/default/settings.php
- rm -f @l_prefix@/var/drupal/files/*
- ;;
- esac
|