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?
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.