joomla/joomla-setup.sh

Wed, 08 Feb 2012 20:07:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:07:00 +0200
changeset 588
300d43423c2e
permissions
-rw-r--r--

Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.

     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