#!/bin/sh
# Update proxy settings using wpad-url DHCP option or
# http://wpad/wpad.dat when a DHCP update arrives

update_proxy_from_wpad() {
    # Not comparing the old and new URL, as the URL might be the same
    # but the content of the WPAD file changed.  If the option is not
    # set and no wpad file is available from http://wpad/wpad.dat ,
    # the use of a proxy should be disabled.
    /usr/share/debian-edu-config/tools/update-proxy-from-wpad
}

if [ -r /etc/debian-edu/config ] ; then
    . /etc/debian-edu/config
fi

if [ false = "$DHCP_WPAD_PROXY_UPDATE" ] ; then
    exit 0
fi

case $reason in
    BOUND|RENEW|REBIND|REBOOT)
	update_proxy_from_wpad
	;;
    EXPIRE|FAIL|RELEASE|STOP)
	;;
esac
