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
|
#! /bin/bash
set -e
ensure_usergroup() {
if ! getent passwd munin >/dev/null; then
adduser --system \
--group \
--no-create-home \
--home /var/lib/munin \
munin
fi
if ! getent passwd munin-httpd >/dev/null; then
adduser --system \
--ingroup munin \
--no-create-home \
--home /nonexistent \
munin-httpd
fi
}
migration_remove_munin_2x_files() {
find /var/log/munin -name 'munin-cgi-graph.log*' -delete
find /var/log/munin -name 'munin-cgi-html.log*' -delete
rm -rf /var/cache/munin/www
}
case "$1" in
configure)
ensure_usergroup
install -o munin -g munin -m 0755 -d /var/lib/munin
install -o munin -g munin -m 0755 -d /var/spool/munin/update
if dpkg --compare-versions "$2" le "2.1.999-1~" ; then
migration_remove_munin_2x_files
fi
;;
abort-upgrade|abort-deconfigure|abort-remove)
:
;;
*)
echo "Called with unknown argument $1, bailing out."
exit 1
;;
esac
#DEBHELPER#
|