mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
Update remove script
This commit is contained in:
parent
23454dff02
commit
16e6e1582d
1 changed files with 69 additions and 18 deletions
|
@ -35,24 +35,44 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get $app domain)
|
||||
firmware_nonfree=$(ynh_app_setting_get $app firmware_nonfree)
|
||||
service_name=$(ynh_app_setting_get $app service_name)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if yunohost service status | grep -q $app
|
||||
if yunohost service status | grep -q $service_name
|
||||
then
|
||||
echo "Remove $app service"
|
||||
yunohost service remove $app
|
||||
ynh_print_info "Removing $app service"
|
||||
yunohost service remove $service_name
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_print_info "Stopping and removing the systemd service"
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config $service_name
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Removing dependencies"
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Removing app main directory"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
|
||||
ynh_secure_remove /usr/local/bin/$service_name
|
||||
|
||||
|
@ -61,14 +81,8 @@ do
|
|||
ynh_secure_remove "$FILE"
|
||||
done
|
||||
|
||||
# Update firewall for DHCP
|
||||
yunohost firewall disallow --ipv6 UDP 547
|
||||
yunohost firewall disallow UDP 67
|
||||
|
||||
# Remove confs
|
||||
ynh_secure_remove /etc/dnsmasq.dhcpd
|
||||
ynh_secure_remove /etc/nginx/conf.d/${domain}.d/wifiadmin.conf
|
||||
ynh_secure_remove /etc/php5/fpm/pool.d/wifiadmin.conf
|
||||
for FILE in $(ls /etc/hostapd/hostapd.conf{.tpl?,} 2>/dev/null)
|
||||
do
|
||||
ynh_secure_remove "$FILE"
|
||||
|
@ -84,14 +98,51 @@ if [[ $firmware_nonfree -eq 0 ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
ynh_remove_app_dependencies
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing nginx web server configuration"
|
||||
|
||||
# Restart services
|
||||
systemctl restart php5-fpm
|
||||
systemctl reload nginx
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
# Remove sources
|
||||
ynh_secure_remove /var/www/wifiadmin
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing php-fpm configuration"
|
||||
|
||||
# Remove user
|
||||
ynh_system_user_delete ${app}
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- 547$"
|
||||
then
|
||||
ynh_print_info "Closing port 547"
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP 547
|
||||
fi
|
||||
|
||||
|
||||
if yunohost firewall list | grep -q "\- 67$"
|
||||
then
|
||||
ynh_print_info "Closing port 67"
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP 67
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Removing the dedicated system user"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete $app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Removal of $app completed"
|
||||
|
|
Loading…
Reference in a new issue