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

defaultLinuxLogsLocation not applied to start-rpm-template #675

Merged
merged 1 commit into from
Oct 7, 2015
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 @@ -44,7 +44,7 @@ exec="$INSTALL_DIR/bin/${{exec}}"
prog="${{app_name}}"
lockfile="/var/lock/subsys/${{app_name}}"

RUN_CMD="$exec >> /var/log/${{app_name}}/${{rpm_daemon_log_file}} 2>&1 &"
RUN_CMD="$exec >> ${{logdir}}/${{app_name}}/${{rpm_daemon_log_file}} 2>&1 &"

# $JAVA_OPTS used in $exec wrapper
export JAVA_OPTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ object LinuxPlugin extends AutoPlugin {
description = (packageSummary in Linux).value,
execScript = (executableScriptName in Linux).value,
chdir = s"${defaultLinuxInstallLocation.value}/${(packageName in Linux).value}",
logdir = defaultLinuxLogsLocation.value,
appName = (packageName in Linux).value,
version = sbt.Keys.version.value,
daemonUser = (daemonUser in Linux).value,
Expand Down Expand Up @@ -155,6 +156,7 @@ object LinuxPlugin extends AutoPlugin {
description: String,
execScript: String,
chdir: String,
logdir: String,
appName: String,
version: String,
daemonUser: String,
Expand All @@ -172,6 +174,7 @@ object LinuxPlugin extends AutoPlugin {
"descr" -> description,
"exec" -> execScript,
"chdir" -> chdir,
"logdir" -> logdir,
"retries" -> retries.toString,
"retryTimeout" -> retryTimeout.toString,
"app_name" -> appName,
Expand Down
40 changes: 40 additions & 0 deletions src/sbt-test/rpm/path-override-rpm/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
enablePlugins(JavaServerAppPackaging)

name := "rpm-test"

version := "0.1.0"

maintainer := "Josh Suereth <[email protected]>"

packageSummary := "Test rpm package"

executableScriptName := "rpm-exec"

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

rpmRelease := "1"

rpmVendor := "typesafe"

rpmUrl := Some("http://github.com/sbt/sbt-native-packager")

rpmLicense := Some("BSD")

defaultLinuxInstallLocation := "/opt/test"

defaultLinuxLogsLocation := "/opt/test/log"

TaskKey[Unit]("unzip") <<= (baseDirectory, packageBin in Rpm, streams) map { (baseDir, rpmFile, streams) =>
val rpmPath = Seq(rpmFile.getAbsolutePath)
Process("rpm2cpio" , rpmPath) #| Process("cpio -i --make-directories") ! streams.log
()
}

TaskKey[Unit]("check-init-file") <<= (baseDirectory, streams) map { (target, out) =>
val initd = IO.read(target / "etc" / "init.d" / "rpm-test")
assert(initd contains "/opt/test/rpm-test", "defaultLinuxInstallLocation not overriden in init.d\n" + initd)
assert(initd contains "/opt/test/log/rpm-test/rpm-test.log", "defaultLinuxLogsLocation not overriden in init.d\n" + initd)
out.log.success("Successfully tested rpm-test file")
()
}
1 change: 1 addition & 0 deletions src/sbt-test/rpm/path-override-rpm/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"))
10 changes: 10 additions & 0 deletions src/sbt-test/rpm/path-override-rpm/src/main/scala/test/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package test

object Main {
def main (args: Array[String]) {
//server app imitation
while (true){
Thread.sleep(1000L)
}
}
}
10 changes: 10 additions & 0 deletions src/sbt-test/rpm/path-override-rpm/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run the rpm packaging.
> rpm:package-bin
$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm

> unzip
$ exists opt/test/rpm-test

$ exists etc/init.d/rpm-test
> check-init-file