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

Use defaultLinuxLogsLocation for /var/log #150

Merged
merged 2 commits into from
Feb 3, 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
Expand Up @@ -88,8 +88,8 @@ object JavaServerAppPackaging {
d.mkdirs()
LinuxPackageMapping(Seq(d -> (logsDir + "/" + name)), LinuxFileMetaData(user, group))
},
linuxPackageSymlinks in Debian <+= (normalizedName, defaultLinuxInstallLocation) map {
(name, install) => LinuxSymlink(install + "/" + name + "/logs", "/var/log/" + name)
linuxPackageSymlinks in Debian <+= (normalizedName, defaultLinuxInstallLocation, defaultLinuxLogsLocation) map {
(name, install, logsDir) => LinuxSymlink(install + "/" + name + "/logs", logsDir + "/" + name)
},

// === Maintainer scripts ===
Expand Down
37 changes: 37 additions & 0 deletions src/sbt-test/debian/log-directory/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import NativePackagerKeys._
import com.typesafe.sbt.packager.archetypes.ServerLoader

packageArchetype.java_server

serverLoading in Debian := ServerLoader.Upstart

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."""

defaultLinuxLogsLocation := "/non-standard/log"

InputKey[Unit]("check-softlink") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask) map { (args: Seq[String]) =>
assert(args.size >= 2, "Usage: check-softlink link to target")
val link = args(0)
val target = args(args.size - 1)
val absolutePath = ("readlink -m " + link).!!.trim
assert(link != absolutePath,
"Expected symbolic link '" + link + "' does not exist")
assert(target == absolutePath,
"Expected symbolic link '" + link + "' to point to '" +
target + "', but instead it's '" + absolutePath + "'")
}
}
1 change: 1 addition & 0 deletions src/sbt-test/debian/log-directory/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
15 changes: 15 additions & 0 deletions src/sbt-test/debian/log-directory/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Run the debian packaging.
> debian:package-bin
$ 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

# Check that the non-standard log directory was used
$ exists target/debian-test-0.1.0/non-standard/log/debian-test
> check-softlink target/debian-test-0.1.0/usr/share/debian-test/logs points to /non-standard/log/debian-test