postinst is in cacti 0.8.8a+dfsg-5+deb7u8.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #!/bin/sh
set -e
# source debconf stuff
. /usr/share/debconf/confmodule
db_version 2.0
# source dbconfig-common stuff
. /usr/share/dbconfig-common/dpkg/postinst.mysql
dbc_first_version="0.8.6g-3"
dbc_generate_include="template:/etc/cacti/debian.php"
dbc_generate_include_owner="root:www-data"
dbc_generate_include_perms="0640"
dbc_generate_include_args="--dbname=database_default --dbpass=database_password --dbuser=database_username --dbserver=database_hostname --dbport=database_port -o template_infile=/usr/share/doc/cacti/debian.php.dist"
dbc_go cacti $@
ucfr cacti /etc/cacti/debian.php
#
# Skip, if we are not in "configure" state
#
if [ "$1" != "configure" ]; then
exit 0
fi
version="$2"
## Source debconf library
#
# retieve various configuration options from debconf
#
db_get cacti/webserver
WWWTYPE="$RET"
ucf --debconf-ok /usr/share/doc/cacti/cacti.apache.conf /etc/cacti/apache.conf
ucfr cacti /etc/cacti/apache.conf
ucf --debconf-ok /usr/share/doc/cacti/cacti.lighttpd.conf /etc/cacti/lighttpd.conf
ucfr cacti /etc/cacti/lighttpd.conf
# done with debconf...
db_stop
# Create common files (logfile) and grant permissions
touch /var/log/cacti/rrd.log /var/log/cacti/cacti.log /var/log/cacti/poller-error.log
chmod 0640 /var/log/cacti/rrd.log /var/log/cacti/cacti.log /var/log/cacti/poller-error.log
chown -R www-data:www-data /var/log/cacti/
# update the webserver, if needed
case "$WWWTYPE" in
"apache2"|"All")
webservers="apache2" ;;
lighttpd)
webservers="lighttpd" ;;
*)
webservers="" ;;
esac
# Only try to add a symlink on a fresh install to respect
# changes done by the administrator
if [ "$2" = '' ]; then
for server in $webservers; do
if [ -d "/etc/${server}/conf.d" ]; then
if [ ! -e "/etc/${server}/conf.d/cacti.conf" ] ; then
ln -s ../../cacti/apache.conf "/etc/${server}/conf.d/cacti.conf"
fi
invoke-rc.d $server reload || true
elif [ -d "/etc/${server}/conf-available" ]; then
if [ ! -e "/etc/${server}/conf-available" ] ; then
ln -s ../../cacti/lighttpd.conf "/etc/${server}/conf-available/cacti.conf"
fi
fi
done
fi
# remove old unused config files
rm -f /etc/cacti/config.php
rm -f /etc/cacti/default-poller
# Automatically added by dh_usrlocal
if [ "$1" = configure ]; then
(
while read line; do
set -- $line
dir="$1"; mode="$2"; user="$3"; group="$4"
if [ ! -e "$dir" ]; then
if mkdir "$dir" 2>/dev/null; then
chown "$user":"$group" "$dir"
chmod "$mode" "$dir"
fi
fi
done
) << DATA
/usr/local/share 2775 root staff
/usr/local/share/cacti 2775 root staff
/usr/local/share/cacti/resource 2775 root staff
/usr/local/share/cacti/resource/script_queries 2775 root staff
/usr/local/share/cacti/resource/script_server 2775 root staff
/usr/local/share/cacti/resource/snmp_queries 2775 root staff
/usr/local/share/cacti/scripts 2775 root staff
DATA
fi
# End automatically added section
exit 0
|