Skip to content

Commit

Permalink
Merge pull request #893 from mitch-seymour/patch-3
Browse files Browse the repository at this point in the history
Fixed SystemVPlugin override start script behavior for debian
  • Loading branch information
kardapoltsev authored Oct 11, 2016
2 parents 7f7b8c0 + 8331ba5 commit bbeead2
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 2 deletions.
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.

0 comments on commit bbeead2

Please sign in to comment.