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:
parent
533f10d93b
commit
c51127e1eb
2 changed files with 5 additions and 3 deletions
|
@ -60,13 +60,14 @@ ynh_app_setting_set mattermost domain "$domain"
|
||||||
function fail_properly
|
function fail_properly
|
||||||
{
|
{
|
||||||
set +e
|
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 userdel mattermost
|
||||||
sudo rm -Rf "$final_path"
|
sudo rm -Rf "$final_path"
|
||||||
sudo rm -f "$archive_filename"
|
sudo rm -f "$archive_filename"
|
||||||
|
|
||||||
# Exit (without triggering a package_linter warning)
|
|
||||||
script_die "An error occurred during the installation."
|
script_die "An error occurred during the installation."
|
||||||
}
|
}
|
||||||
trap fail_properly ERR
|
trap fail_properly ERR
|
||||||
|
|
|
@ -17,7 +17,8 @@ sudo rm -rf /var/www/mattermost
|
||||||
sudo rm -rf /home/yunohost.app/mattermost
|
sudo rm -rf /home/yunohost.app/mattermost
|
||||||
|
|
||||||
# Remove database
|
# 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
|
# Remove uploaded files
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue