#!/bin/bash

# PLEASE AVOID USING DEBIAN-HOOKS!
# For more info please contact HOSTMAN team.

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

#DEBHELPER#

case "$1" in
    abort-upgrade|abort-remove|configure|abort-deconfigure)
        if ! grep -q '^source /etc/network/interfaces.d/\*$' /etc/network/interfaces
        then
            echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces && echo "patched ENI"
        else
            echo "ENI already patched"
        fi
    ;;

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

exit 0

