if [ "$1" = configure ] && [ -z "$2" ] && [ -r /usr/share/PACKAGE/default-session.txt ]; then
    session=$(cat /usr/share/PACKAGE/default-session.txt)

    # LightDM
    if [ -x /usr/lib/lightdm/lightdm-set-defaults ] ; then
        /usr/lib/lightdm/lightdm-set-defaults --session $session || true
    fi

    # gdm
    if [ ! -e /etc/gdm/custom.conf ]; then
	mkdir -p /etc/gdm/
	cat <<EOF > /etc/gdm/custom.conf
[daemon]
DefaultSession=$session
EOF
    fi

fi
