在 systemd 启动期间访问 stdin
我有一个脚本,在启动计算机时请求用户输入数字。该计算机运行的是 Fedora 16。它在 Fedora 13 上使用过工作,但升级后
read INTEGER
立即返回,没有捕获任何用户输入。我尝试过
read INTEGER
wait $!
,但(可以预见)这也行不通。该脚本从 systemd 服务文件运行(请参阅下面的注释)。它必须以root身份运行,并且必须在用户登录之前启动。它当前调用bash作为其解释器,但通过一些努力,这可以改变。任何人都可以帮助恢复此脚本正常吗?
额外加分:在 F13 中,它用于停止用户输入的启动(根据需要),但在用户键入时不会显示输入。有没有办法添加这个功能?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在正常启动期间,键盘连接到 Plymouth(我相信)
在 Fedora 上,我相信您想要类似的东西:
可能
应该 显示 Plymouth 提示屏幕,与加密文件系统的方式没有什么不同提示输入密码。
请注意,
/usr/bin/numberguesser
只会在其标准输入上获取通过管道输入的字符串。未经测试,抱歉:-(
During a normal boot, the keyboard is connected to Plymouth (I believe)
On Fedora, I believe you want something like:
possibly with
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 :-(