reset_default_system 1.8 KB

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