[Pkg-nagios-changes] [pkg-icinga2] 10/12: Added postinst/rm for permissions and cleanup
Markus Frosch
lazyfrosch-guest at alioth.debian.org
Tue Oct 15 18:43:25 UTC 2013
This is an automated email from the git hooks/post-receive script.
lazyfrosch-guest pushed a commit to branch master
in repository pkg-icinga2.
commit e2741356663b4b9f9a4878db155e96d418249285
Author: Markus Frosch <markus at lazyfrosch.de>
Date: Tue Oct 15 15:22:57 2013 +0200
Added postinst/rm for permissions and cleanup
---
debian/icinga2-common.postinst | 61 ++++++++++++++++++++++++++++++++++++++++
debian/icinga2-common.postrm | 28 ++++++++++++++++++
2 files changed, 89 insertions(+)
diff --git a/debian/icinga2-common.postinst b/debian/icinga2-common.postinst
new file mode 100644
index 0000000..b33c9d1
--- /dev/null
+++ b/debian/icinga2-common.postinst
@@ -0,0 +1,61 @@
+#!/bin/sh
+# postinst script for icinga2-common
+
+set -e
+
+setperm() {
+ user="$1"
+ group="$2"
+ mode="$3"
+ file="$4"
+ shift 4
+ # only do something when no setting exists
+ if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
+ chown "$user":"$group" "$file"
+ chmod "$mode" "$file"
+ fi
+}
+
+case "$1" in
+ configure)
+ if ! getent passwd nagios > /dev/null ; then
+ echo 'Adding system-user for nagios' 1>&2
+ adduser --system --group --home /var/lib/nagios \
+ --disabled-login --force-badname nagios > /dev/null
+ fi
+
+ # explicitly set permissions on some files that are dependent
+ # on the uid/gid of the nagios user, which is dynamically created.
+ setperm nagios adm 2751 /var/log/icinga2
+ setperm nagios adm 2751 /var/log/icinga2/compat
+ setperm nagios adm 2755 /var/log/icinga2/compat/archives
+
+ setperm nagios nagios 0750 /var/lib/icinga2
+ setperm nagios nagios 0750 /var/lib/icinga2/cluster
+ setperm nagios nagios 0750 /var/lib/icinga2/cluster/config
+ setperm nagios nagios 0750 /var/lib/icinga2/cluster/log
+
+ setperm nagios www-data 0750 /var/cache/icinga2
+ setperm nagios nagios 0750 /var/spool/icinga2
+
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+init_failed ()
+{
+ echo "Icinga 2 was unable to start due to configuration errors.";
+ echo "Please fix them and manually restart the icinga2 daemon using";
+ echo " ´service icinga2 start´";
+}
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/icinga2-common.postrm b/debian/icinga2-common.postrm
new file mode 100644
index 0000000..bfccf4d
--- /dev/null
+++ b/debian/icinga2-common.postrm
@@ -0,0 +1,28 @@
+#!/bin/sh
+# postrm script for icinga2-common
+
+set -e
+
+case "$1" in
+ purge)
+ rm -f /etc/icinga2/features-enabled/*
+ rm -rf /var/log/icinga2/
+ rm -rf /var/cache/icinga2/
+ rm -rf /var/spool/icinga2/
+ ;;
+
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--
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