This repository has been archived by the owner on Jul 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·59 lines (56 loc) · 1.64 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
case "$OSTYPE" in
solaris*) os="SOLARIS" ;;
darwin*) os="OSX" ;;
linux*) os="LINUX" ;;
bsd*) os="BSD" ;;
msys*) os="WINDOWS" ;;
*) os="unknown: $OSTYPE" ;;
esac
path=$(pwd)
if [ $os = "OSX" ]
then
osascript <<EOF
tell application "iTerm"
activate
set window1 to (create window with default profile)
tell window1
launch session "Server"
tell current session
write text "cd \"$path\""
write text "\n"
write text "source venv/bin/activate"
write text "\n"
write text "cd server"
write text "\n"
write text "pip3 install -r requirements.txt"
write text "\n"
write text "python3 server.py"
write text "\n"
end tell
end tell
delay 2
set window2 to (create window with default profile)
tell window2
launch session "Viewer"
tell the current session
write text "cd \"$path\""
write text "\n"
write text "source venv/bin/activate"
write text "\n"
write text "cd client"
write text "\n"
write text "pip3 install -r requirements.txt"
write text "\n"
write text "python3 client.py"
write text "\n"
end tell
end tell
end tell
EOF
fi
if [ $os = "LINUX" ]
then
gnome-terminal -x bash -c "cd ${path} && source venv/bin/activate && cd server && pip3 install -r requirements.txt && python3 server.py"
sleep 2
gnome-terminal -x bash -c "cd ${path} && source venv/bin/activate && cd client && pip3 install -r requirements.txt && python3 client.py"
fi