31d6d84433
tini [1] is a minimalistic PID 1 process. It correctly handles the special jobs which PID 1 (or a reaper process in general) needs to take care of in addition to correctly processing the relevant signals. Fixes #68. [1]: https://github.com/krallin/tini
22 lines
526 B
Bash
Executable File
22 lines
526 B
Bash
Executable File
#!/bin/bash -e
|
|
set -e
|
|
|
|
data_dir_owner="$(stat -c %u "/var/lib/prosody/")"
|
|
if [[ "$(id -u prosody)" != "$data_dir_owner" ]]; then
|
|
usermod -u "$data_dir_owner" prosody
|
|
fi
|
|
if [[ "$(stat -c %u /var/run/prosody/)" != "$data_dir_owner" ]]; then
|
|
chown "$data_dir_owner" /var/run/prosody/
|
|
fi
|
|
|
|
if [[ "$1" != "prosody" ]]; then
|
|
exec tini -- prosodyctl "$@"
|
|
exit 0;
|
|
fi
|
|
|
|
if [[ "$LOCAL" && "$PASSWORD" && "$DOMAIN" ]]; then
|
|
prosodyctl register "$LOCAL" "$DOMAIN" "$PASSWORD"
|
|
fi
|
|
|
|
exec tini -- runuser -u prosody -- "$@"
|