Skip to content

Commit ba3c7b9

Browse files
author
Kristan Kenney
authored
Add function to install NodeJS before update (hestiacp#3779)
1 parent 7a1edac commit ba3c7b9

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

bin/v-update-sys-hestia-git

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,28 @@ source /etc/hestiacp/hestia.conf
2020
source $HESTIA/func/main.sh
2121
# load config file
2222
source_conf "$HESTIA/conf/hestia.conf"
23+
# define NodeJS version for download (required for building JS/CSS)
24+
nodejs_ver="20"
2325

2426
# Perform verification if read-only mode is enabled
2527
check_hestia_demo_mode
2628

29+
# Detect and install NodeJS if necessary
2730
if [ -z $(which "node") ]; then
28-
echo "Unable to locate Node.js See https://hestiacp.com/docs/contributing/development.html"
29-
exit 0
31+
read -p "NodeJS not found. Install now to proceed? [Y/n] " answer
32+
if [ "$answer" = 'y' ] || [ "$answer" = 'Y' ]; then
33+
if [ "$OS_TYPE" = "Debian" ]; then
34+
# Debian
35+
curl -fsSL "https://deb.nodesource.com/setup_$nodejs_ver.x" | bash - &&\
36+
apt-get install -y nodejs
37+
else
38+
# Ubuntu
39+
curl -fsSL "https://deb.nodesource.com/setup_$nodejs_ver.x" | sudo -E bash - &&\
40+
sudo apt-get install -y nodejs
41+
fi
42+
else
43+
exit 0
44+
fi
3045
fi
3146

3247
# Define download function

0 commit comments

Comments
 (0)