Skip to content

Commit a7e8a3d

Browse files
author
Kristan Kenney
committed
Add quiet switch and refactor code
1 parent d02a9eb commit a7e8a3d

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

bin/v-update-sys-theme

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,53 @@
11
#!/bin/bash
22

3+
quiet=$1
4+
35
source $HESTIA/func/main.sh
46
source $HESTIA/conf/hestia.conf
57

6-
echo "Updating system base theme..."
7-
if [ -e "$HESTIA/web/css/styles.min.css" ]; then
8-
rm -f "$HESTIA/web/css/styles.min.css"
8+
welcome_message() {
9+
echo "********************************************************"
10+
echo "* Hestia Control Panel - User Interface Theme Updater *"
11+
echo "********************************************************"
12+
echo " This script will update the themes currently "
13+
echo " available on your system, which may include bug fixes "
14+
echo " and improvements from our development team which are "
15+
echo " intended to provide a user better experience "
16+
echo "********************************************************"
17+
echo " Proceed with theme update installation? "
18+
echo " [Y/n] "
19+
echo ""
20+
}
21+
22+
if [ "$quiet" ]; then
23+
answer="y"
24+
else
25+
welcome_message
26+
read -p "" answer
927
fi
10-
wget -qO $HESTIA/web/css/styles.min.css $HESTIA_GIT_REPO/$RELEASE_BRANCH/web/css/styles.min.css
1128

12-
echo "Updating included themes..."
13-
for themefile in `ls $HESTIA/install/deb/themes`; do
29+
if [ "$answer" = "y" ] || [ "$answer" = "Y" ] || [ "$answer" = "yes" ]; then
30+
echo ""
31+
echo "Updating system base theme..."
32+
if [ -e "$HESTIA/web/css/styles.min.css" ]; then
33+
rm -f "$HESTIA/web/css/styles.min.css"
34+
fi
35+
wget -O $HESTIA/web/css/styles.min.css $HESTIA_GIT_REPO/$RELEASE_BRANCH/web/css/styles.min.css --show-progress --progress=bar:force --limit-rate=3m
1436

15-
if [ -e $themefile ]; then
16-
rm -f $themefile
17-
fi
37+
echo "Updating included themes..."
38+
for themefile in `ls $HESTIA/install/deb/themes`; do
1839

19-
wget -qO $HESTIA_INSTALL_DIR/themes/$themefile $HESTIA_GIT_REPO/$RELEASE_BRANCH/install/deb/themes/$themefile
20-
done
40+
if [ -e $themefile ]; then
41+
rm -f $themefile
42+
fi
43+
echo "Downloading $themefile..."
44+
wget -O $HESTIA_INSTALL_DIR/themes/$themefile $HESTIA_GIT_REPO/$RELEASE_BRANCH/install/deb/themes/$themefile --show-progress --progress=bar:force --limit-rate=3m
45+
done
2146

22-
if [ "$THEME" != "default" ]; then
23-
echo "Applying updated system interface theme..."
24-
$BIN/v-change-sys-theme $THEME
25-
fi
47+
if [ "$THEME" != "default" ]; then
48+
echo "Applying updated system interface theme..."
49+
$BIN/v-change-sys-theme $THEME
50+
fi
51+
else
52+
echo "Update process aborted."
53+
fi

0 commit comments

Comments
 (0)