forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv-change-sys-theme
More file actions
47 lines (38 loc) · 1.38 KB
/
v-change-sys-theme
File metadata and controls
47 lines (38 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# info: update web templates
#
# The function for changing the currently active system theme.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
theme=$1
# Includes
source $HESTIA/func/main.sh
source $HESTIA/conf/hestia.conf
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Theme argument and file detection
if [ -z "$theme" ]; then
echo "ERROR: No theme specified."
exit 1
else
if [ -e "$HESTIA_THEMES/$theme.css" ]; then
theme_conf="$HESTIA_THEMES/$theme.css"
elif [ -e "$HESTIA_THEMES_CUSTOM/$theme.css" ]; then
theme_conf="$HESTIA_THEMES_CUSTOM/$theme.css"
else
echo "ERROR: Unable to locate specified theme."
exit 1
fi
# Replace theme override file
rm -f $HESTIA/web/css/active-theme.css
cp -f $theme_conf $HESTIA/web/css/active-theme.css
# Set default theme in configuration file
$BIN/v-change-sys-config-value 'THEME' $theme
fi
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
exit