Re: load question/dialog in %post section

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

 



This has been discussed several times.  A search for chvt in the list will
yield this.

At anyrate, what you need to do in the %post section is run chvt (see the
man page)
to force the terminal to change to the other tty where script output goes
(I forget which one
so test this).

Once you have done this screen will change to the desired vt.  The problem
is once you have
the users input, how do you affect changes in the kickstart.  If you merely
want to do different things
in %post, you can save the users input to a file in /tmp and then read that
file in %pre.  The easiest format
would be to convert the user input to a little shell script that simply
sets variables.  Such as:

      QUESTION1="whatever the user input"

and then source this into your %pre script (this of course will require
running %pre in a
non chrooted environment [i.e. %pre --nochroot].  The installed system is
mounted at:

      /mnt/sysimage

One could get tricky and have a non-chrooted %pre which simply copies the
user input
script to somewhere in /mnt/sysimage, and then use regulare %pre (i.e. a
chrooted one)
to do all the work in the chrooted environment:

      %pre --nochroot
      cp /tmp/user.input.sh /mnt/sysimage/tmp

      %pre
      .  /tmp/user.input.sh

      #
      # Add code to do what was requested.

Now if you want to change the actuall kickstart directives this gets a bit
trickier.  The thing
you have to do in this instance is actually rewrite the kickstart file.  I
do believe it is stored in
/tmp/ks.cfg.  The reason rewriting it in %pre works, is that anaconda
re-reads the kickstart
after all the %pre scripts are ran.  You can make this simpler (i.e. make
it so you don't have
to rewrite the entire kickstart file) by simply having an include statement
in your original kickstart
file that would point to the section containing the directives you wrote
out based on the user's
input.

Cheers...james



                                                                                                                                           
                      "Avner BenHanoch"                                                                                                    
                      <avner@xxxxxxxxx>            To:      <kickstart-list@xxxxxxxxxx>                                                    
                      Sent by:                     cc:                                                                                     
                      kickstart-list-admin         Subject: Re: load question/dialog in %post section                                      
                      @redhat.com                                                                                                          
                                                                                                                                           
                                                                                                                                           
                      05/11/03 10:12 AM                                                                                                    
                      Please respond to                                                                                                    
                      kickstart-list                                                                                                       
                                                                                                                                           
                                                                                                                                           




thanks a lot for the detailed explanation!

Before I sent the question I tried something like:
    clear
    echo "What's your name"
    read name
    echo your name is $name
    sleep 3

I put it in the %post section of my ks.cfg file.  (I used bash as the
interpreter for the %post section.)

Unfortunately my test failed.  The screen remained blue (the regular
installation screen when in text mode).  Nothing was shown to the user.
The
installation stopped. I tried to enter text and press return to help it
continue, but it didn't notice me.  I had to manually reboot the system
before the installation completed.

Do you think it should work and I had a mistake, or that I can't use
interactive shell script during installation?
If I hadn't mistake, do you think loading program that is written in one of
the languages you mentioned (python, perl, C, Java) will succeed to
interact
with the user?

Again, thanks in advance,
  Avner


----- Original Message -----
From: "John" <red@xxxxxxxxxxxxxxxxxxxxxxx>
To: <kickstart-list@xxxxxxxxxx>
Sent: Sunday, May 11, 2003 1:04 PM
Subject: Re: load question/dialog in %post section


> On Sun, 11 May 2003, Avner BenHanoch wrote:
>
> > Is there a way to ask the user question in the %post section and store
the
> > answer somewhere in the system.
> > The UI can be simple text, but a decent dialog will be nicer.
> >
> > If it is possible, can I add timeout to the question, so the system
will
> > continue after some seconds?
>
> It is easy to ask questions. You can do something as simple as
> echo "What's your name"
> read name
> to really fancy things in any language you choose: python, perl, C, even
> Java (provided that you install it).
>
> You can use aids such as newt, slang, curses, dialog.
>
> Iimeouts can be easy or less easy, depending on the language you choose.
> Look to ways of using kill or kill() and handling signals. You _can_ do
> it in shell scripts, but it may be more elegant in other languages.
>
>
>
>
> --
> Please, reply only to the list.
>
> Join the "Linux Support by Small Businesses" list at
> http://mail.computerdatasafe.com.au/mailman/listinfo/lssb
>
>
>
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/kickstart-list
>


_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
 https://www.redhat.com/mailman/listinfo/kickstart-list







[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux