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

Re: anaconda screens



Luis Correia wrote:
Hi,

I'm about to do some funky %pre stuff in python, to decide whetner or
not to install the machine and need some user interaction.
We're only doing it in text mode, no need for fancy graphics.

How do I from the %pre script write stuff to the screen, get input,
maybe a button or two ?

I've rummaged through the anaconda code, but it all seems a bit strange to me.

Sorry for the late response, I've been on vacation. I know your question has been largely answered, but I thought I'd copy my response to a similar question from earlier this year. The answers I've seen to you question involve switching tty's, but there's also the issue of how to do the UI.

The discussion was about using snack, which is (or was, at least; I'm still on FC2) the text based UI manager used by anaconda:

-------------------------------
I use code like this:
set_tty(1)  # change to tty1, we're called by
            #  kickstart with stdout as tty3

user_args = get_user_input()
set_tty(3)  # restore

Where:
def set_tty(n):
    f = open('/dev/tty%d' % n, 'a')
    os.dup2(f.fileno(), sys.stdin.fileno())
    os.dup2(f.fileno(), sys.stdout.fileno())
    os.dup2(f.fileno(), sys.stderr.fileno())

and get_user_input() uses snack.
-------------------------------

You might want to check out snack (aka newt); there are a few examples at http://www.wanware.com/tsgdocs/snack.html.

Eric.


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