NetBSD-Users archive

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

Re: detecting serial console from a shell-script

On Sat, Apr 24, 2010 at 08:10:38AM +0000, Michael van Elst wrote:
> >sysctl kern.consdev seems to give the answer. How reliable is it? Can I
> >take for granted that this command will detect a serial console?
> >/sbin/sysctl kern.consdev | egrep -q '= tty0[0-3]$' && echo "serial"

The sysinst startup scripts do it the other way around (though complicated
due to missing dev.db in the miniroot/cd setup): they check for ttyE0 as
kern.consdev and then don't bother asking for the proper terminal type.

If you can rely on proper dev.db (i.e. sysctl will output ttyE0) you can
do it MI.


Home | Main Index | Thread Index | Old Index