This commit removes the hardcoded MUMBLE_UID and MUMBLE_GID and instead
adopts the commonly used PUID and PGID environment variables for setting
the desired UID:GID for mumble-server to run as. For backwards-compatibility
they still default to 10000:10000.
Also, a new variable `MUMBLE_CHOWN_DATA` is used to define whether to chown
`/data` and its contents or not.
Fixes#34
Signed-off-by: Nita Vesa <nita.vesa@outlook.com>
Add a function to "normalize" the name of config options that will be
used, while using sed instead of grep to both retrieve and manipulate
the names of environment variables that start with MUMBLE_CONFIG_.
Remove any possible underscores from the config options when creating
keys for the associative array used to look them up after capturing
environment variables.
This is a possible regression from fc0363a.
Use Bash's associative array for the existing configuration options and
for the translation of something like "DBUSER" to "dbUser", replacing
the for loop that existed before.
Redirect multiple commands to the configuration file instead of making
multiple redirects, potentially limiting the number of times the file
needs to be opened for appending. (SC2129)
Use "${arr[*]}" not to mix array and string. (SC2145)
Remove most comments and shorten some others. Focus should be on making
code clean and immediately readable instead of documented directly in
the script file.
Remove trailing whitespace while there isn't much. This is discouraged,
since it can mess with git-blame information, but it irks me there is
trailing whitespace.
This commit might be dropped if requested during review. :(
Replace the standard POSIX test command ([]) with Bash's builtin ([[]])
for consistency.
There was a single use of the double bracket syntax, but since the
script references Bash in its shebang, we might as well use it instead
of the POSIX one.
Use grep to fetch only environment variables that start with
`MUMBLE_CONFIG_`, rather than manually compare in an if statement,
getting rid of one level of indentation.