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.

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

mercurial