[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#614127: confirmed on allmachines: painfull



On Fri, Feb 25, 2011 at 02:05:07PM +0100, Samuel Thibault wrote:
> 
> What Anton wants is to know whether X is currently at the front or not.
> And you can't rely on DISPLAY being set (since you could be from sudo su
> -), and you can't rely on stdin being the VT (since you could be from
> screen).

Testing the standard output and standard input never worked because they 
are redirected by Debconf.  In particular /usr/bin/tty outputs "not a tty".
For a long time the following code worked:

    case `readlink /proc/self/fd/2` in
        /dev/tty[0-9]*|/dev/vc/[0-9]*|/dev/console)
            echo we ARE on the Linux console.
            ;;
        *)
            echo we are NOT on the Linux console.
            ;;
    esac

Unfortunately for some time Debconf redirects even stderr and this code 
no longer works.

Yes, dpkg-reconfigure could print a warning, but I suppose this would go 
against the policy for proper Debconf use (Christian probably knows this 
better).

Anton Zinoviev



Reply to: