-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·122 lines (110 loc) · 2.32 KB
/
run.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
isinstalled=true
ipaddress=''
ifconfig_bin='ifconfig'
oray_vpn_address=''
isinstalledcentos()
{
if [ -a "/etc/init.d/runsunloginclient" ]; then
echo "Installed"
else
isinstalled=false
fi
}
isinstalledubuntu()
{
if [ -a "/etc/init/runsunloginclient.conf" ]; then
echo "Installed"
else
isinstalled=false
fi
}
isinstalledubuntu_hv()
{
if [ -a "/etc/systemd/system/runsunloginclient.service" ]; then
echo "Installed"
else
isinstalled=false
fi
}
isinstalledcentos_hv()
{
if [ -a "/etc/systemd/system/runsunloginclient.service" ]; then
echo "Installed"
else
isinstalled=false
fi
}
printhowtouse()
{
echo "Run it with no argument to start Sunloginclient"
echo "Run it with [help] as it argument to print the help information"
#echo "Run it with [start] as it argument to start Sunloginclient"
echo "Run it with [stop] as it argument to stop Sunloginclient"
}
#change directory to script path
curpath=$(cd "$(dirname "$0")"; pwd)
cd $curpath > /dev/null
source ./scripts/common.sh
os_version_int=${os_version%.*}
for i in $(seq 1 10)
do
os_version_int=${os_version_int%.*}
done
if [ $os_name == 'ubuntu' ]; then
if [ $os_version_int -lt 15 ]; then
isinstalledubuntu
else
isinstalledubuntu_hv
fi
elif [ "$os_name" == "deepin" ]; then
if [ $os_version_int -gt 2000 ]; then
let os_version_int=os_version_int-2000
fi
if [ $os_version_int -lt 15 ]; then
isinstalledubuntu
else
isinstalledubuntu_hv
fi
elif [ "$os_name" == "centos" ] || [ $(echo $os_name |grep redhat) != "" ] ; then
if [ $os_version_int -lt 7 ]; then
ifconfig_bin='/sbin/ifconfig'
isinstalledcentos
else
isinstalledcentos_hv
fi
else
echo 'unknown os'
exit
fi
if [ $# -gt 0 ]; then
if [ $1 == "stop" ]; then
if [ $isinstalled == true ] ;then
check_root "Installed Sunlogin client needs root to stop"
cd ./scripts
source stop.sh
cd -
exit
else
killallsunloginclient
rm /var/tmp/linux_oray_sunloginclient_2.1.lock 1>/dev/null 2>&1
exit
fi
elif [ $1 == "help" ]; then
printhowtouse
exit
fi
fi
if [ $isinstalled == true ] ;then
check_root "Installed Sunlogin client needs root to start"
cd ./scripts
source start.sh
cd -
exit
else
killallsunloginclient
cd ./bin/$os_bits/
./sunloginclient_linux -g 1>/dev/null 2>&1 &
sleep 3
xdg-open http://127.0.0.1:30080 1>/dev/null 2>&1 &
fi