v-delete-sys-theme 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # info: removes a theme from the custom theme library.
  3. # options: [RESTART]
  4. #----------------------------------------------------------#
  5. # Variable&Function #
  6. #----------------------------------------------------------#
  7. # Argument definition
  8. theme=$1
  9. # Includes
  10. source $HESTIA/func/main.sh
  11. source $HESTIA/conf/hestia.conf
  12. #----------------------------------------------------------#
  13. # Action #
  14. #----------------------------------------------------------#
  15. if [ -z "$theme" ]; then
  16. # Theme not specified, throw an error.
  17. echo "ERROR: No theme specified."
  18. exit 1
  19. else
  20. if [ -e $HESTIA_THEMES/$theme.css ]; then
  21. # Protect system themes from deletion
  22. # Users can use the terminal to work around this if really desired.
  23. echo "ERROR: Unable to delete system theme: $theme."
  24. exit 1
  25. fi
  26. if [ -e $HESTIA_THEMES_CUSTOM/$theme.css ]; then
  27. # Remove theme if it exists.
  28. echo "Deleting $theme..."
  29. rm -f $HESTIA_THEMES_CUSTOM/$theme.css > /dev/null 2&>1
  30. else
  31. # Theme doesn't exist, throw an error.
  32. echo "ERROR: Theme $theme does not exist."
  33. fi
  34. fi
  35. # Set default theme in configuration file if deleted theme was active
  36. if [ "$THEME" = "$theme" ]; then
  37. rm -f $HESTIA/web/css/active-theme.css
  38. $BIN/v-change-sys-config-value 'THEME' default
  39. fi
  40. #----------------------------------------------------------#
  41. # Hestia #
  42. #----------------------------------------------------------#
  43. exit