determine VGA vs. ttyS* console in %pre ?

Steve Rikli sr at genyosha.net
Fri Dec 8 23:09:32 UTC 2006


In article <4579DB13.10001 at herakles.homelinux.org>,
John Summerfield  <kickstart-list at redhat.com> wrote:
>Steve Rikli wrote:
>
>> ...
>> Exactly -- and that's what I was after.
>> 
>> `grep console= /proc/cmdline` and playing sed games with a script
>> during %pre gives me the "console=<args>" stuff which was appended
>> to the kernel during PXE.
>> 
>> I.e. my script could return something like "ttyS0,9600n8" for a
>> serial console install, and "" for a VGA install.
>> 
>> That script in %pre builds a very simple %include file which contains
>> a "bootloader --append=<args>" string, which I then use in the general
>> section of ks.cfg .
>> 
>> One less bit of hardcoded data in all my ks.cfg files -- thanks to all!
>
>When you want answers to Qs like this, it's a good idea to switch to the 
>shell on tty2 and have a look around.

Indeed -- that's just what I had been doing, but simply hadn't looked
in the "right" places -- e.g. /proc/tty/ et al, as I mentioned in the
original post.  The hint about /proc/cmdline/ took me right where I
needed to go.

For this, and other potentially useful information.  :-)

> There's useful stuff in /proc 
>(commandline for the kernel, maybe some stuff for processes), there's 
>the environment - the console stuff may be there too.

Some, but nothing else I've seen so far has proved as useful as
/proc/cmdline/ for this particular "what's the console?" purpose.

One of the first things I did when starting Kickstart work was run a
handful of simple things in %post to figure out "what's available";
e.g.  the shell environment, as you mentioned, and basic commands
like 'df' and 'ps' and 'env' and etc., just to look for interesting
things to make use of during the install.

>You _can_ find your server if you're doing ftp/http (nfs too I think), 
>and potentially get more info there, perhaps a profile or script that 
>makes futher customisations.

Exactly -- the basic routine I've seen here and elsewhere, and have
happily taken advantage of:

	- run a small script (or just shell commands) in %pre
	- use that to build a customized %include
	- use %include in general or %post

is a very useful notion for many types of cat-skinning.  :)

Cheers,
sr.
-- 
|| Steve Rikli             |||                                         ||
|| Systems Administrator   ||| Good, fast, cheap:  choose any two.     ||
||                         |||                                         ||
|| sr at genyosha.net         |||                                         ||




More information about the Kickstart-list mailing list