Search code examples
sbt-native-packager

Replace debian control scripts in native packer


I'm trying to override the debain control scripts generated by the sbt native packer plugin. Allas, the plugin only allows me to append to the generated scripts. Instead of appending I want/need to replace some of the scripts. Does anyone know how?


Solution

  • There are settings for all supported control scripts you can override. For example debianControlFile or debianMakePreinstScript.

    The DebianPlugin provides some defaults. If you are using an archetype you get some extras. The server archetype overrides some tasks to provide other mappings.

    UPDATE

    The behaviour works as I described. However this is for sbt-native-packager 1.0.0-RC1. This means

    1. Add addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1") to your plugins.sbt

    2. Remove everything debian script stuff from your build.sbt

    3. Add your debian scripts (like you did) in the src/debian/DEBIAN folder. They will override the standard ones.

    So your build.sbt will look like this

    import com.typesafe.sbt.packager.archetypes.ServerLoader.SystemV
    
    name := """play-debian-ctrl"""
    
    version := "1.0-SNAPSHOT"
    
    lazy val root = (project in file("."))
      .enablePlugins(PlayScala, JDebPackaging)
    
    daemonUser in Linux := "sometest"
    serverLoading in Debian := SystemV
    maintainer in Debian := "Jan Friderici <jnfrd@outlook.com>"
    packageSummary := "Some More Tests"
    packageDescription := """Even much more test, or text?."""
    
    scalaVersion := "2.11.1"
    
    libraryDependencies ++= Seq(
      jdbc,
      anorm,
      cache,
      ws
    )