1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00

migration: execute under the proper user

This commit is contained in:
Pierre de La Morinerie 2023-05-26 10:28:28 +02:00
parent fb3aed0add
commit 2332871fa2

View file

@ -15,6 +15,7 @@ mariadb-to-pg() {
ynh_print_info --message="Migrating to PostgreSQL database..."
username=$app
mysqlpwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
# In old instance db_user is `mmuser`
@ -35,7 +36,7 @@ mariadb-to-pg() {
pushd $final_path
ynh_systemd_action --service_name="$app" --action="stop"
set +e
sudo -u mattermost timeout --preserve-status 300 "./bin/mattermost"
sudo -u "$username" timeout --preserve-status 300 "./bin/mattermost"
if [ "$?" != "0" ] && [ "$?" != "143" ] ; then
ynh_die --message="Failed to run Mattermost to create PostgreSQL database tables" --ret_code=1
fi