Une tentative de paquetage d'Invidious pour YunoHost
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
4.0KB

  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. source _common.sh
  8. source /usr/share/yunohost/helpers
  9. #=================================================
  10. # LOAD SETTINGS
  11. #=================================================
  12. ynh_print_info "Loading installation settings..."
  13. app=$YNH_APP_INSTANCE_NAME
  14. domain=$(ynh_app_setting_get $app domain)
  15. port=$(ynh_app_setting_get $app port)
  16. db_name=$(ynh_app_setting_get $app db_name)
  17. db_user=$db_name
  18. final_path=$(ynh_app_setting_get $app final_path)
  19. #=================================================
  20. # STANDARD REMOVE
  21. #=================================================
  22. # REMOVE SERVICE FROM ADMIN PANEL
  23. #=================================================
  24. # Remove a service from the admin panel, added by `yunohost service add`
  25. if yunohost service status $app >/dev/null 2>&1
  26. then
  27. ynh_print_info "Removing $app service"
  28. yunohost service remove $app
  29. fi
  30. #=================================================
  31. # STOP AND REMOVE SERVICE
  32. #=================================================
  33. ynh_print_info "Stopping and removing the systemd service"
  34. # Remove the dedicated systemd config
  35. ynh_remove_systemd_config
  36. #=================================================
  37. # REMOVE THE MYSQL DATABASE
  38. #=================================================
  39. #ynh_print_info "Removing the MySQL database"
  40. # Remove a database if it exists, along with the associated user
  41. #ynh_mysql_remove_db $db_user $db_name
  42. #=================================================
  43. # REMOVE THE POSTGRESQL DATABASE
  44. #=================================================
  45. ynh_print_info "Removing the PostgreSQL database"
  46. ynh_psql_remove_db --db_user=kemal --db_name=invidious
  47. ynh_psql_remove_db --db_user=invidious --db_name=invidious
  48. ynh_psql_remove_db --db_user=kemal --db_name=kemal
  49. ynh_psql_remove_db --db_user=invidious --db_name=kemal
  50. #=================================================
  51. # REMOVE DEPENDENCIES
  52. #=================================================
  53. ynh_print_info "Removing dependencies"
  54. # Remove metapackage and its dependencies
  55. ynh_remove_app_dependencies
  56. #=================================================
  57. # REMOVE APP MAIN DIR
  58. #=================================================
  59. ynh_print_info "Removing app main directory"
  60. # Remove the app directory securely
  61. ynh_secure_remove --file=/var/www/invidious
  62. #=================================================
  63. # REMOVE NGINX CONFIGURATION
  64. #=================================================
  65. ynh_print_info "Removing nginx web server configuration"
  66. # Remove the dedicated nginx config
  67. ynh_remove_nginx_config
  68. #=================================================
  69. # REMOVE LOGROTATE CONFIGURATION
  70. #=================================================
  71. ynh_print_info "Removing logrotate configuration"
  72. # Remove the app-specific logrotate config
  73. ynh_remove_logrotate
  74. #=================================================
  75. # CLOSE A PORT
  76. #=================================================
  77. if yunohost firewall list | grep -q "\- $port$"
  78. then
  79. ynh_print_info "Closing port $port"
  80. ynh_exec_warn_less yunohost firewall disallow TCP $port
  81. fi
  82. #=================================================
  83. # SPECIFIC REMOVE
  84. #=================================================
  85. # REMOVE THE CRON FILE
  86. #=================================================
  87. # Remove a cron file
  88. ynh_secure_remove "/etc/cron.d/$app"
  89. # Remove a directory securely
  90. ynh_secure_remove "/etc/$app/"
  91. # Remove the log files
  92. ynh_secure_remove "/var/log/$app/"
  93. #=================================================
  94. # GENERIC FINALIZATION
  95. #=================================================
  96. # REMOVE DEDICATED USER
  97. #=================================================
  98. ynh_print_info "Removing the dedicated system user"
  99. # Delete a system user
  100. ynh_system_user_delete $app
  101. #=================================================
  102. # END OF SCRIPT
  103. #=================================================
  104. ynh_print_info "Removal of $app completed"