wok rev 1806

Asterisk: update mysql config
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Dec 03 14:10:46 2008 +0000 (2008-12-03)
parents 1143af92f66a
children db7e79a69e27
files asterisk/receipt asterisk/stuff/etc/asterisk/cdr_mysql.conf asterisk/stuff/etc/asterisk/res_mysql.conf
line diff
     1.1 --- a/asterisk/receipt	Tue Dec 02 14:48:36 2008 +0000
     1.2 +++ b/asterisk/receipt	Wed Dec 03 14:10:46 2008 +0000
     1.3 @@ -34,6 +34,37 @@
     1.4  	for i in $fs/etc/asterisk/*.sample; do
     1.5  		mv $i ${i%.sample}
     1.6  	done
     1.7 +	cp -a stuff/* $fs
     1.8 +}
     1.9 +
    1.10 +# Rules to configure package
    1.11 +setup_rules()
    1.12 +{
    1.13 +	case "$2" in
    1.14 +	mysql_host)
    1.15 +		sed -i "s|^hostname=.*|hostname=$3|" $1/etc/asterisk/cdr_mysql.conf
    1.16 +		sed -i "s|^dbhost=.*|dbhost=$3|" $1/etc/asterisk/res_mysqlconf
    1.17 +		;;
    1.18 +	mysql_user)
    1.19 +		sed -i "s|^user=.*|user=$3|" $1/etc/asterisk/cdr_mysql.conf
    1.20 +		sed -i "s|^dbuser=.*|dbuser=$3|" $1/etc/asterisk/res_mysqlconf
    1.21 +		;;
    1.22 +	mysql_password)
    1.23 +		sed -i "s|^password=.*|password=$3|" $1/etc/asterisk/cdr_mysql.conf
    1.24 +		sed -i "s|^dbpass=.*|dbpass=$3|" $1/etc/asterisk/res_mysqlconf
    1.25 +		;;
    1.26 +	mysql_database)
    1.27 +		sed -i "s|^dbname=.*|dbname=$3|" $1/etc/asterisk/res_mysqlconf \
    1.28 +						 $1/etc/asterisk/cdr_mysql.conf
    1.29 +		;;
    1.30 +	*)	cat <<EOT
    1.31 +mysql_host	hostname or ip of mysql server
    1.32 +mysql_user	username to connect to mysql server
    1.33 +mysql_password	password to connect to mysql server
    1.34 +mysql_database	database used by asterisk
    1.35 +EOT
    1.36 +		;;
    1.37 +	esac
    1.38  }
    1.39  
    1.40  # Pre and post install commands for Tazpkg.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/asterisk/stuff/etc/asterisk/cdr_mysql.conf	Wed Dec 03 14:10:46 2008 +0000
     2.3 @@ -0,0 +1,21 @@
     2.4 +;
     2.5 +; Note - if the database server is hosted on the same machine as the
     2.6 +; asterisk server, you can achieve a local Unix socket connection by
     2.7 +; setting hostname=localhost
     2.8 +;
     2.9 +; port and sock are both optional parameters.  If hostname is specified
    2.10 +; and is not "localhost", then cdr_mysql will attempt to connect to the
    2.11 +; port specified or use the default port.  If hostname is not specified
    2.12 +; or if hostname is "localhost", then cdr_mysql will attempt to connect
    2.13 +; to the socket file specified by sock or otherwise use the default socket
    2.14 +; file.
    2.15 +;
    2.16 +[global]
    2.17 +hostname=127.0.0.1
    2.18 +dbname=asterisk
    2.19 +table=cdr
    2.20 +password= 
    2.21 +user=root
    2.22 +port=3306
    2.23 +sock=/var/run/mysqld/mysqld.sock
    2.24 +;userfield=1
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/asterisk/stuff/etc/asterisk/res_mysql.conf	Wed Dec 03 14:10:46 2008 +0000
     3.3 @@ -0,0 +1,15 @@
     3.4 +;
     3.5 +; Sample configuration for res_config_mysql.c
     3.6 +;
     3.7 +; The value of dbhost may be either a hostname or an IP address.
     3.8 +; If dbhost is commented out or the string "localhost", a connection
     3.9 +; to the local host is assumed and dbsock is used instead of TCP/IP
    3.10 +; to connect to the server.
    3.11 +;
    3.12 +[general]
    3.13 +dbhost=127.0.0.1
    3.14 +dbname=asterisk
    3.15 +dbuser=root
    3.16 +dbpass= 
    3.17 +dbport=3306
    3.18 +dbsock=/var/run/mysqld/mysql.sock