[Pkg-nagios-changes] [SCM] Debian packaging of icinga-web branch, master, updated. debian/1.7.0-1_netways-21-ga693a88

Markus Frosch markus at lazyfrosch.de
Thu Jun 14 17:34:57 UTC 2012


The following commit has been merged in the master branch:
commit a693a881dc360aa89fdbe5fdc9f89234bfa8076c
Author: Markus Frosch <markus at lazyfrosch.de>
Date:   Thu Jun 14 19:34:48 2012 +0200

    added PostgreSQL support for autoconfiguration

diff --git a/debian/README.Debian b/debian/README.Debian
index 27b7895..9e81611 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -3,6 +3,8 @@ icinga-web for Debian
 
 Notes:
 
+  * Supported databases are: MySQL and PostgreSQL (by auto configuration)
+
   * Icinga Web uses two database connections
 
     1) IDO database, which is configured with by a dependency
diff --git a/debian/changelog b/debian/changelog
index 512e4a1..9b29e98 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 icinga-web (1.7.0-2) unstable; urgency=low
 
   * first release for official Debian (Closes: #618807)
+  * added support for PostgreSQL in auto configuration
   * new descriptions for the control file
   * added config system for root password (of Icinga Web)
   * added config select for webserver configuration
diff --git a/debian/control b/debian/control
index d982c86..1249acc 100644
--- a/debian/control
+++ b/debian/control
@@ -10,8 +10,8 @@ Vcs-Browser: http://git.debian.org/?p=pkg-nagios/pkg-icinga-web.git;a=summary
 
 Package: icinga-web
 Architecture: all
-Depends: icinga-core (>= 1.7.0), icinga-idoutils (>= 1.7.0), ucf, dbconfig-common, php5-cli, php5, php5-gd, php5-xsl, php5-mysql, ${misc:Depends}
-Recommends: mysql-client, apache2 | httpd
+Depends: icinga-core (>= 1.7.0), icinga-idoutils (>= 1.7.0), ucf, dbconfig-common, php5-cli, php5, php5-gd, php5-xsl, php5-mysql | php5-pgsql, ${misc:Depends}
+Recommends: mysql-client | postgresql-client, apache2 | httpd
 Description: host and network monitoring system - modern web interface
  Icinga is a modular monitoring framework for hosts, services, and
  networks, based on the Nagios project. It is designed to be easy to
diff --git a/debian/icinga-web.config b/debian/icinga-web.config
index 4995b4a..eb0714e 100644
--- a/debian/icinga-web.config
+++ b/debian/icinga-web.config
@@ -5,11 +5,12 @@ set -e
 
 . /usr/share/debconf/confmodule
 
-if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
+if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
+        dbc_dbtypes="mysql, pgsql"
         dbc_dbuser="icinga_web"
         dbc_dbname="icinga_web"
         dbc_authmethod_user="password"
-        . /usr/share/dbconfig-common/dpkg/config.mysql
+        . /usr/share/dbconfig-common/dpkg/config
         dbc_go icinga-web $@
 fi
 
diff --git a/debian/icinga-web.dirs b/debian/icinga-web.dirs
index 56ec619..87d6f92 100644
--- a/debian/icinga-web.dirs
+++ b/debian/icinga-web.dirs
@@ -1,5 +1,6 @@
 usr/share/dbconfig-common/data/icinga-web/install
 usr/share/dbconfig-common/data/icinga-web/upgrade/mysql
+usr/share/dbconfig-common/data/icinga-web/upgrade/pgsql
 
 etc/icinga-web/conf.d
 
diff --git a/debian/icinga-web.postinst b/debian/icinga-web.postinst
index 287ec3c..508c461 100644
--- a/debian/icinga-web.postinst
+++ b/debian/icinga-web.postinst
@@ -6,7 +6,7 @@ set -e
 # Install DB
 ###
 . /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/postinst.mysql
+. /usr/share/dbconfig-common/dpkg/postinst
 dbc_go icinga-web $@
 
 ###
@@ -130,8 +130,15 @@ setpassword() {
         echo "UPDATE nsm_user SET user_password='""$pwhash_e""', user_salt = '""$salt_e""' WHERE user_name = 'root';" \
            | mysql -h "${dbc_dbhost:=localhost}" -u "$dbc_dbuser" "$dbc_dbname"
         echo "root password updated in database!"
+    elif [ "$dbc_dbtype" = "pgsql" ]; then
+        # query the database to update
+        salt_e=${salt/\'/\\\'}
+        pwhash_e=${pwhash/\'/\\\'}
+        
+        su -c "echo \"UPDATE nsm_user SET user_password='""$pwhash_e""', user_salt = '""$salt_e""' WHERE user_name = 'root';\" | psql '$dbc_dbname'" postgres >/dev/null
+        echo "root password updated in database!"
     else
-        echo "db type '$dbc_dbtype' not implemented!" >&2
+        echo "db type '$dbc_dbtype' not implemented for setting root password!" >&2
     fi
 }
 
diff --git a/debian/icinga-web.postrm b/debian/icinga-web.postrm
index 1ab89b9..56433e4 100644
--- a/debian/icinga-web.postrm
+++ b/debian/icinga-web.postrm
@@ -8,8 +8,8 @@ set -e
 if [ -f /usr/share/debconf/confmodule ]; then
     . /usr/share/debconf/confmodule
 fi
-if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
-    . /usr/share/dbconfig-common/dpkg/postrm.mysql
+if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+    . /usr/share/dbconfig-common/dpkg/postrm
     dbc_go icinga-web $@
 fi
 
diff --git a/debian/icinga-web.prerm b/debian/icinga-web.prerm
index d620eba..fe6cb23 100644
--- a/debian/icinga-web.prerm
+++ b/debian/icinga-web.prerm
@@ -3,7 +3,7 @@
 set -e 
 
 . /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/prerm.mysql
+. /usr/share/dbconfig-common/dpkg/prerm
 dbc_go icinga-web $@
 
 ###
diff --git a/etc/schema/pgsql.sql b/debian/pgsql-install.sql
similarity index 94%
copy from etc/schema/pgsql.sql
copy to debian/pgsql-install.sql
index 64066df..6de7d51 100644
--- a/etc/schema/pgsql.sql
+++ b/debian/pgsql-install.sql
@@ -47,7 +47,7 @@ ALTER TABLE nsm_user_role ADD CONSTRAINT nsm_user_role_usro_role_id_nsm_role_rol
 
 /*          Initial data import              */
  
-INSERT INTO nsm_user (user_id,user_account,user_name,user_firstname,user_lastname,user_password,user_salt,user_authsrc,user_email,user_disabled) VALUES ('1','0','root','Enoch','Root','42bc5093863dce8c150387a5bb7e3061cf3ea67d2cf1779671e1b0f435e953a1','0c099ae4627b144f3a7eaa763ba43b10fd5d1caa8738a98f11bb973bebc52ccd','internal','root at localhost.local','0');
+INSERT INTO nsm_user (user_id,user_account,user_name,user_firstname,user_lastname,user_password,user_salt,user_authsrc,user_email,user_disabled, user_created, user_modified) VALUES ('1','0','root','Enoch','Root','42bc5093863dce8c150387a5bb7e3061cf3ea67d2cf1779671e1b0f435e953a1','0c099ae4627b144f3a7eaa763ba43b10fd5d1caa8738a98f11bb973bebc52ccd','internal','root at localhost.local','0',NOW(),NOW());
 INSERT INTO nsm_db_version VALUES ('1','icinga-web/v1.7.0', NOW(), NOW());
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('1','IcingaHostgroup','Limit data access to specific hostgroups','IcingaDataHostgroupPrincipalTarget','icinga');
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('2','IcingaServicegroup','Limit data access to specific servicegroups','IcingaDataServicegroupPrincipalTarget','icinga');
@@ -69,10 +69,10 @@ INSERT INTO nsm_target (target_id,target_name,target_description,target_class,ta
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('18','icinga.control.admin','Allow user to administrate the icinga process','','credential');
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('19','IcingaCommandRestrictions','Disable critical commands for this user','IcingaDataCommandRestrictionPrincipalTarget','icinga');
 INSERT INTO nsm_target (target_id,target_name,target_description,target_class,target_type) VALUES ('20','icinga.cronk.custom','Allow user to create and modify custom cronks','','credential');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled) VALUES ('1','icinga_user','The default representation of a ICINGA user','0');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled) VALUES ('2','appkit_user','Appkit user test','0');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_parent) VALUES ('3','appkit_admin','AppKit admin','0','2');
-INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled) VALUES ('4','guest','Unauthorized Guest','0');
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_created,role_modified) VALUES ('1','icinga_user','The default representation of a ICINGA user','0',NOW(),NOW());
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_created,role_modified) VALUES ('2','appkit_user','Appkit user test','0',NOW(),NOW());
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_parent,role_created,role_modified) VALUES ('3','appkit_admin','AppKit admin','0','2',NOW(),NOW());
+INSERT INTO nsm_role (role_id,role_name,role_description,role_disabled,role_created,role_modified) VALUES ('4','guest','Unauthorized Guest','0',NOW(),NOW());
 INSERT INTO nsm_principal (principal_id,principal_user_id,principal_type,principal_disabled) VALUES ('1','1','user','0');
 INSERT INTO nsm_principal (principal_id,principal_role_id,principal_type,principal_disabled) VALUES ('2','2','role','0');
 INSERT INTO nsm_principal (principal_id,principal_role_id,principal_type,principal_disabled) VALUES ('3','3','role','0');
diff --git a/debian/rules b/debian/rules
index 891255e..f862ec6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -50,6 +50,8 @@ override_dh_install:
 	# MySQL schema for dbconfig-common
 	cp ${b}/icinga-web/usr/share/icinga-web/database/mysql.sql ${b}/icinga-web/usr/share/dbconfig-common/data/icinga-web/install/mysql
 	cp etc/schema/updates/mysql_v1-6-2_to_v1-7.sql ${b}/icinga-web/usr/share/dbconfig-common/data/icinga-web/upgrade/mysql/1.7.0-1
+	# PGSQL schema for dbconfig-common
+	cp ${b}/pgsql-install.sql ${b}/icinga-web/usr/share/dbconfig-common/data/icinga-web/install/pgsql
 	###
 	# PNP
 	###

-- 
Debian packaging of icinga-web



More information about the Pkg-nagios-changes mailing list