Subject: Re: [Debconf-devel] Bug#646252: Please provide a way to check if debconf is running interactive or noninteractive frontend

From: Joey Hess <[email-masked]>
Date: Sat, 22 Oct 2011 12:56:18 -0700

Robert Luberda wrote:
> It would be nice if it would be possible to check from maintainer
> scripts if debconf is running interactively or not. I would use such a
> feature to fix #645240 (run some command in background for interactive
> use or spawn it in foreground/don't run at all for noninteractive).
> 
> I tried using the 'seen' flag, but I found it unreliable due to
> DEBCONF_NONINTERACTIVE_SEEN.

I think one way to accomplish what you want to do is to have the value
be true in the template, and then:

if ! db_input foo/bar; then
	not_seen=1
fi
db_go
db_get foo/bar
if [ "$not_seen" ] || [ "$RET" = false ]; then
	foreground=1
fi

It does prevent preseeding of the question, but preseeding may not
matter.

> I've also found debconf's VISIBLE command, but it is not documented, and
> seems to always return 'true' regardless of the frontend.

It's deprecated and does nothing but check the seen flag.

-- 
see shy jo