覆盖postinst脚本以不启动服务并注册它(Override postinst scriptlet to not start service and register it)

编程入门 行业动态 更新时间:2024-10-25 02:29:52
覆盖postinst脚本以不启动服务并注册它(Override postinst scriptlet to not start service and register it)

我正在使用SBT native packager 1.2.0-M3将Play Framework 2.5.3应用程序打包为RPM(针对带有systemd的RHEL 7)。 我想更改生成的RPM的行为,使其在安装后不会自动启动但是正在启用( systemctl enable <name>.service )。

我一直在遵循http://www.scala-sbt.org/sbt-native-packager/archetypes/java_server/customize.html中列出的说明。 具体来说,我创建了一个文件src/rpm/scriptlets/post-rpm其中包含单行systemctl enable <name>.service 。 据我了解文档,这就是所需要的。 但是,在安装RPM时,服务仍会自动启动。 是否需要其他配置?

I'm using SBT native packager 1.2.0-M3 for packaging a Play Framework 2.5.3 application as an RPM (targeted for RHEL 7 with systemd). I would like to change the behavior of the generated RPM such that it does NOT automatically start after install but is being enabled (systemctl enable <name>.service).

I've been following the instructions outlined at http://www.scala-sbt.org/sbt-native-packager/archetypes/java_server/customize.html. Specifically, I created a file src/rpm/scriptlets/post-rpm containing a single line systemctl enable <name>.service. As far as I understand the documentation, that's all that is required. However, on installation of the RPM the service gets still automatically started. Is there any additional configuration required?

最满意答案

这是当前的默认行为。 这里有一个历史的解释。

你真正需要做的是maintainerScripts in Rpm中的maintainerScripts in Rpm 。 有一个帮助器特性可以减轻构建定义。 就像是

import RpmConstants._ maintainerScripts in Rpm := { (maintainerScripts in Rpm).value += ( Post -> "systemctl enable <name>.service" ) }

并且有一个功能请求直接在native-packager中实现它。

This is currently the default behaviour. There is a historical explanation here.

What you actually need to do are the maintainerScripts in Rpm. There is a helper trait which lightens the build definition. Something like

import RpmConstants._ maintainerScripts in Rpm := { (maintainerScripts in Rpm).value += ( Post -> "systemctl enable <name>.service" ) }

And there is a feature request to implement this in native-packager directly.

更多推荐

本文发布于:2023-08-02 19:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1380004.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   Override   postinst   scriptlet   register

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!