joomla/joomla-setup.sh

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@535 1 #!/bin/sh
michael@535 2 ##
michael@535 3 ## joomla-setup.sh -- Joomla! RDBMS Setup Utility
michael@535 4 ##
michael@535 5
michael@535 6 # database configuration
michael@535 7 db_name="joomla"
michael@535 8 db_user="joomla"
michael@535 9 db_pass="joomla"
michael@535 10
michael@535 11 # determine RDBMS-specific details
michael@535 12 db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\
michael@535 13 sed -e 's;^user[^=]*= *;;' -e 's; *$;;'`
michael@535 14 db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
michael@535 15 sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
michael@535 16
michael@535 17 # dispatch operation
michael@535 18 cmd="${1:-"install"}"
michael@535 19 case "$cmd" in
michael@535 20 install )
michael@535 21 # create the database
michael@535 22 @l_prefix@/bin/mysqladmin --user="$db_suser" --password="$db_spass" create "$db_name"
michael@535 23 ( echo "GRANT ALL PRIVILEGES ON $db_name.* TO $db_user@localhost IDENTIFIED BY '$db_pass';"
michael@535 24 echo "FLUSH PRIVILEGES;"
michael@535 25 ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql
michael@535 26
michael@535 27 # activate installer
michael@535 28 rm -f @l_prefix@/lib/joomla/runtime/configuration.php
michael@535 29 rm -rf @l_prefix@/lib/joomla/runtime/installation >/dev/null 2>&1 || true
michael@535 30 cp -rp @l_prefix@/lib/joomla/installation @l_prefix@/lib/joomla/runtime/
michael@535 31 ;;
michael@535 32 cleanup )
michael@535 33 # deactivate installer
michael@535 34 rm -rf @l_prefix@/lib/joomla/runtime/installation >/dev/null 2>&1 || true
michael@535 35 ;;
michael@535 36 uninstall )
michael@535 37 # remove the database
michael@535 38 ( echo "DROP DATABASE $db_name;"
michael@535 39 ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" mysql
michael@535 40
michael@535 41 # remove the generated configuration
michael@535 42 rm -f @l_prefix@/lib/joomla/runtime/configuration.php
michael@535 43 ;;
michael@535 44 esac
michael@535 45

mercurial