diff --git a/src/main/resources/com/typesafe/sbt/packager/archetypes/etc-default-template b/src/main/resources/com/typesafe/sbt/packager/archetypes/etc-default-template index 2cd74fe08..31ddeabe9 100644 --- a/src/main/resources/com/typesafe/sbt/packager/archetypes/etc-default-template +++ b/src/main/resources/com/typesafe/sbt/packager/archetypes/etc-default-template @@ -1,4 +1,4 @@ #Some start script options could be overridden here -#RUN_OPTS="" +RUN_OPTS="${{run_opts}}" #DAEMON_USER="" #JAVA_CMD="" \ No newline at end of file diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala index 6ebf4e822..9bb2284f5 100644 --- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala +++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala @@ -4,7 +4,7 @@ package archetypes import Keys._ import sbt._ -import sbt.Keys.{ target, mainClass, normalizedName, sourceDirectory } +import sbt.Keys.{ target, mainClass, normalizedName, sourceDirectory, javaOptions, run} import SbtNativePackager._ import com.typesafe.sbt.packager.linux.{ LinuxFileMetaData, LinuxPackageMapping, LinuxSymlink, LinuxPlugin } import com.typesafe.sbt.packager.debian.DebianPlugin @@ -75,7 +75,7 @@ object JavaServerAppPackaging { if (overrideScript.exists) overrideScript.toURI.toURL else etcDefaultTemplateSource }, - debianMakeEtcDefault <<= (normalizedName, target in Universal, serverLoading in Debian, linuxEtcDefaultTemplate in Debian) + debianMakeEtcDefault <<= (normalizedName, target in Universal, serverLoading in Debian, linuxEtcDefaultTemplate in Debian, javaOptions in run) map makeEtcDefaultScript, linuxPackageMappings in Debian <++= (debianMakeEtcDefault, normalizedName) map { (conf, name) => conf.map(c => LinuxPackageMapping(Seq(c -> ("/etc/default/" + name))).withConfig()).toSeq @@ -109,11 +109,11 @@ object JavaServerAppPackaging { } } - protected def makeEtcDefaultScript(name: String, tmpDir: File, loader: ServerLoader, source: java.net.URL): Option[File] = { + protected def makeEtcDefaultScript(name: String, tmpDir: File, loader: ServerLoader, source: java.net.URL, javaOpts: Seq[String]): Option[File] = { loader match { case Upstart => None case SystemV => { - val scriptBits = TemplateWriter.generateScript(source, Seq.empty) + val scriptBits = TemplateWriter.generateScript(source, Seq("run_opts" -> javaOpts.mkString(" "))) val script = tmpDir / "tmp" / "etc" / "default" / name IO.write(script, scriptBits) Some(script) diff --git a/src/sbt-test/debian/sysvinit-deb/build.sbt b/src/sbt-test/debian/sysvinit-deb/build.sbt index aae500ea3..7e3657bab 100644 --- a/src/sbt-test/debian/sysvinit-deb/build.sbt +++ b/src/sbt-test/debian/sysvinit-deb/build.sbt @@ -20,3 +20,4 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" +javaOptions in run ++= Seq("-d64") diff --git a/src/sbt-test/debian/sysvinit-deb/test b/src/sbt-test/debian/sysvinit-deb/test index b7ae637c9..2e8dffe41 100644 --- a/src/sbt-test/debian/sysvinit-deb/test +++ b/src/sbt-test/debian/sysvinit-deb/test @@ -4,3 +4,4 @@ $ exists target/debian-test-0.1.0.deb $ exists target/debian-test-0.1.0/etc $ exists target/debian-test-0.1.0/etc/init.d/debian-test +$ exists target/debian-test-0.1.0/etc/default/debian-test