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

Fix #98 java server type includes /etc/default by default #140

Merged
merged 2 commits into from
Jan 30, 2014
Merged
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,34 @@
#Some start script options could be overridden here
#RUN_OPTS=""
#DAEMON_USER=""
#JAVA_CMD=""
# #################################
# ##### Default configuration #####
# #################################

# Available replacements
# ------------------------------------------------
# ${{author}} debian author
# ${{descr}} debian package description
# ${{exec}} startup script name
# ${{chdir}} app directory
# ${{retries}} retries for startup
# ${{retryTimeout}} retry timeout
# ${{app_name}} normalized app name
# ${{daemon_user}} daemon user
# -------------------------------------------------

# Setting -Xmx and -Xms in Megabyte
# -mem 1024

# Setting -X directly (-J is stripped)
# -J-X
# -J-Xmx1024

# Add additional jvm parameters
# -Dkey=val

# For play applications you may set
# -Dpidfile.path=/var/run/${{app_name}}.pid

# Turn on JVM debugging, open at the given port
# -jvm-debug <port>

# Don't run the java version check
# -no-version-check
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ object JavaServerAppPackaging {
},

// === etc config mapping ===
bashScriptConfigLocation <<= normalizedName map (name => Some("/etc/default/" + name)),
linuxEtcDefaultTemplate in Debian <<= sourceDirectory map { dir =>
val overrideScript = dir / "templates" / "etc-default"
if (overrideScript.exists) overrideScript.toURI.toURL
else etcDefaultTemplateSource
},
debianMakeEtcDefault <<= (normalizedName, target in Universal, serverLoading in Debian, linuxEtcDefaultTemplate in Debian)
debianMakeEtcDefault <<= (normalizedName, target in Universal, linuxEtcDefaultTemplate in Debian, debianScriptReplacements)
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 @@ -106,15 +107,10 @@ object JavaServerAppPackaging {
}
}

protected def makeEtcDefaultScript(name: String, tmpDir: File, loader: ServerLoader, source: java.net.URL): Option[File] = {
loader match {
case Upstart => None
case SystemV => {
val scriptBits = TemplateWriter.generateScript(source, Seq.empty)
val script = tmpDir / "tmp" / "etc" / "default" / name
IO.write(script, scriptBits)
Some(script)
}
}
protected def makeEtcDefaultScript(name: String, tmpDir: File, source: java.net.URL, replacements: Seq[(String, String)]): Option[File] = {
val scriptBits = TemplateWriter.generateScript(source, replacements)
val script = tmpDir / "tmp" / "etc" / "default" / name
IO.write(script, scriptBits)
Some(script)
}
}
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 @@ -3,4 +3,5 @@
$ exists target/debian-test-0.1.0.deb

$ exists target/debian-test-0.1.0/etc
$ exists target/debian-test-0.1.0/etc/default/debian-test
$ exists target/debian-test-0.1.0/etc/init.d/debian-test
2 changes: 2 additions & 0 deletions src/sbt-test/debian/upstart-deb/test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
$ exists target/debian-test-0.1.0.deb

$ exists target/debian-test-0.1.0/etc
$ exists target/debian-test-0.1.0/etc/default/debian-test
$ exists target/debian-test-0.1.0/etc/init/debian-test.conf

# Check defaults
$ exists target/debian-test-0.1.0/DEBIAN/prerm
$ exists target/debian-test-0.1.0/DEBIAN/postinst
Expand Down