1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/trustyhash_ynh.git synced 2024-09-04 01:15:56 +02:00
trustyhash_ynh/scripts/remove

155 lines
5.2 KiB
Text
Raw Normal View History

2022-05-05 17:51:33 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2022-05-07 02:19:01 +02:00
ynh_script_progression --message="Loading installation settings..." --weight=1
2022-05-05 17:51:33 +02:00
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
2022-05-05 18:17:16 +02:00
# port=$(ynh_app_setting_get --app=$app --key=port)
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
# db_user=$db_name
2022-05-05 17:51:33 +02:00
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
2022-05-05 18:17:16 +02:00
# datadir=$(ynh_app_setting_get --app=$app --key=datadir)
2022-05-05 17:51:33 +02:00
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
2022-05-05 18:17:16 +02:00
# if ynh_exec_warn_less yunohost service status $app >/dev/null
# then
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing $app service integration..." --weight=1
2022-05-05 18:17:16 +02:00
# yunohost service remove $app
# fi
2022-05-05 17:51:33 +02:00
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove the dedicated systemd config
2022-05-05 18:17:16 +02:00
# ynh_remove_systemd_config
2022-05-05 17:51:33 +02:00
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing logrotate configuration..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove the app-specific logrotate config
2022-05-05 18:17:16 +02:00
# ynh_remove_logrotate
2022-05-05 17:51:33 +02:00
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing the MySQL database..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove a database if it exists, along with the associated user
2022-05-05 18:17:16 +02:00
# ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
2022-05-05 17:51:33 +02:00
#=================================================
# REMOVE APP MAIN DIR
#=================================================
2022-05-07 02:19:01 +02:00
ynh_script_progression --message="Removing app main directory..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
2022-05-05 18:17:16 +02:00
# if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
# then
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing app data directory..." --weight=1
2022-05-05 18:17:16 +02:00
# ynh_secure_remove --file="$datadir"
# fi
2022-05-05 17:51:33 +02:00
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
2022-05-07 02:19:01 +02:00
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
2022-05-07 02:19:01 +02:00
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing dependencies..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove metapackage and its dependencies
2022-05-05 18:17:16 +02:00
# ynh_remove_app_dependencies
2022-05-05 17:51:33 +02:00
#=================================================
# CLOSE A PORT
#=================================================
2022-05-05 18:17:16 +02:00
# if yunohost firewall list | grep -q "\- $port$"
# then
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Closing port $port..." --weight=1
2022-05-05 18:17:16 +02:00
# ynh_exec_warn_less yunohost firewall disallow TCP $port
# fi
2022-05-05 17:51:33 +02:00
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove the dedicated Fail2Ban config
2022-05-05 18:17:16 +02:00
# ynh_remove_fail2ban_config
2022-05-05 17:51:33 +02:00
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
2022-05-07 02:19:01 +02:00
# ynh_script_progression --message="Removing various files..." --weight=1
2022-05-05 17:51:33 +02:00
# Remove a cron file
2022-05-05 18:17:16 +02:00
# ynh_secure_remove --file="/etc/cron.d/$app"
2022-05-05 17:51:33 +02:00
# Remove a directory securely
2022-05-05 18:17:16 +02:00
# ynh_secure_remove --file="/etc/$app"
2022-05-05 17:51:33 +02:00
# Remove the log files
2022-05-05 18:17:16 +02:00
# ynh_secure_remove --file="/var/log/$app"
2022-05-05 17:51:33 +02:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2022-05-07 02:19:01 +02:00
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
2022-05-05 17:51:33 +02:00
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
2022-05-07 02:19:01 +02:00
ynh_script_progression --message="Removal of $app completed" --last