-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[systemV] variables for term and kill timeouts
- Loading branch information
Showing
6 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import com.typesafe.sbt.packager.archetypes.ServerLoader | ||
|
||
enablePlugins(JavaServerAppPackaging) | ||
|
||
serverLoading in Debian := ServerLoader.SystemV | ||
|
||
daemonUser in Debian := "root" | ||
|
||
mainClass in Compile := Some("empty") | ||
|
||
name := "debian-test" | ||
|
||
version := "0.1.0" | ||
|
||
maintainer := "Josh Suereth <[email protected]>" | ||
|
||
packageSummary := "Test debian package" | ||
|
||
packageDescription := """A fun package description of our software, | ||
with multiple lines.""" | ||
|
||
requiredStartFacilities := Some("$test-service") | ||
|
||
requiredStartFacilities in Debian := Some("$test-deb-service") | ||
|
||
termTimeout := 10 | ||
|
||
killTimeout := 20 | ||
|
||
TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => | ||
val header = "#!/bin/sh" | ||
val debian = target / "debian-test-0.1.0" / "DEBIAN" | ||
val postinst = IO.read(debian / "postinst") | ||
val postrm = IO.read(debian / "postrm") | ||
Seq(postinst, postrm) foreach { script => | ||
assert(script.startsWith(header), "script doesn't start with #!/bin/sh header:\n" + script) | ||
assert(header.r.findAllIn(script).length == 1, "script contains more than one header line:\n" + script) | ||
} | ||
out.log.success("Successfully tested systemV control files") | ||
() | ||
} | ||
|
||
TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => | ||
val script = IO.read(target / "debian-test-0.1.0" / "etc" / "init.d" / "debian-test") | ||
assert(script.contains("# Default-Start: 2 3 4 5"), "script doesn't contain Default-Start header\n" + script) | ||
assert(script.contains("# Default-Stop: 0 1 6"), "script doesn't contain Default-Stop header\n" + script) | ||
assert(script.contains("# Required-Start: $test-deb-service"), "script doesn't contain Required-Start header\n" + script) | ||
assert(script.contains("# Required-Stop: $remote_fs $syslog"), "script doesn't contain Required-Stop header\n" + script) | ||
assert(script.contains("--retry=TERM/10/KILL/20"), "script doesn't contains stop timeouts\n" + script) | ||
out.log.success("Successfully tested systemV start up script") | ||
() | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/debian/sysvinit-stoptimeouts-deb/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Run the debian packaging. | ||
> debian:package-bin | ||
$ exists target/debian-test_0.1.0_all.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 | ||
|
||
> check-control-files | ||
> check-startup-script |