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

Implementing permissions as described in #174 #178

Merged
merged 3 commits into from
Mar 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 @@ -67,17 +67,17 @@ trait GenericPackageSettings
defaultLinuxConfigLocation := "/etc",

// First we look at the src/linux files
linuxPackageMappings <++= (sourceDirectory in Linux, daemonUser in Linux, daemonGroup in Linux) map { (dir, user, group) =>
mapGenericMappingsToLinux(MappingsHelper contentOf dir, user, group)(identity)
linuxPackageMappings <++= (sourceDirectory in Linux) map { dir =>
mapGenericMappingsToLinux(MappingsHelper contentOf dir, Users.Root, Users.Root)(identity)
},
// Now we look at the src/universal files.
linuxPackageMappings <++= (normalizedName in Universal, mappings in Universal, defaultLinuxInstallLocation, daemonUser in Linux, daemonGroup in Linux) map {
(pkg, mappings, installLocation, user, group) =>
linuxPackageMappings <++= (normalizedName in Universal, mappings in Universal, defaultLinuxInstallLocation) map {
(pkg, mappings, installLocation) =>
// TODO - More windows filters...
def isWindowsFile(f: (File, String)): Boolean =
f._2 endsWith ".bat"

mapGenericMappingsToLinux(mappings filterNot isWindowsFile, user, group) { name =>
mapGenericMappingsToLinux(mappings filterNot isWindowsFile, Users.Root, Users.Root) { name =>
installLocation + "/" + pkg + "/" + name
}
},
Expand All @@ -92,17 +92,17 @@ trait GenericPackageSettings
},
// Map configuration files
linuxPackageSymlinks <++= (normalizedName in Universal, mappings in Universal, defaultLinuxInstallLocation, defaultLinuxConfigLocation)
map { (pkg, mappings, installLocation, configLocation) =>
val needsConfLink =
mappings exists {
case (file, name) =>
(name startsWith "conf/") && !file.isDirectory
}
if (needsConfLink) Seq(LinuxSymlink(
link = configLocation + "/" + pkg,
destination = installLocation + "/" + pkg + "/conf"))
else Seq.empty
})
map { (pkg, mappings, installLocation, configLocation) =>
val needsConfLink =
mappings exists {
case (file, name) =>
(name startsWith "conf/") && !file.isDirectory
}
if (needsConfLink) Seq(LinuxSymlink(
link = configLocation + "/" + pkg,
destination = installLocation + "/" + pkg + "/conf"))
else Seq.empty
})

def mapGenericFilesToWindows: Seq[Setting[_]] = Seq(
mappings in Windows <<= mappings in Universal,
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/debian/daemon-user-deb/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) =
assert(postinst contains "addgroup --system daemongroup", "postinst misses addgroup for daemongroup: " + postinst)
assert(postinst contains "useradd --system --no-create-home --gid daemongroup --shell /bin/false daemonuser", "postinst misses useradd for daemonuser: " + postinst)
assert(postinst contains "chown daemonuser:daemongroup /var/log/debian-test", "postinst misses chown daemonuser /var/log/debian-test: " + postinst)
assert(postinst contains "chown daemonuser:daemongroup /usr/share/debian-test/bin/debian-test", "postinst misses chown daemonuser /usr/share/debian-test/bin/debian-test: " + postinst)
assert(postinst contains "chown daemonuser:daemongroup /var/run/debian-test", "postinst misses chown daemonuser /var/run/debian-test: " + postinst)
assert(!(postinst contains "addgroup --system daemonuser"), "postinst has addgroup for daemonuser: " + postinst)
assert(!(postinst contains "useradd --system --no-create-home --gid daemonuser --shell /bin/false daemonuser"), "postinst has useradd for daemongroup: " + postinst)
assert(postrm contains "deluser --quiet --system daemonuser > /dev/null || true", "postrm misses purging daemonuser user: " + postrm)
Expand Down