1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/joomla/joomla-setup.sh Tue Aug 28 18:29:40 2012 +0200 1.3 @@ -0,0 +1,45 @@ 1.4 +#!/bin/sh 1.5 +## 1.6 +## joomla-setup.sh -- Joomla! RDBMS Setup Utility 1.7 +## 1.8 + 1.9 +# database configuration 1.10 +db_name="joomla" 1.11 +db_user="joomla" 1.12 +db_pass="joomla" 1.13 + 1.14 +# determine RDBMS-specific details 1.15 +db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\ 1.16 + sed -e 's;^user[^=]*= *;;' -e 's; *$;;'` 1.17 +db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\ 1.18 + sed -e 's;^password[^=]*= *;;' -e 's; *$;;'` 1.19 + 1.20 +# dispatch operation 1.21 +cmd="${1:-"install"}" 1.22 +case "$cmd" in 1.23 + install ) 1.24 + # create the database 1.25 + @l_prefix@/bin/mysqladmin --user="$db_suser" --password="$db_spass" create "$db_name" 1.26 + ( echo "GRANT ALL PRIVILEGES ON $db_name.* TO $db_user@localhost IDENTIFIED BY '$db_pass';" 1.27 + echo "FLUSH PRIVILEGES;" 1.28 + ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql 1.29 + 1.30 + # activate installer 1.31 + rm -f @l_prefix@/lib/joomla/runtime/configuration.php 1.32 + rm -rf @l_prefix@/lib/joomla/runtime/installation >/dev/null 2>&1 || true 1.33 + cp -rp @l_prefix@/lib/joomla/installation @l_prefix@/lib/joomla/runtime/ 1.34 + ;; 1.35 + cleanup ) 1.36 + # deactivate installer 1.37 + rm -rf @l_prefix@/lib/joomla/runtime/installation >/dev/null 2>&1 || true 1.38 + ;; 1.39 + uninstall ) 1.40 + # remove the database 1.41 + ( echo "DROP DATABASE $db_name;" 1.42 + ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql 1.43 + 1.44 + # remove the generated configuration 1.45 + rm -f @l_prefix@/lib/joomla/runtime/configuration.php 1.46 + ;; 1.47 +esac 1.48 +