Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run options added to /etc/default/app_name from javaOptions in run #134

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Some start script options could be overridden here
#RUN_OPTS=""
RUN_OPTS="${{run_opts}}"
#DAEMON_USER=""
#JAVA_CMD=""
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/sbt-test/debian/sysvinit-deb/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ packageSummary := "Test debian package"
packageDescription := """A fun package description of our software,
with multiple lines."""

javaOptions in run ++= Seq("-d64")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in the etc script (and only for SystemV packages), should this instead be javaOptions in Debian or systemVJavaOptions?

Unless the setting is ubiquitous across platforms, I'd like to use a more specific name, I think....

1 change: 1 addition & 0 deletions src/sbt-test/debian/sysvinit-deb/test
Original file line number Diff line number Diff line change
Expand Up @@ -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