Quote:
Originally Posted by matschr
BTW, I'm looking for a way to run an application at init which has access to the keyboard for reading.
|
I guess the best option is to tell a getty to run your application instead of /bin/login.
If you have file
/etc/init/tty1.conf containing
Code:
exec /sbin/getty -8 38400 tty1
then replace the line with
Code:
exec /sbin/getty -i -l yourprogram -n -8 38400 tty1
and instead of the normal login prompt in the first console,
yourprogram will be executed (with root rights). (If you don't want it in the default first console, just modify one of the other gettys.)
Remember that this occurs very early in the boot. If you use a language like C++ which relies on dynamic libraries or runtime residing under /usr, it is better if you use a trampoline script, something like
Code:
#!/bin/dash
while [ ! -d /usr/lib ]; do sleep 1 ; done
exec your-actual-application "$@"
saved in /bin/, to make sure the mount points are available before your program proper is started.