Package: ocsinventory-server
Version: 1.02-1
Severity: wishlist

Hello,

Here is a patch to put the dbconfig-common configuration in a separate
file.

The advantage is to be able to deploy template for ocsinventory.conf
(with personnalized configuration values) and don't worry about the
dbconfig stuffs.

Regards.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (90, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-rc6+hati.1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== added file 'debian/conf/ocsinventory-dbconfig.conf'
--- debian/conf/ocsinventory-dbconfig.conf      1970-01-01 00:00:00 +0000
+++ debian/conf/ocsinventory-dbconfig.conf      2009-05-19 07:21:35 +0000
@@ -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

=== modified file 'debian/conf/ocsinventory.conf'
--- debian/conf/ocsinventory.conf       2009-05-19 05:39:42 +0000
+++ debian/conf/ocsinventory.conf       2009-05-19 07:21:35 +0000
@@ -21,32 +21,8 @@
     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-dbconfig.conf
+
   # Path to log directory (must be writeable)
   PerlSetEnv OCS_OPT_LOGPATH "/var/log/ocsinventory-server"
   

=== modified file 'debian/ocsinventory-server.install'
--- debian/ocsinventory-server.install  2009-05-19 05:39:42 +0000
+++ debian/ocsinventory-server.install  2009-05-19 07:21:35 +0000
@@ -1,1 +1,2 @@
-debian/conf/ocsinventory.conf             usr/share/ocsinventory-server/files
+debian/conf/ocsinventory-dbconfig.conf    usr/share/ocsinventory-server/files
+debian/conf/ocsinventory.conf             etc/ocsinventory

=== modified file 'debian/ocsinventory-server.postinst'
--- debian/ocsinventory-server.postinst 2009-05-19 05:39:42 +0000
+++ debian/ocsinventory-server.postinst 2009-05-19 07:21:35 +0000
@@ -15,6 +15,7 @@
     pkgpath="/usr/share/ocsinventory-server"
     confpath="/etc/ocsinventory"
     conffile="ocsinventory.conf"
+    dbconffile="ocsinventory-dbconfig.conf"
 
     # Allow mod_perl to write there
     for dirname in /var/log/ocsinventory-server; do
@@ -24,8 +25,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 +40,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 +49,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

=== modified file 'debian/ocsinventory-server.postrm'
--- debian/ocsinventory-server.postrm   2009-05-19 05:39:42 +0000
+++ debian/ocsinventory-server.postrm   2009-05-19 07:21:35 +0000
@@ -8,6 +8,7 @@
 varpath="/var/lib/ocsinventory-server"
 confpath="/etc/ocsinventory"
 conffile="ocsinventory.conf"
+dbconffile="ocsinventory-dbconfig.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

Reply via email to