File: mon.postinst

package info (click to toggle)
etbemon 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,624 kB
  • sloc: perl: 18,038; cpp: 546; sh: 428; ansic: 407; makefile: 71
file content (66 lines) | stat: -rw-r--r-- 1,824 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#
# Author: Dario Minnucci <midget@debian.org>
# Date:   Fri, 29 Jun 2007 02:51:52 +0200
#
#         'mon' user creation in configure step.
#

set -e

#echo "----------------------------------------------"
#echo " debian/mon.postinst: $1"
#echo "----------------------------------------------"

case "$1" in
    configure)

	chown mon:root "/var/log/mon"

	for FILE in /usr/lib/mon/bin/btrfs.helper /usr/lib/mon/bin/zfs.helper /usr/lib/mon/bin/smartctl.helper /usr/lib/mon/mon-local.d/deleted-mapped.monitor /usr/lib/mon/bin/hplog.helper ; do
	    if ! dpkg-statoverride --list $FILE > /dev/null 2>&1
	    then
		chown root:mon $FILE
		chmod 4750 $FILE
	    fi
	done

	#
	# Check if pidfile directory already exists and change ownership"
	#
	if [ -d "/run/mon" ] ; then
		############################################################
		# Compativility with versions older than 0.99.2-12:
		############################################################
		# On previous versions, /run/mon directory ownership was 
		# set to 'daemon:root' in order to manage the pidfile.
		# With the introduction of the user 'mon', the init script
		# switches to user 'mon' before starting the daemon startup
		# process. Because of this, we need to change the directory
		# ownership to ensure the pidfile is created.
		############################################################
		chown mon:root "/run/mon"
	fi 
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

if [ -d /run/systemd/system ]; then
  systemctl --system daemon-reload >/dev/null || true
  if [ -n "$2" ]; then
    _dh_action=try-restart
  else
    _dh_action=start
  fi
  deb-systemd-invoke $_dh_action mon.service >/dev/null || true
fi

#DEBHELPER#