Le 5727 Septembre 1993, Daniel Dehennin a envoyé: > I enjoyed the Include of the dbconfig part in 1.06, it permited to use a > template of ocsinventory.conf to easyly deploy OCS on many servers.
Here is a patch to put the dbcommon configuration in a separate file. The postinst script should not run dbcommon configuration on new install but if the file is not present. Regards. -- Daniel Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
diff -Nru ocsinventory-server-1.02~rc2.orig/debian/conf/ocsinventory.conf ocsinventory-server-1.02~rc2/debian/conf/ocsinventory.conf --- ocsinventory-server-1.02~rc2.orig/debian/conf/ocsinventory.conf 2009-05-18 15:15:36.000000000 +0200 +++ ocsinventory-server-1.02~rc2/debian/conf/ocsinventory.conf 2009-05-18 15:14:42.000000000 +0200 @@ -21,31 +21,7 @@ PerlSetEnv OCS_MODPERL_VERSION 1 </IfDefine> - # Master Database settings - # Replace DATABASE_SERVER by hostname or ip of MySQL server for WRITE - PerlSetEnv OCS_DB_HOST _DBC_DBSERVER_ - # Replace DATABASE_PORT by port where running MySQL server, generally 3306 - PerlSetEnv OCS_DB_PORT _DBC_DBPORT_ - # Name of database - PerlSetEnv OCS_DB_NAME _DBC_DBNAME_ - PerlSetEnv OCS_DB_LOCAL _DBC_DBNAME_ - # User allowed to connect to database - PerlSetEnv OCS_DB_USER _DBC_DBUSER_ - # Password for user - PerlSetVar OCS_DB_PWD _DBC_DBPASS_ - - # Slave Database settings - # Replace DATABASE_SERVER by hostname or ip of MySQL server for READ - # Useful if you handle mysql slave databases - # PerlSetEnv OCS_DB_SL_HOST DATABASE_SERVER - # Replace DATABASE_PORT by port where running MySQL server, generally 3306 - # PerlSetEnv OCS_DB_SL_PORT_SLAVE DATABASE_PORT - # User allowed to connect to database - # PerlSetEnv OCS_DB_SL_USER ocs - # Name of the database - # PerlSetEnv OCS_DB_SL_NAME ocsweb - # Password for user - # PerlSetVar OCS_DB_SL_PWD ocs + Include /etc/ocsinventory/ocsinventory-dbcommon.conf # Path to log directory (must be writeable) PerlSetEnv OCS_OPT_LOGPATH "/var/log/ocsinventory-server" diff -Nru ocsinventory-server-1.02~rc2.orig/debian/conf/ocsinventory-dbcommon.conf ocsinventory-server-1.02~rc2/debian/conf/ocsinventory-dbcommon.conf --- ocsinventory-server-1.02~rc2.orig/debian/conf/ocsinventory-dbcommon.conf 1970-01-01 01:00:00.000000000 +0100 +++ ocsinventory-server-1.02~rc2/debian/conf/ocsinventory-dbcommon.conf 2009-05-18 15:14:42.000000000 +0200 @@ -0,0 +1,25 @@ +# Master Database settings +# Replace DATABASE_SERVER by hostname or ip of MySQL server for WRITE +PerlSetEnv OCS_DB_HOST _DBC_DBSERVER_ +# Replace DATABASE_PORT by port where running MySQL server, generally 3306 +PerlSetEnv OCS_DB_PORT _DBC_DBPORT_ +# Name of database +PerlSetEnv OCS_DB_NAME _DBC_DBNAME_ +PerlSetEnv OCS_DB_LOCAL _DBC_DBNAME_ +# User allowed to connect to database +PerlSetEnv OCS_DB_USER _DBC_DBUSER_ +# Password for user +PerlSetVar OCS_DB_PWD _DBC_DBPASS_ + +# Slave Database settings +# Replace DATABASE_SERVER by hostname or ip of MySQL server for READ +# Useful if you handle mysql slave databases +# PerlSetEnv OCS_DB_SL_HOST DATABASE_SERVER +# Replace DATABASE_PORT by port where running MySQL server, generally 3306 +# PerlSetEnv OCS_DB_SL_PORT_SLAVE DATABASE_PORT +# User allowed to connect to database +# PerlSetEnv OCS_DB_SL_USER ocs +# Name of the database +# PerlSetEnv OCS_DB_SL_NAME ocsweb +# Password for user +# PerlSetVar OCS_DB_SL_PWD ocs diff -Nru ocsinventory-server-1.02~rc2.orig/debian/ocsinventory-server.install ocsinventory-server-1.02~rc2/debian/ocsinventory-server.install --- ocsinventory-server-1.02~rc2.orig/debian/ocsinventory-server.install 2009-05-18 15:15:36.000000000 +0200 +++ ocsinventory-server-1.02~rc2/debian/ocsinventory-server.install 2009-05-18 15:14:42.000000000 +0200 @@ -1 +1,2 @@ -debian/conf/ocsinventory.conf usr/share/ocsinventory-server/files +debian/conf/ocsinventory-dbcommon.conf usr/share/ocsinventory-server/files +debian/conf/ocsinventory.conf etc/ocsinventory/ diff -Nru ocsinventory-server-1.02~rc2.orig/debian/ocsinventory-server.postinst ocsinventory-server-1.02~rc2/debian/ocsinventory-server.postinst --- ocsinventory-server-1.02~rc2.orig/debian/ocsinventory-server.postinst 2009-05-18 15:15:36.000000000 +0200 +++ ocsinventory-server-1.02~rc2/debian/ocsinventory-server.postinst 2009-05-18 15:31:18.000000000 +0200 @@ -10,12 +10,12 @@ if [ "$1" = "configure" ]; then - # only on a new install - if [ "$2" = "" ]; then pkgpath="/usr/share/ocsinventory-server" confpath="/etc/ocsinventory" conffile="ocsinventory.conf" + dbconffile="ocsinventory-dbcommon.conf" + if [ ! -f $confpath/$dbconfifile ]; then # Allow mod_perl to write there for dirname in /var/log/ocsinventory-server; do chown www-data:www-data $dirname @@ -24,8 +24,8 @@ # use dbconfig to setup vars in apache config file . /usr/share/dbconfig-common/dpkg/postinst.mysql - dbc_generate_include=template:$confpath/$conffile - dbc_generate_include_args="-U -o template_infile='$pkgpath/files/$conffile'" + dbc_generate_include=template:$confpath/$dbconffile + dbc_generate_include_args="-U -o template_infile='$pkgpath/files/$dbconffile'" dbc_generate_include_owner="root:www-data" dbc_generate_include_perms="0640" @@ -39,7 +39,7 @@ -e 's/^\(\s*\)PerlSetEnv OCS_DB_LOCAL\s\+$/\1PerlSetEnv OCS_DB_LOCAL ocsweb/' \ -e 's/^\(\s*\)PerlSetEnv OCS_DB_USER\s\+$/\1PerlSetEnv OCS_DB_USER ocs/' \ -e 's/^\(\s*\)PerlSetVar OCS_DB_PWD\s\+$/\1PerlSetVar OCS_DB_PWD ocs/' \ - $confpath/$conffile + $confpath/$dbconffile fi db_stop @@ -48,7 +48,7 @@ if [ -z "$dbc_dbhost" ]; then sed -i -e 's/^\(\s*\)PerlSetEnv OCS_DB_HOST\s\+$/\1PerlSetEnv OCS_DB_HOST localhost/' \ -e 's/^\(\s*\)PerlSetEnv OCS_DB_PORT\s\+$/\1PerlSetEnv OCS_DB_PORT 3306/' \ - $confpath/$conffile + $confpath/$dbconffile fi # link apache config files in apache's conf.d dir diff -Nru ocsinventory-server-1.02~rc2.orig/debian/ocsinventory-server.postrm ocsinventory-server-1.02~rc2/debian/ocsinventory-server.postrm --- ocsinventory-server-1.02~rc2.orig/debian/ocsinventory-server.postrm 2009-05-18 15:15:36.000000000 +0200 +++ ocsinventory-server-1.02~rc2/debian/ocsinventory-server.postrm 2009-05-18 15:14:42.000000000 +0200 @@ -8,6 +8,7 @@ varpath="/var/lib/ocsinventory-server" confpath="/etc/ocsinventory" conffile="ocsinventory.conf" +dbconffile="ocsinventory-dbcommon.conf" . /usr/share/debconf/confmodule db_version 2.0 || [ $? -lt 30 ] @@ -19,7 +20,7 @@ if [ "$1" = "purge" ]; then - for FILE in $confpath/$conffile; do + for FILE in $confpath/$dbconffile; do # Taken from the ucf example postrm for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist .ucf-old; do rm -f $FILE$ext @@ -38,8 +39,8 @@ webservers="apache2" for webserver in $webservers; do webserver=${webserver%,} - if [ -d /etc/$webserver/conf.d ] && [ -L /etc/$webserver/conf.d/$conffile ]; then - rm -f /etc/$webserver/conf.d/$conffile + if [ -d /etc/$webserver/conf.d ] && [ -L /etc/$webserver/conf.d/$dbconffile ]; then + rm -f /etc/$webserver/conf.d/$dbconffile fi if [ -x /usr/sbin/invoke-rc.d ]; then invoke-rc.d $webserver reload || true
pgp6n2epOvCTA.pgp
Description: PGP signature