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

install: don’t fail to remove database if not exist

This commit is contained in:
Pierre de La Morinerie 2017-09-12 17:33:48 +05:30
parent 533f10d93b
commit c51127e1eb
2 changed files with 5 additions and 3 deletions

View file

@ -60,13 +60,14 @@ ynh_app_setting_set mattermost domain "$domain"
function fail_properly
{
set +e
ynh_mysql_execute_as_root "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
# Remove database
# (DROP USER IF EXISTS is only available on MySQL >= 5.7, so we don't use it for now)
ynh_mysql_execute_as_root "DROP DATABASE IF EXISTS $db_name ; DROP USER $db_user@localhost ;"
sudo userdel mattermost
sudo rm -Rf "$final_path"
sudo rm -f "$archive_filename"
# Exit (without triggering a package_linter warning)
script_die "An error occurred during the installation."
}
trap fail_properly ERR

View file

@ -17,7 +17,8 @@ sudo rm -rf /var/www/mattermost
sudo rm -rf /home/yunohost.app/mattermost
# Remove database
ynh_mysql_execute_as_root "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
# (DROP USER IF EXISTS is only available on MySQL >= 5.7, so we don't use it for now)
ynh_mysql_execute_as_root "DROP DATABASE IF EXISTS $db_name ; DROP USER $db_user@localhost ;"
# Remove uploaded files