-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallLinux.sh
65 lines (47 loc) · 1.5 KB
/
installLinux.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# Colors
#-----------
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
# Check if Java is installed
#-----------
if ! [ -n `which java` ]; then
echo "${RED}~~~~~~~~~~~~~~~~~~~~~~~${NC}"
echo "${RED}⚠ No Java detected! ⚠${NC}"
echo "${RED}~~~~~~~~~~~~~~~~~~~~~~~${NC}"
echo "In order to run SparkView, Java must be installed on your device. Please install Java to continue: https://jdk.java.net. It is best to use the latest production version."
exit 0
fi
# Get new SparkView release
#-----------
cd /usr/local/bin
wget -q --no-check-certificate https://www.remotespark.com/view/SparkGateway.zip
unzip -q SparkGateway.zip
rm SparkGateway.zip
VERSION=$(head -n 1 ./SparkGateway/html/release.txt | tr -d '\r')
echo "${GREEN}SparkView was downloaded successfully (${BLUE}$VERSION${GREEN})!${NC}"
# Create service file (systemd)
#-----------
echo "Creating service file ${BLUE}/etc/systemd/system/SparkView.service${NC} …"
CURRUSER="$USER"
cat << EOF > /etc/systemd/system/SparkView.service
[Unit]
Description=SparkView Service
After=network.target
[Service]
User=$CURRUSER
WorkingDirectory=/usr/local/bin/SparkGateway
ExecStart=java -jar /usr/local/bin/SparkGateway/SparkGateway.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
EOF
echo "Reloading service daemon …"
systemctl daemon-reload
echo "Enabling SparkView service …"
systemctl enable SparkView
echo "Starting SparkView …"
systemctl start SparkView
echo "${GREEN}SparkView was launched successfully!${NC}"