#!/bin/sh
# postinst script for drouter

case "$1" in
    configure)
	if test ! -e /etc/drouter/drouter.conf ; then
	    mkdir -p /etc/drouter
	    mkdir -p /etc/drouter/maps.d
	    mkdir -p /etc/drouter/scripts.d
	    cp /usr/share/drouter/drouter.conf-sample /etc/drouter/drouter.conf
	    mkdir -p /var/cache/drouter
	    chown root:root /var/cache/drouter
	    chmod 0600 /var/cache/drouter
	fi
	mkdir -p /var/cache/drouter
	if [ -x /bin/systemctl ] ; then
	    /bin/systemctl daemon-reload
	    /bin/systemctl start drouter.socket
	    /bin/systemctl enable drouter.socket
	    /bin/systemctl start drouter.service
	    /bin/systemctl enable drouter.service
	fi
    ;;

    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.

#DEBHELPER#

exit 0
