| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #!/bin/bash
- # info: removes a theme from the custom theme library
- # options: theme
- # labels: hestia
- #
- # example: v-delete-sys-theme dark
- #
- # The function removes a theme from the custom theme library.
- # Please note "default" theme can't be deleted due to dependencies for other themes
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument definition
- theme=$1
- # Includes
- source $HESTIA/func/main.sh
- source $HESTIA/conf/hestia.conf
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- if [ -z "$theme" ]; then
- # Theme not specified, throw an error.
- echo "ERROR: No theme specified."
- exit 1
- else
- if [ -e $HESTIA_THEMES/$theme.css ]; then
- # Protect system themes from deletion
- # Users can use the terminal to work around this if really desired.
- echo "ERROR: Unable to delete system theme: $theme."
- exit 1
- fi
- if [ -e $HESTIA_THEMES_CUSTOM/$theme.css ]; then
- # Remove theme if it exists.
- echo "Deleting $theme..."
- rm -f $HESTIA_THEMES_CUSTOM/$theme.css > /dev/null 2&>1
- else
- # Theme doesn't exist, throw an error.
- echo "ERROR: Theme $theme does not exist."
- fi
- fi
- # Set default theme in configuration file if deleted theme was active
- if [ "$THEME" = "$theme" ]; then
- rm -f $HESTIA/web/css/active-theme.css
- $BIN/v-change-sys-config-value 'THEME' default
- fi
- #----------------------------------------------------------#
- # Hestia #
- #----------------------------------------------------------#
- exit
|