forked from XX-net/XX-Net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart
More file actions
executable file
·64 lines (52 loc) · 1.43 KB
/
start
File metadata and controls
executable file
·64 lines (52 loc) · 1.43 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPTPATH
if python -V | grep -q "Python 3" ;then
PYTHON="python2"
else
PYTHON="python"
fi
if [ -f code/version.txt ]; then
VERSION=`cat code/version.txt`
else
VERSION="default"
fi
if [ ! -d "code/$VERSION" ]; then
VERSION="default"
fi
echo "XX-Net version:$VERSION"
# launch xx-net service by ignore hungup signal
function launchWithNoHungup() {
nohup ${PYTHON} code/${VERSION}/launcher/start.py 2&> /dev/null &
}
# launch xx-net service by hungup signal
function launchWithHungup() {
${PYTHON} code/${VERSION}/launcher/start.py
}
# get operating system name
os_name=`uname -s`
# Install Packages
echo 'Install python-openssl and libnss3-tools for your system'
if [ $os_name = 'Linux' ]; then
if [ `which apt-get | wc -l` != 0 ]; then
if [ `dpkg-query -l | grep python-openssl | wc -l` == 0 ]; then
sudo apt-get install -y python-openssl
fi
elif [ `which yum | wc -l` != 0 ]; then
if [ `yum -q list installed | grep pyOpenSSL | wc -l` == 0 ]; then
sudo yum install -y pyOpenSSL
fi
# Do Someting for ArchLinux
# Do Someting for OpenSUSE
# Do Someting for OpenWRT
fi
# elif [ $os_name = 'Darwin' ]; then
# Do Someting for Mac
fi
# Start Application
if [ $os_name = 'Darwin' ]; then
PYTHON="/usr/bin/python2.7"
launchWithNoHungup
else
launchWithHungup
fi