Accessing stdin during systemd boot

bootfedora

I have a script which solicits a numeric input from the user while booting the computer. The computer is running Fedora 16. It used work, on Fedora 13, but after the upgrade

read INTEGER

returns immediately, without catching any user input. I tried

read INTEGER
wait $!

but (predictably) that too doesn't work. The script is run from a systemd service file (see comments below). It must be run as root, and must started before the user logs in. It currently calls bash as its interpreter, but with some effort, that could be changed. Can anyone help return this script to normal?

Extra credit: In F13, it used to halt booting for user input (as desired) but the input was not displayed as the user typed. Is there a way to add this functionality?

Alternatively, I could cue a graphical interface (e.g. from tkinter/Python) to ask for INTEGER after graphical.target loads. Any thoughts on how I might do this? Is it straightforward to load things with windows before the desktop loads?

Best Answer

Use the systemd-ask-password command and systemd will take care of prompting the user for input in an appropriate manner, either using a text prompt or a graphical prompt.