remove.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. hestia_module_vsftpd_remove() {
  3. source $HESTIA/bin/module/func.inc
  4. module_installed=$(hestia_module_isinstalled ftp)
  5. if [ ! "$module_installed"] || [ "$param_force" ]; then
  6. echo "FTP module is not installed. See 'hestia module info ftp'."
  7. exit 1
  8. fi
  9. ftp_variant=$(hestia_module_getvariant ftp)
  10. if [ "$ftp_variant" != 'vsftpd' ]; then
  11. echo "The installed FTP module is not vsftpd. See 'hestia module info ftp'."
  12. exit 1
  13. fi
  14. echo "Removing FTP (vsftpd) module..."
  15. osal_service_stop vsftpd
  16. osal_service_disable vsftpd
  17. osal_package_remove vsftpd
  18. hestia_config_backup 'vsftpd-remove' $OSAL_PATH_VSFTPD_CONF/vsftpd.conf
  19. rm -f $OSAL_PATH_VSFTPD_CONF/vsftpd.conf
  20. osal_kv_write $HESTIA/conf/hestia.conf 'FTP_SYSTEM' 'no'
  21. osal_kv_write $HESTIA_CONF_MODULES/ftp.conf 'installed' '0'
  22. osal_kv_write $HESTIA_CONF_MODULES/ftp.conf 'description' ''
  23. osal_kv_write $HESTIA_CONF_MODULES/ftp.conf 'enabled' '0'
  24. osal_kv_write $HESTIA_CONF_MODULES/ftp.conf 'variant' ''
  25. osal_kv_write $HESTIA_CONF_MODULES/ftp.conf 'version' '0'
  26. exit 0
  27. }
  28. # If this files is _not_ being sourced, act immediately
  29. # (otherise, wait for hestia cli to call the main function)
  30. [[ $_ == $0 ]] && hestia_module_vsftpd_remove $@