Based on Ubuntu core 12.04, I have prepared a bootable DVD. After booting (to console only), I can login as a user and start a script for installation of an embedded device:
In order to execute this script already at startup, I've added the following to
/etc/rc.local in the image of the root filesystem on the DVD:
/bin/bash -ic install_script
Since this script is executed unconditionally, I'd like to give the user some opportunity to bypass installation and get on to a login prompt. To that end, I'd like to use
read in the install_script. Unfortunately, the script does not react to keyboard input when run from
/etc/rc.local. (There is no problem with the same script started from a shell after login).
How can I get some user input at startup?
- Maybe, I can somehow detect and connect a tty to
reador to the script? I tried
/bin/bash -ic install_script </dev/consoleto no avail.
- Maybe, there are more suitable options to
- Maybe, I could boot into a single shell of a certain user (maybe
root, without logging in?) with
sudo install_script(avoiding password check for sudo?)?
- Maybe, there exists a better place for calling the script?
- I would not like to separate the interaction (to occur earlier) and the install_script (e.g., by providing different boot options via isolinux and examining
/proc/cmdlinein the script) for the following reason: Before asking the user, I'd like to examine the system and give an overview of what exactly would happen during the install. At earlier stages of the boot process, the necessary information for the examination of the system may not yet be easily available.