mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
50 lines
1.5 KiB
Bash
Executable file
50 lines
1.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS
|
|
#=================================================
|
|
|
|
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
|
|
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
|
|
|
#=================================================
|
|
# CHECK IF ARGUMENTS ARE CORRECT
|
|
#=================================================
|
|
|
|
#=================================================
|
|
# CHECK IF AN ACTION HAS TO BE DONE
|
|
#=================================================
|
|
|
|
if [ $with_mysql -eq 0 ]
|
|
then
|
|
ynh_die --message="There's no database to remove." --ret_code=0
|
|
fi
|
|
|
|
#=================================================
|
|
# SPECIFIC ACTION
|
|
#=================================================
|
|
# REMOVE THE DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Removing the database..." --weight=9
|
|
|
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
|
|
|
|
# Update the config of the app
|
|
ynh_app_setting_set --app=$app --key=with_mysql --value=0
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Execution completed" --last
|