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

Fixed SystemVPlugin override start script behavior for debian #893

Merged
merged 1 commit into from
Oct 11, 2016
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
Expand Up @@ -53,7 +53,7 @@ object SystemVPlugin extends AutoPlugin {
Seq(
// set the template
linuxStartScriptTemplate := linuxStartScriptUrl(
(sourceDirectory in Compile).value,
sourceDirectory.value,
serverLoading.value,
"start-debian-template"
)
Expand Down
25 changes: 25 additions & 0 deletions src/sbt-test/debian/override-start-script-systemd/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
enablePlugins(JavaServerAppPackaging, JDebPackaging, SystemdPlugin)

// TODO change this after #437 is fixed
daemonUser in Linux := "root"
daemonGroup in Linux := "app-group"

mainClass in Compile := Some("empty")

name := "debian-test"
version := "0.1.0"
maintainer := "Mitch Seymour <[email protected]>"

packageSummary := "Test debian package"
packageDescription := """A fun package description of our software,
with multiple lines."""

TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) =>
val extracted = target / "tmp" / "extracted-package"
extracted.mkdirs()
Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).!

val script = IO.read(extracted / "lib" / "systemd" / "system" / "debian-test.service")
assert(script.startsWith("# right systemd template"), s"override script wasn't picked, script is\n$script")
()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# check that old start template isn't picked
# wrong systemd start template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# right systemd template
25 changes: 25 additions & 0 deletions src/sbt-test/debian/override-start-script-systemv/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
enablePlugins(JavaServerAppPackaging, JDebPackaging, SystemVPlugin)

// TODO change this after #437 is fixed
daemonUser in Linux := "root"
daemonGroup in Linux := "app-group"

mainClass in Compile := Some("empty")

name := "debian-test"
version := "0.1.0"
maintainer := "Mitch Seymour <[email protected]>"

packageSummary := "Test debian package"
packageDescription := """A fun package description of our software,
with multiple lines."""

TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) =>
val extracted = target / "tmp" / "extracted-package"
extracted.mkdirs()
Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).!

val script = IO.read(extracted / "etc" / "init.d" / "debian-test")
assert(script.startsWith("# right systemv template"), s"override script wasn't picked, script is\n$script")
()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# check that old start template isn't picked
# wrong systemv start template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# right systemv template
6 changes: 6 additions & 0 deletions src/sbt-test/debian/override-start-script-systemv/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Run the debian packaging.
> debian:packageBin
$ exists target/debian-test_0.1.0_all.deb

# Check files for defaults
> check-startup-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
6 changes: 6 additions & 0 deletions src/sbt-test/debian/override-start-script-upstart/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Run the debian packaging.
> debian:packageBin
$ exists target/debian-test_0.1.0_all.deb

# Check files for defaults
> check-startup-script

This file was deleted.