1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zeronet_ynh.git synced 2024-09-03 17:46:12 +02:00
zeronet_ynh/scripts/remove

58 lines
1.5 KiB
Text
Raw Normal View History

2017-03-03 21:26:30 +01:00
#!/usr/bin/env bash
set -u
source /usr/share/yunohost/helpers
remove_systemd_service_() {
local service_name=$1
local service_file=$2
2020-10-22 21:15:55 +02:00
systemctl stop $service_name
systemctl disable $service_name
rm $service_file
systemctl daemon-reload
systemctl reset-failed
2017-03-03 21:26:30 +01:00
}
remove_nginx_config() {
local nginx_config_file=$1
2020-10-22 21:15:55 +02:00
ynh_secure_remove $nginx_config_file
service nginx reload
2017-03-03 21:26:30 +01:00
}
remove_user_data() {
local user_zeronet_dir=$1
2020-10-22 21:15:55 +02:00
ynh_secure_remove $user_zeronet_dir
2017-03-03 21:26:30 +01:00
}
remove_zeronet() {
local deploy_path=$1
local symlink_to_deploy_path=$2
2020-10-22 21:15:55 +02:00
ynh_secure_remove $deploy_path
ynh_secure_remove $symlink_to_deploy_path
2017-03-03 21:26:30 +01:00
}
main() {
local app=${YNH_APP_INSTANCE_NAME}
local domain=$( ynh_app_setting_get $app domain )
local user=$( ynh_app_setting_get $app admin )
local nginx_config_file=$( ynh_app_setting_get $app nginx_config_file )
local systemd_service_name=$( ynh_app_setting_get $app systemd_service_name )
local systemd_service_file=$( ynh_app_setting_get $app systemd_service_file )
local deploy_path=$( ynh_app_setting_get $app deploy_path )
local symlink_to_deploy_path=$( ynh_app_setting_get $app symlink_to_deploy_path )
local user_zeronet_dir=$( ynh_app_setting_get $app user_zeronet_dir )
if [ -n $domain ]; then
remove_nginx_config $nginx_config_file
remove_user_data $user_zeronet_dir
remove_systemd_service_ $systemd_service_name $systemd_service_file
remove_zeronet $deploy_path $symlink_to_deploy_path
fi
}
main