michael@535: #!/bin/sh michael@535: ## michael@535: ## joomla-setup.sh -- Joomla! RDBMS Setup Utility michael@535: ## michael@535: michael@535: # database configuration michael@535: db_name="joomla" michael@535: db_user="joomla" michael@535: db_pass="joomla" michael@535: michael@535: # determine RDBMS-specific details michael@535: db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\ michael@535: sed -e 's;^user[^=]*= *;;' -e 's; *$;;'` michael@535: db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\ michael@535: sed -e 's;^password[^=]*= *;;' -e 's; *$;;'` michael@535: michael@535: # dispatch operation michael@535: cmd="${1:-"install"}" michael@535: case "$cmd" in michael@535: install ) michael@535: # create the database michael@535: @l_prefix@/bin/mysqladmin --user="$db_suser" --password="$db_spass" create "$db_name" michael@535: ( echo "GRANT ALL PRIVILEGES ON $db_name.* TO $db_user@localhost IDENTIFIED BY '$db_pass';" michael@535: echo "FLUSH PRIVILEGES;" michael@535: ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql michael@535: michael@535: # activate installer michael@535: rm -f @l_prefix@/lib/joomla/runtime/configuration.php michael@535: rm -rf @l_prefix@/lib/joomla/runtime/installation >/dev/null 2>&1 || true michael@535: cp -rp @l_prefix@/lib/joomla/installation @l_prefix@/lib/joomla/runtime/ michael@535: ;; michael@535: cleanup ) michael@535: # deactivate installer michael@535: rm -rf @l_prefix@/lib/joomla/runtime/installation >/dev/null 2>&1 || true michael@535: ;; michael@535: uninstall ) michael@535: # remove the database michael@535: ( echo "DROP DATABASE $db_name;" michael@535: ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql michael@535: michael@535: # remove the generated configuration michael@535: rm -f @l_prefix@/lib/joomla/runtime/configuration.php michael@535: ;; michael@535: esac michael@535: