Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing stdin during systemd boot

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?

like image 571
Mark C. Avatar asked Jan 21 '12 14:01

Mark C.


1 Answers

During a normal boot, the keyboard is connected to Plymouth (I believe)

On Fedora, I believe you want something like:

 plymouth ask-question --prompt="Pick a number between 0 and ∞" \
     --command="/usr/bin/numberguesser"

possibly with

     --dont-pause-progress

That should display the Plymouth prompt screen, not dissimilar from the way that crypto filesystems prompt for their passwords.

Note that /usr/bin/numberguesser would only get the string entered piped in on its standard input.

Untested, sorry :-(

like image 151
BRPocock Avatar answered Sep 20 '22 15:09

BRPocock