我正在做一些服务器供应,我需要在安装后运行脚本,因为它需要系统function齐全,包括服务。 所以我不能把它放在我的kickstart文件的%post
部分里面。
相反,我已经创build了一个systemd服务,禁用它自己作为最后一件事情。
[Unit] Description=Prepare the system after installation [Service] Type=oneshot ExecStart=/usr/bin/prepare-system [Install] WantedBy=multi-user.target
问题是,在第一次启动时,我到达login提示符,甚至可以login并开始使用系统,而“第一启动脚本”仍在运行。
这给pipe理员设置系统的幻觉系统完成,当它不是。
我反而希望服务延迟启动,最好显示一个消息,如“系统正在准备中,请稍候…”,并等待,直到脚本完成。
假设您使用GDM作为您的loginpipe理器, Before=gdm.service
在[Unit]
部分添加一行与Before=gdm.service
。
如果你不使用gdm,找出哪个服务启动xorg并把它放在Before=
行。
这将导致任务在loginpipe理器显示之前完成。
在这里find答案: https : //unix.stackexchange.com/questions/216045/systemd-configure-unit-file-so-that-login-screen-is-not-shown-until-service-exi
刚刚设置Before
到terminal可用:
[Unit] Description=Prepare the system after installation [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [Service] Type=oneshot ExecStart=/usr/bin/prepare-system [Install] WantedBy=multi-user.target