forked from seawolfiot/seawolf.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·83 lines (63 loc) · 1.45 KB
/
install
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
################################
#
# install seawolf.io.service
#
# By Sam Wen @ 10/27/2018
#
################################
set -e
if [ "$(id -u)" -ne 0 ] ; then
echo "This script must run under root."
exit 1
fi
SYSTEMCTL=$(which systemctl)
if [ -z "$SYSTEMCTL" ]; then
echo "Unable to find systemctl."
exit 1
fi
CURL_BIN=$(which curl)
if [ -z "$CURL_BIN" ]; then
echo "Unable to find curl. Please install curl."
exit 1
fi
if [[ -f ./post-ip && -f ./post-net && -f ./seawolf.io.service ]]; then
DOWNLOADED=true
else
DOWNLOADED=false
fi
if [ $DOWNLOADED == false ]; then
UNZIP_BIN=$(which unzip)
if [ -z "$UNZIP_BIN" ]; then
echo "Unable to find unzip. Please install unzip."
exit 1
fi
FILE='master.zip'
DOWNLOAD_URL="https://codeload.github.com/seawolfiot/seawolf.io/zip/master"
if [ -f "./$FILE" ]; then
rm -f "./$FILE"
fi
$CURL_BIN -o $FILE $DOWNLOAD_URL
if [ ! -f "./$FILE" ]; then
echo "Failed to locate $FILE"
exit 1
fi
if [ -d ./seawolf.io-master ]; then
rm -rf seawolf.io-master
fi
$UNZIP_BIN ./$FILE
rm -f ./$FILE
cd ./seawolf.io-master
fi
/bin/cp post-* /usr/local/bin/
/bin/cp seawolf.io.service /etc/systemd/system/
if [ $DOWNLOADED == false ]; then
cd ..
rm -rf ./seawolf.io-master
fi
systemctl daemon-reload
systemctl start seawolf.io.service
systemctl enable seawolf.io.service
echo "Installation done!"
echo ""
echo "goto: http://seawolf.io to get your IPs"