#!/bin/sh
# postinst script for yandex-du-remotelog-client
#
# see: dh_installdeb(1)

set -e

case "$1" in
    configure)
        mkdir -p /mnt/remote-log || true
        if ! getent group glogs >/dev/null; then
            addgroup --quiet --gid 567 glogs
        fi
        chown :glogs /mnt/remote-log
    ;;

    triggered)
        #here is the handler 
        /etc/init.d/remote-log-client start
    ;;

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

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_installinit
if [ -x "/etc/init.d/remote-log-client" ] || [ -e "/etc/init/remote-log-client.conf" ]; then
	if [ ! -e "/etc/init/remote-log-client.conf" ]; then
		update-rc.d remote-log-client start 20 2 3 4 5 . start 20 0 6 . stop 20 1 . >/dev/null
	fi
	if [ -n "$2" ]; then
		_dh_action=restart
	else
		_dh_action=start
	fi
	invoke-rc.d remote-log-client $_dh_action || exit $?
fi
# End automatically added section


exit 0
