-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbility-start.sh
executable file
·117 lines (88 loc) · 2.59 KB
/
bility-start.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
# echo Starting Bility services
source ~/.bility
[email protected]:openstf/minicap.git
export ANDROID_SDK_ROOT=$ANDROID_SDK
echo $ANDROID_SDK_ROOT
echo Starting Bility services...
# Export for other scripts
export PATH=$PATH:$NDK:$ADB
# First, download dependencies
if [ ! -d "dependencies/" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mkdir dependencies
fi
if [ ! -d "dependencies/minicap" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
echo Installing Minicap... this may take a minute...
cd dependencies
git clone $MINICAP_REPO minicap
cd minicap
git submodule init
git submodule update
ndk-build -C . >> ../../log.txt
cd ../../
echo Minicap build finished!
else
echo Minicap ready
fi
# Starting ktor test server
echo Starting Test server...
cd AndroidServer
./gradlew run >> ../log.txt &
trap 'kill -9 $(lsof -t -i:8080); echo Killed Bility backend server' 0
# until $(curl --output /dev/null --silent --head --fail localhost:8080); do
# printf 'a'
# sleep 1
# echo $(curl --silent --head --fail localhost:8080);
# done
while ! echo exit | nc localhost 8080; do
sleep 1;
printf '.'
done
echo Test server started!
cd ..
# Startup the emulator if not already started
echo Starting up emulator...
STARTEMCOMM="$EM -avd $EM_TO_USE -netdelay none -netspeed full -verbose -no-window"
$EM -avd $EM_TO_USE -netdelay none -netspeed full >> log.txt &
# possible -no-window
trap 'adb kill-server; echo Killed ABD server' 0
A=$(adb shell getprop sys.boot_completed | tr -d '\r')
while [ "$A" != "1" ]; do
printf '.'
sleep 2
A=$(adb shell getprop sys.boot_completed | tr -d '\r')
done
echo Emulator ready!
# Start running the minicap service
echo Starting up minicap...
cd dependencies/minicap/
./run.sh -P 1080x1920@810x1440/0 >> ../../log.txt &
echo Minicap started! Forwarding feed...
adb forward tcp:1717 localabstract:minicap >> ../../log.txt
cd example/
echo Starting minicap casting server...
node app.js & >> ../../../log.txt
until $(curl --output /dev/null --silent --head --fail localhost:9002); do
printf '.'
sleep 1
done
echo Minicap casting server started
cd ../../../
echo Minicap started
# Start running the frontend service
echo Starting Bility frontend site
cd bility-frontend
npm install
npm run dev > ../log.txt &
trap 'kill -9 $(lsof -t -i:3000); echo Killed Bility frontend server' 0
until $(curl --output /dev/null --silent --head --fail localhost:3000); do
printf '.'
sleep 1
done
echo Bility frontend started!
cd ..
echo Press CTRL-C to quit...
while true; do
sleep 100
done