Browse Source

rm -rf -> ynh_secure_remove

Alexandre Aubin 6 years ago
parent
commit
fe159638f5
2 changed files with 11 additions and 12 deletions
  1. 10 11
      scripts/remove
  2. 1 1
      scripts/upgrade

+ 10 - 11
scripts/remove

@@ -31,7 +31,6 @@ source /usr/share/yunohost/helpers
 #=================================================
 
 app=$YNH_APP_INSTANCE_NAME
-
 domain=$(ynh_app_setting_get $app domain)
 
 #=================================================
@@ -43,18 +42,18 @@ sudo systemctl disable ynh-vpnclient-checker.timer
 ynh_systemctl stop ynh-vpnclient
 sudo systemctl disable ynh-vpnclient
 sudo yunohost service remove ynh-vpnclient
-sudo rm -f /etc/systemd/system/ynh-vpnclient* /usr/local/bin/ynh-vpnclient*
-sudo rm -f /tmp/.ynh-vpnclient-*
+sudo ynh_secure_remove /etc/systemd/system/ynh-vpnclient* /usr/local/bin/ynh-vpnclient*
+sudo ynh_secure_remove /tmp/.ynh-vpnclient-*
 
 # Remove confs
-sudo rm -f /etc/openvpn/client.conf{.tpl,.tpl.restore,}
-sudo rm -f /etc/nginx/conf.d/${domain}.d/${app}.conf
-sudo rm -f /etc/php5/fpm/pool.d/${app}.conf
-sudo rm -f /etc/yunohost/hooks.d/90-vpnclient.tpl
-sudo rm -f /etc/systemd/system/openvpn@.service
+sudo ynh_secure_remove /etc/openvpn/client.conf{.tpl,.tpl.restore,}
+sudo ynh_secure_remove /etc/nginx/conf.d/${domain}.d/${app}.conf
+sudo ynh_secure_remove /etc/php5/fpm/pool.d/${app}.conf
+sudo ynh_secure_remove /etc/yunohost/hooks.d/90-vpnclient.tpl
+sudo ynh_secure_remove /etc/systemd/system/openvpn@.service
 
 # Remove certificates
-sudo rm -rf /etc/openvpn/keys/
+sudo ynh_secure_remove /etc/openvpn/keys/
 
 # Remove packages
 ynh_remove_app_dependencies
@@ -64,8 +63,8 @@ sudo systemctl restart php5-fpm
 sudo systemctl reload nginx
 
 # Remove sources
-sudo rm -rf /var/www/${app}/
+sudo ynh_secure_remove "/var/www/${app}/"
 
 # Removed system user
 ynh_system_user_delete ${app}
-sudo rm -f /etc/sudoers.d/${app}_ynh
+sudo ynh_secure_remove "/etc/sudoers.d/${app}_ynh"

+ 1 - 1
scripts/upgrade

@@ -77,7 +77,7 @@ vpnclient_deploy_files_and_services "${domain}" "${app}"
 
 # Restore previously existing config files
 sudo cp -r ${tmpdir}/client* /etc/openvpn/
-sudo rm -rf ${tmpdir}
+sudo ynh_secure_remove ${tmpdir}
 
 #=================================================
 # RELOAD RELEVANT SERVICES