Skip to content

Commit

Permalink
/var/log/app_name permissions fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kardapoltsev committed Dec 18, 2013
1 parent 72e38aa commit 474c98f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ trait GenericPackageSettings

// Default place to install code.
defaultLinuxInstallLocation := "/usr/share",
defaultLinuxLogsLocation := "/var/log",

// First we look at the src/linux files
linuxPackageMappings <++= (sourceDirectory in Linux) map { dir =>
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/com/typesafe/sbt/packager/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ object Keys extends linux.Keys
| APP_DEFINES - the defines to go into the app
| """.stripMargin)
val defaultLinuxInstallLocation = SettingKey[String]("defaultLinuxInstallLocation", "The location where we will install generic linux packages.")
val defaultLinuxLogsLocation = SettingKey[String]("defaultLinuxLogsLocation", "The location where application logs will be stored.")
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ object JavaServerAppPackaging {
s <- script.toSeq
} yield LinuxPackageMapping(Seq(s -> path)).withPerms(permissions)
},
// TODO the /var/log should be generalized like defaultLinuxInstallLocation
linuxPackageMappings in Debian <+= (normalizedName) map {
name => packageTemplateMapping("/var/log/" + name)()
// TODO should we specify daemonGroup in configs?
linuxPackageMappings in Debian <+= (normalizedName, defaultLinuxLogsLocation, target in Debian, daemonUser in Debian) map {
(name, logsDir, target, user) =>
// create empty var/log directory
val d = target / logsDir
d.mkdirs()
LinuxPackageMapping(Seq(d -> s"$logsDir/$name"), LinuxFileMetaData(user, user))
},
linuxPackageSymlinks in Debian <+= (normalizedName, defaultLinuxInstallLocation) map {
(name, install) => LinuxSymlink(install + "/" + name + "/logs", "/var/log/" + name)
Expand Down

0 comments on commit 474c98f

Please sign in to comment.