Fix mod_posix error if prosody user ID was altered

This fixes the following mod_posix error:

Couldn't write pidfile at /var/run/prosody/prosody.pid;
/var/run/prosody/prosody.pid: Permission denied
This commit is contained in:
selurvedu 2021-01-16 15:28:34 +00:00 committed by Kim Alvefur
parent 3a21cd2c21
commit 0555dc16c9

View file

@ -1,7 +1,13 @@
#!/bin/bash
set -e
usermod -u "$(stat -c %u /var/lib/prosody/.)" prosody
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 prosodyctl "$@"