reset_default_system 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC STARTING
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. source scripts/_common.sh
  8. source /usr/share/yunohost/helpers
  9. #=================================================
  10. # MANAGE SCRIPT FAILURE
  11. #=================================================
  12. ynh_clean_setup () {
  13. # Clean installation remaining that are not handle by the remove script.
  14. ynh_clean_check_starting
  15. }
  16. # Exit if an error occurs during the execution of the script
  17. ynh_abort_if_errors
  18. #=================================================
  19. # RETRIEVE ARGUMENTS
  20. #=================================================
  21. app=$YNH_APP_INSTANCE_NAME
  22. type=$1
  23. domain=$(ynh_app_setting_get --app=$app --key=domain)
  24. path_url=$(ynh_app_setting_get --app=$app --key=path)
  25. final_path=$(ynh_app_setting_get --app=$app --key=final_path)
  26. #=================================================
  27. # SPECIFIC ACTION
  28. #=================================================
  29. # RESET THE CONFIG FILE
  30. #=================================================
  31. if [ $type == nginx ]; then
  32. name=Nginx
  33. elif [ $type == phpfpm ]; then
  34. name=PHP-FPM
  35. else
  36. ynh_die --message="The type $type is not recognized"
  37. fi
  38. ynh_script_progression --message="Resetting the specific configuration of $name for the app $app..." --weight=3
  39. if [ $type == nginx ]
  40. then
  41. (cd scripts; ynh_add_nginx_config)
  42. elif [ $type == phpfpm ]
  43. then
  44. (cd scripts; ynh_add_fpm_config --usage=low --footprint=low --dedicated_service)
  45. fi
  46. #=================================================
  47. # END OF SCRIPT
  48. #=================================================
  49. ynh_script_progression --message="Execution completed" --last