2022-04-19 20:31:41 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
|
|
#=================================================
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Stopping and removing the systemd service..."
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-chat" >/dev/null
|
2022-04-19 20:31:41 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-chat service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-chat"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-clsi" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-clsi service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-clsi"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-contacts" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-contacts service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-contacts"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-docstore" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-docstore service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-docstore"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-document-updater" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-document-updater service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-document-updater"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-filestore" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-filestore service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-filestore"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-history-v1" >/dev/null
|
2023-11-22 15:12:51 +01:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-history-v1 service integration..."
|
2023-11-22 15:12:51 +01:00
|
|
|
yunohost service remove "$app-history-v1"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-notifications" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-notifications service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-notifications"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-project-history" >/dev/null
|
2023-11-22 15:12:51 +01:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-project-history service integration..."
|
2023-11-22 15:12:51 +01:00
|
|
|
yunohost service remove "$app-project-history"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-real-time" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-real-time service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-real-time"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-spelling" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-spelling service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-spelling"
|
|
|
|
fi
|
2024-08-31 01:13:07 +02:00
|
|
|
if ynh_hide_warnings yunohost service status "$app-web" >/dev/null
|
2022-04-23 19:59:10 +02:00
|
|
|
then
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing $app-web service integration..."
|
2022-04-23 19:59:10 +02:00
|
|
|
yunohost service remove "$app-web"
|
2022-04-19 20:31:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
|
|
|
# Remove the dedicated systemd config
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_config_remove_systemd"$app-chat"
|
|
|
|
ynh_config_remove_systemd"$app-clsi"
|
|
|
|
ynh_config_remove_systemd"$app-contacts"
|
|
|
|
ynh_config_remove_systemd"$app-docstore"
|
|
|
|
ynh_config_remove_systemd"$app-document-updater"
|
|
|
|
ynh_config_remove_systemd"$app-filestore"
|
|
|
|
ynh_config_remove_systemd"$app-history-v1"
|
|
|
|
ynh_config_remove_systemd"$app-notifications"
|
|
|
|
ynh_config_remove_systemd"$app-project-history"
|
|
|
|
ynh_config_remove_systemd"$app-real-time"
|
|
|
|
ynh_config_remove_systemd"$app-spelling"
|
|
|
|
ynh_config_remove_systemd"$app-web"
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
|
|
#=================================================
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing logrotate configuration..."
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
# Remove the app-specific logrotate config
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_config_remove_logrotate
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-04-23 19:59:10 +02:00
|
|
|
# REMOVE THE MONGODB DATABASE
|
2022-04-19 20:31:41 +02:00
|
|
|
#=================================================
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing the MongoDB database..."
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
# Remove a database if it exists, along with the associated user
|
2022-04-23 19:59:10 +02:00
|
|
|
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
2022-04-19 20:31:41 +02:00
|
|
|
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_replace --match="replication:" --replace="#replication:" --file="/etc/mongod.conf"
|
|
|
|
ynh_replace --match=" replSetName: rs0" --replace="" --file="/etc/mongod.conf"
|
2024-02-15 15:36:46 +01:00
|
|
|
|
2022-04-19 20:31:41 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing NGINX web server configuration..."
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
# Remove the dedicated NGINX config
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_config_remove_nginx
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removing dependencies..."
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
# Remove metapackage and its dependencies
|
2022-04-23 19:59:10 +02:00
|
|
|
ynh_remove_mongo
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_nodejs_remove
|
2022-04-19 20:31:41 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 01:13:07 +02:00
|
|
|
ynh_script_progression "Removal of $app completed"
|