sbt/sbt-native-packager — pull request #174 by muuki88 (2014-02-23 20:15:36+00:00)
Title: Wip/server permissions

## DONE

This is a follow up to #170 discussions. The current state of the pull request contains

* Replacing all traces of `appUser` and `appGroup` with `daemonUser` and `daemonGroup`
* Using the new `MappingsHelper`
* Added `defaultLinuxConfigLocation`

## TODO

Think of a way to create a _permissions-table_ like this

| Folder | User | Permissions | Purpose |
|----------|-------|-----------------|------------|
| /usr/share/_package-name_ | root | 755 / (655) | static, non-changeable files |
| /etc/default/_package-name.conf_ | root | 644 | default config file |
| /etc/_package-name_ | root | 644 | config folder -> link to /usr/share/_package-name_/conf |
| /var/run/_package-name_ | daemonUser | 664 | if the application generates a pid on its own |
| /var/log/_package-name_ | daemonUser | 664 | log folder -> symlinked from /usr/share/_package-name_/log |

### Option 1: mapping-files-changer

A small API to change permissions for _already-created_ mappings.

| Pro | Contra |
|------|----------|
| Add-in, currenty behaviour doesn't need to be changed | `LinuxPackageMappings` may need to be split, as they contain a sequence of mappings |
| easy API, e.g. `changePermissions(for = "/usr/share", LinuxFileMetaData(user = "daemonUser"))` | No place to lookup _defaults|

### Option 2: creating a permissions table

The idea is to define a setting, which can be queries for _default permissions_, like

```scala
val meta: LinuxFileMetaData = permissionsFor "/usr/share"
```

| Pro | Contra |
|------|----------|
| defaults can be easily overidden | checked before each mapping is created |
| one place for defaults | permission table for _dirs_, _files_ and maybe more |

## Discussion

@aparkinson, @jsuereth, @kardapoltsev . What do you think?