mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
67 lines
2.1 KiB
Bash
67 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression "Loading installation settings..."
|
|
|
|
db_name=$(ynh_app_setting_get --key=db_name)
|
|
db_user=$db_name
|
|
|
|
#=================================================
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
# REMOVE SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
ynh_script_progression "Removing system configurations related to $app..."
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
|
then
|
|
ynh_script_progression "Removing $app service integration..."
|
|
yunohost service remove $app
|
|
fi
|
|
|
|
# Remove the dedicated systemd config
|
|
ynh_config_remove_systemd
|
|
|
|
# Remove the app-specific logrotate config
|
|
ynh_config_remove_logrotate
|
|
|
|
if [ -d "/tmp/ufs" ]; then
|
|
ynh_safe_rm "/tmp/ufs"
|
|
fi
|
|
|
|
# Remove the dedicated NGINX config
|
|
ynh_config_remove_nginx
|
|
|
|
# Remove metapackage and its dependencies
|
|
ynh_nodejs_remove
|
|
|
|
#=================================================
|
|
# REMOVE THE MONGODB DATABASE
|
|
#=================================================
|
|
ynh_script_progression "Removing the MongoDB database..."
|
|
|
|
ynh_replace --match="engine: wiredTiger" --replace="# engine:" --file="/etc/mongod.conf"
|
|
ynh_replace --match="replication:" --replace="#replication:" --file="/etc/mongod.conf"
|
|
ynh_replace --match=" replSetName: rs01" --replace="" --file="/etc/mongod.conf"
|
|
|
|
ynh_systemctl --service=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --wait_until="Waiting for connections"
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
|
|
|
# Remove mongod service
|
|
yunohost service remove mongod
|
|
ynh_safe_rm "/var/lib/mongodb"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Removal of $app completed"
|