File: postinst

package info (click to toggle)
cacti-spine 1.2.16-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 628 kB
  • sloc: ansic: 6,416; sh: 108; makefile: 33
file content (43 lines) | stat: -rw-r--r-- 1,166 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
#!/bin/sh

set -e

generate_config() {
	confdbc=/usr/share/cacti/conf_templates/spine.conf.dbconfig
	confsrc=/usr/share/cacti/conf_templates/spine.conf.sample
	if [ -f "/etc/dbconfig-common/cacti.conf" ]; then
		dbconfig-generate-include -U -f template -o "template_infile=$confdbc" /etc/dbconfig-common/cacti.conf /etc/cacti/spine.conf
	else
		ucf $confsrc /etc/cacti/spine.conf
	fi
	ucfr cacti-spine /etc/cacti/spine.conf
	chown root:www-data /etc/cacti/spine.conf
	chmod 640 /etc/cacti/spine.conf
}

case "$1" in
"configure"|"reconfigure"|"upgrade")
	. /usr/share/debconf/confmodule
	db_version 2.0

	generate_config
;;
esac

if [ "$1" = configure ]; then
    # If we have setcap is installed, try setting cap_net_raw+ep,
    # which allows us to install our binaries without the setuid
    # bit.
    if command -v setcap > /dev/null; then
        if setcap cap_net_raw+ep /usr/sbin/spine; then
            chmod u-s /usr/sbin/spine
        else
            echo "Setcap failed on /usr/sbin/spine, Host ICMP Ping check not available" >&2
        fi
    else
        echo "Setcap is not installed,  Host ICMP Ping check not available" >&2
    fi
fi


#DEBHELPER#