[Pkg-nagios-changes] [pkg-icinga2] 02/03: Add support for dbconfig-common and enabling ido* via debconf
Alexander Wirt
formorer at debian.org
Mon Jun 16 06:48:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
formorer pushed a commit to branch master
in repository pkg-icinga2.
commit d4bc56173ce4db483dd03211f94006c7a806b77e
Author: Alexander Wirt <formorer at debian.org>
Date: Sun Jun 15 23:18:27 2014 +0200
Add support for dbconfig-common and enabling ido* via debconf
---
debian/control | 3 ++-
debian/icinga2-ido-mysql.config | 18 ++++++++++++++++
debian/icinga2-ido-mysql.install | 2 +-
debian/icinga2-ido-mysql.postinst | 43 ++++++++++++++++++++++++++++++++++++++
debian/icinga2-ido-mysql.postrm | 21 +++++++++++++++++++
debian/icinga2-ido-mysql.prerm | 10 +++++++++
debian/icinga2-ido-mysql.templates | 9 ++++++++
debian/icinga2-ido-pgsql.config | 19 +++++++++++++++++
debian/icinga2-ido-pgsql.install | 2 ++
debian/icinga2-ido-pgsql.postinst | 43 ++++++++++++++++++++++++++++++++++++++
debian/icinga2-ido-pgsql.postrm | 21 +++++++++++++++++++
debian/icinga2-ido-pgsql.prerm | 10 +++++++++
debian/icinga2-ido-pgsql.templates | 9 ++++++++
debian/ido-mysql.conf-sample | 14 +++++++++++++
debian/ido-pgsql.conf-sample | 13 ++++++++++++
debian/rules | 9 ++++++++
16 files changed, 244 insertions(+), 2 deletions(-)
diff --git a/debian/control b/debian/control
index 4d49ab0..203353f 100644
--- a/debian/control
+++ b/debian/control
@@ -155,7 +155,8 @@ Description: host and network monitoring system - classic ui integration
Package: icinga2-ido-mysql
Architecture: any
Pre-Depends: ${misc:Pre-Depends}
-Depends: icinga2-common (= ${source:Version}),
+Depends: dbconfig-common,
+ icinga2-common (= ${source:Version}),
icinga2-bin (= ${binary:Version}),
${shlibs:Depends}, ${misc:Depends}
Recommends: mysql-client
diff --git a/debian/icinga2-ido-mysql.config b/debian/icinga2-ido-mysql.config
new file mode 100644
index 0000000..a7cb658
--- /dev/null
+++ b/debian/icinga2-ido-mysql.config
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+. /usr/share/debconf/confmodule
+
+if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then
+ . /usr/share/dbconfig-common/dpkg/config.mysql
+ dbc_go icinga2-ido-mysql $@
+fi
+
+# check if the feature is enabled
+if test -L /etc/icinga2/features-enabled/ido-mysql.conf; then
+ db_set icinga2-ido-mysql/enable "true"
+else
+ db_set icinga2-ido-mysql/enable "false"
+fi
+db_input high icinga2-ido-mysql/enable || true
+db_go || true
diff --git a/debian/icinga2-ido-mysql.install b/debian/icinga2-ido-mysql.install
index ffb74db..1a42d3f 100644
--- a/debian/icinga2-ido-mysql.install
+++ b/debian/icinga2-ido-mysql.install
@@ -1,3 +1,3 @@
-debian/tmp/etc/icinga2/features-available/ido-mysql.conf
usr/lib/*/icinga2/libdb_ido_mysql*
components/db_ido_mysql/schema/*.sql usr/share/icinga2-ido-mysql/schema
+debian/ido-mysql.conf-sample usr/share/icinga2/tmpl
diff --git a/debian/icinga2-ido-mysql.postinst b/debian/icinga2-ido-mysql.postinst
new file mode 100644
index 0000000..753dece
--- /dev/null
+++ b/debian/icinga2-ido-mysql.postinst
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst
+
+#dbc_debug='1'
+dbc_generate_include='template:/etc/icinga2/features-available/ido-mysql.conf'
+dbc_generate_include_owner='nagios:nagios'
+dbc_generate_include_args='--ucf -o template_infile=/usr/share/icinga2/tmpl/ido-mysql.conf-sample'
+dbc_go icinga2-ido-mysql $@
+
+
+if [ "$1" = configure ]; then
+
+ # get values from debconf db
+ db_get icinga2-ido-mysql/enable
+
+ if [ "$RET" = "false" ]; then
+ if [ -L /etc/icinga2/features-enabled/ido-mysql.conf ]
+ then
+ echo "disable ido mysql feature"
+ icinga2-disable-feature ido-mysql
+ echo "reloading icinga2"
+ [ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
+ fi
+ else
+ if [ ! -L /etc/icinga2/features-enabled/ido-mysql.conf ]
+ then
+ echo "enable ido mysql feature"
+ icinga2-enable-feature ido-mysql
+ echo "reloading icinga2"
+ [ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
+
+ fi
+ fi
+fi
+
+#DEBHELPER#
+db_stop
+
+
diff --git a/debian/icinga2-ido-mysql.postrm b/debian/icinga2-ido-mysql.postrm
new file mode 100644
index 0000000..c40b398
--- /dev/null
+++ b/debian/icinga2-ido-mysql.postrm
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+if [ -f /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+fi
+
+if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+ . /usr/share/dbconfig-common/dpkg/postrm
+ dbc_go icinga2-ido-mysql $@
+fi
+
+if [ "$1" = "purge" ]; then
+ rm -f /etc/icinga2/features-available/ido-mysql.conf
+ if which ucf >/dev/null; then
+ ucf --purge /etc/icinga2/features-available/ido-mysql.conf
+ fi
+ db_purge
+fi
+
diff --git a/debian/icinga2-ido-mysql.prerm b/debian/icinga2-ido-mysql.prerm
new file mode 100644
index 0000000..81b478a
--- /dev/null
+++ b/debian/icinga2-ido-mysql.prerm
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/prerm
+dbc_go icinga2-ido-mysql $@
+
+#DEBHELPER#
+
diff --git a/debian/icinga2-ido-mysql.templates b/debian/icinga2-ido-mysql.templates
new file mode 100644
index 0000000..672a515
--- /dev/null
+++ b/debian/icinga2-ido-mysql.templates
@@ -0,0 +1,9 @@
+Template: icinga2-ido-mysql/enable
+Type: boolean
+Default: true
+_Description: Enable icinga 2 mysql idoutils?
+ If you acknowledge this question the ido mysql
+ feature gets enabled for icinga 2.
+ .
+ If you want to disable the feature call
+ icinga2-disable-feature ido-mysql
diff --git a/debian/icinga2-ido-pgsql.config b/debian/icinga2-ido-pgsql.config
new file mode 100644
index 0000000..6db17f7
--- /dev/null
+++ b/debian/icinga2-ido-pgsql.config
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+. /usr/share/debconf/confmodule
+
+if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
+ . /usr/share/dbconfig-common/dpkg/config.pgsql
+ dbc_authmethod_user="password"
+ dbc_go icinga2-ido-pgsql $@
+fi
+
+# check if the feature is enabled
+if test -L /etc/icinga2/features-enabled/ido-pgsql.conf; then
+ db_set icinga2-ido-pgsql/enable "true"
+else
+ db_set icinga2-ido-pgsql/enable "false"
+fi
+db_input high icinga2-ido-pgsql/enable || true
+db_go || true
diff --git a/debian/icinga2-ido-pgsql.install b/debian/icinga2-ido-pgsql.install
index b83b3dc..a8fdc9c 100644
--- a/debian/icinga2-ido-pgsql.install
+++ b/debian/icinga2-ido-pgsql.install
@@ -1,3 +1,5 @@
debian/tmp/etc/icinga2/features-available/ido-pgsql.conf
usr/lib/*/icinga2/libdb_ido_pgsql*
components/db_ido_pgsql/schema/*.sql usr/share/icinga2-ido-pgsql/schema
+debian/ido-pgsql.conf-sample usr/share/icinga2/tmpl
+
diff --git a/debian/icinga2-ido-pgsql.postinst b/debian/icinga2-ido-pgsql.postinst
new file mode 100644
index 0000000..e8fbad4
--- /dev/null
+++ b/debian/icinga2-ido-pgsql.postinst
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst
+
+#dbc_debug='1'
+dbc_generate_include='template:/etc/icinga2/features-available/ido-pgsql.conf'
+dbc_generate_include_owner='nagios:nagios'
+dbc_generate_include_args='--ucf -o template_infile=/usr/share/icinga2/tmpl/ido-pgsql.conf-sample'
+dbc_go icinga2-ido-pgsql $@
+
+
+if [ "$1" = configure ]; then
+
+ # get values from debconf db
+ db_get icinga2-ido-pgsql/enable
+
+ if [ "$RET" = "false" ]; then
+ if [ -L /etc/icinga2/features-enabled/ido-pgsql.conf ]
+ then
+ echo "disable ido pgsql feature"
+ icinga2-disable-feature ido-pgsql
+ echo "reloading icinga2"
+ [ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
+ fi
+ else
+ if [ ! -L /etc/icinga2/features-enabled/ido-pgsql.conf ]
+ then
+ echo "enable ido pgsql feature"
+ icinga2-enable-feature ido-pgsql
+ echo "reloading icinga2"
+ [ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
+
+ fi
+ fi
+fi
+
+#DEBHELPER#
+db_stop
+
+
diff --git a/debian/icinga2-ido-pgsql.postrm b/debian/icinga2-ido-pgsql.postrm
new file mode 100644
index 0000000..422d8a5
--- /dev/null
+++ b/debian/icinga2-ido-pgsql.postrm
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+if [ -f /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+fi
+
+if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
+ . /usr/share/dbconfig-common/dpkg/postrm
+ dbc_go icinga2-ido-pgsql $@
+fi
+
+if [ "$1" = "purge" ]; then
+ rm -f /etc/icinga2/features-available/ido-pgsql.conf
+ if which ucf >/dev/null; then
+ ucf --purge /etc/icinga2/features-available/ido-pgsql.conf
+ fi
+ db_purge
+fi
+
diff --git a/debian/icinga2-ido-pgsql.prerm b/debian/icinga2-ido-pgsql.prerm
new file mode 100644
index 0000000..be80f9c
--- /dev/null
+++ b/debian/icinga2-ido-pgsql.prerm
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/prerm
+dbc_go icinga2-ido-pgsql $@
+
+#DEBHELPER#
+
diff --git a/debian/icinga2-ido-pgsql.templates b/debian/icinga2-ido-pgsql.templates
new file mode 100644
index 0000000..fb5c4b9
--- /dev/null
+++ b/debian/icinga2-ido-pgsql.templates
@@ -0,0 +1,9 @@
+Template: icinga2-ido-pgsql/enable
+Type: boolean
+Default: true
+_Description: Enable icinga 2 pgsql idoutils?
+ If you acknowledge this question the ido pgsql
+ feature gets enabled for icinga 2.
+ .
+ If you want to disable the feature call
+ icinga2-disable-feature ido-pgsql
diff --git a/debian/ido-mysql.conf-sample b/debian/ido-mysql.conf-sample
new file mode 100644
index 0000000..84752b4
--- /dev/null
+++ b/debian/ido-mysql.conf-sample
@@ -0,0 +1,14 @@
+/**
+ * The db_ido_mysql library implements IDO functionality
+ * for MySQL.
+ */
+
+library "db_ido_mysql"
+
+object IdoMysqlConnection "ido-mysql" {
+ user = "_DBC_DBUSER_",
+ password = "_DBC_DBPASS_",
+ host = "_DBC_DBSERVER_",
+ database = "_DBC_DBNAME_"
+}
+
diff --git a/debian/ido-pgsql.conf-sample b/debian/ido-pgsql.conf-sample
new file mode 100644
index 0000000..244ab10
--- /dev/null
+++ b/debian/ido-pgsql.conf-sample
@@ -0,0 +1,13 @@
+/**
+ * The db_ido_pgsql library implements IDO functionality
+ * for PostgreSQL.
+ */
+
+library "db_ido_pgsql"
+
+object IdoPgsqlConnection "ido-pgsql" {
+ user = "_DBC_DBUSER_",
+ password = "_DBC_DBPASS_",
+ host = "_DBC_DBSERVER_",
+ database = "_DBC_DBNAME_"
+}
diff --git a/debian/rules b/debian/rules
index a77a1b0..85df480 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,6 +25,15 @@ override_dh_install:
# remove ido files from other packages
if [ -d debian/icinga2-common/ ]; then rm debian/icinga2-common/etc/icinga2/features-available/ido-*; fi
rm debian/icinga2-bin/usr/lib/*/icinga2/libdb_ido_*
+ for dbms in mysql pgsql; do \
+ mkdir -p debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/install ; \
+ mkdir -p debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/upgrade/$$dbms; \
+ cp components/db_ido_$$dbms/schema/$$dbms.sql debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/install/$$dbms ; \
+ for file in components/db_ido_$$dbms/schema/upgrade/* ; do \
+ cp $$file debian/icinga2-ido-$$dbms/usr/share/dbconfig-common/data/icinga2-ido-$$dbms/upgrade/$$dbms/`basename $$file .sql`; \
+ done; \
+ done
+
override_dh_installinit:
dh_installinit --name=icinga2
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-icinga2.git
More information about the Pkg-nagios-changes
mailing list