fix(openrc): preserve migration execution context

This commit is contained in:
Lain Soykaf 2026-07-29 15:02:16 +04:00
commit 8943ab8140
No known key found for this signature in database
2 changed files with 4 additions and 6 deletions

View file

@ -39,7 +39,8 @@ depend() {
start_pre() {
ebegin "running migrations if any"
su -s /bin/sh -c '/usr/bin/mix ecto.migrate' -l "${command_user}"
su -s /bin/sh -c "cd \"${directory}\" && exec /usr/bin/mix ecto.migrate" \
"${command_user%%:*}"
eend "$?"
}

View file

@ -16,10 +16,6 @@ retry="SIGTERM/30/SIGKILL/5"
pidfile="/var/run/pleroma.pid"
# Needs OpenRC >= 0.42
respawn_max=200
respawn_period=86400 # 1*day
depend() {
want nginx
need postgresql
@ -27,6 +23,7 @@ depend() {
start_pre() {
ebegin "running migrations if any"
su -s /bin/sh -c '/opt/pleroma/bin/pleroma_ctl migrate' -l "${command_user}"
su -s /bin/sh -c "cd \"${directory}\" && exec /opt/pleroma/bin/pleroma_ctl migrate" \
"${command_user%%:*}"
eend "$?"
}