-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setupopensrthub.sh
executable file
·222 lines (207 loc) · 7.08 KB
/
setupopensrthub.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
if [ ! -d "/opt/srthub" ]; then
echo "srthub: creating directory /opt/srthub"
sudo mkdir -p /opt/srthub
else
echo "srthub: directory /opt/srthub already exists"
fi
if [ ! -d "/opt/srthub/configs" ]; then
echo "srthub: creating directory /opt/srthub/configs"
sudo mkdir -p /opt/srthub/configs
else
echo "srthub: directory /opt/srthub/configs already exists"
fi
if [ ! -d "/opt/srthub/status" ]; then
echo "srthub: creating directory /opt/srthub/status"
sudo mkdir -p /opt/srthub/status
else
echo "srthub: directory /opt/srthub/status already exists"
fi
if [ ! -d "/opt/srthub/thumbnail" ]; then
echo "srthub: creating directory /opt/srthub/thumbnail"
sudo mkdir -p /opt/srthub/thumbnail
else
echo "srthub: directory /opt/srthub/thumbnail already exists"
fi
if [ ! -d "/var/app" ]; then
echo "srthub: creating directory /var/app"
sudo mkdir -p /var/app
else
echo "srthub: directory /var/app already exists"
fi
if [ ! -d "/var/app/public" ]; then
echo "srthub: creating directory /var/app/public"
sudo mkdir -p /var/app/public
else
echo "srthub: directory /var/app/public already exists"
fi
if [ -f "./webapp/server.js" ]; then
echo "srthub: installing server.js to /var/app"
sudo cp ./webapp/server.js /var/app
else
echo "srthub: unable to find server.js"
exit
fi
if [ -f "./webapp/public/client.js" ]; then
echo "srthub: installing client.js to /var/app/public"
sudo cp ./webapp/public/client.js /var/app/public
else
echo "srthub: unable to find client.js"
exit
fi
if [ -f "./webapp/public/index.html" ]; then
echo "srthub: installing index.html to /var/app/public"
sudo cp ./webapp/public/index.html /var/app/public
else
echo "srthub: unable to find index.html"
exit
fi
if [ -f "./webapp/package.json" ]; then
echo "srthub: installing package.json to /var/app"
sudo cp ./webapp/package.json /var/app
else
echo "srthub: unable to find package.json"
exit
fi
echo "srthub: performing global Ubuntu update"
sudo apt-get update -y
echo "srtgub: performing global Ubuntu upgrade of packages"
sudo apt-get upgrade -y
echo "srthub: installing build-essential packages"
sudo apt-get install build-essential -y
echo "srthub: installing tclsh"
sudo apt-get install tclsh -y
echo "srthub: installing autoconf"
sudo apt-get install autoconf -y
echo "srthub: installing automake"
sudo apt-get install automake -y
echo "srthub: intallling libssl-dev packages"
sudo apt-get install libssl-dev -y
echo "srthub: installing curl packages"
sudo apt-get install curl -y
echo "srthub: installing cmake"
sudo apt-get install cmake -y
echo "srthub: installing libtool"
sudo apt-get install libtool -y
echo "srthub: installing net-tools"
sudo apt-get install net-tools
echo "srthub: installing nasm"
sudo apt-get install nasm -y
echo "srthub: installing libz"
sudo apt-get install libz-dev -y
echo "srthub: installing liblzma-dev"
sudo apt-get install liblzma-dev -y
echo "srthub: installing pkg-config"
sudo apt-get install pkg-config -y
echo "srthub: installing ca-certificates"
sudo apt-get install ca-certificates -y
echo "srthub: -installing gnupg"
sudo apt-get install gnupg -y
echo "srthub: making keyrings directory /etc/apt/keyrings for Nodesource GPG key"
sudo mkdir -p /etc/apt/keyrings
echo "srthub: importing Nodesource GPG key"
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "srthub: performing global Ubuntu update (again)"
sudo apt-get update -y
echo "srthub: installing nodejs"
sudo apt-get install -y nodejs
echo "srthub: installing pm2 package"
sudo npm install -g pm2
pushd /var/app
echo "srthub: nodejs, installing express (global)"
sudo npm install -g express
echo "srthub: nodejs, installing body-parser (global)"
sudo npm install -g body-parser
echo "srthub: nodejs, installing fs (global)"
sudo npm install -g fs
echo "srthub: nodejs, install archiver (global)"
sudo npm install -g archiver
echo "srthub: nodejs, install winston logger (global)"
sudo npm install -g winston
echo "srthub: nodejs, install read-last-lines file reader (global)"
sudo npm install -g read-last-lines
echo "srthub: nodejs, creating node_modules symbolic link to current directory"
sudo ln -s /usr/lib/node_modules ./node_modules
popd
echo "srthub: installing Docker"
sudo apt-get install docker.io -y
echo "srthub: installing tcpdump"
sudo apt-get install tcpdump -y
echo "srthub: installing ifstat"
sudo apt-get install ifstat -y
echo "srthub: installing zip"
sudo apt-get install zip -y
echo "srthub: installing unzip"
sudo apt-get install unzip -y
#echo "srthub: installing apache"
#sudo apt-get install apache2 -y
echo "srthub: updating pm2 (if actually needed)"
sudo npm install pm2@latest -g
sudo pm2 update
echo ""
echo "All Done With Standard System Setup"
echo ""
echo "Clone libsrt from public Github repository"
git clone https://github.com/Haivision/srt.git ./cbsrt
pushd cbsrt
echo "Configuring libsrt"
git checkout tags/v1.4.4 -b v1.4.4
./configure --prefix=/usr
make -j8
if [ -f "libsrt.a" ]; then
echo "srthub: libsrt.a built properly"
else
echo "srthub: libsrt.a did not build properly - please check manually, aborting installation!"
exit
fi
popd
echo "Clone libcurl"
git clone https://github.com/cannonbeach/curl.git ./cblibcurl
pushd cblibcurl
./buildconf
if [ -f "configure" ]; then
echo "srthub: curl configure script generated"
else
echo "srthub: curl configure script not generated - please check manually, aborting installation!"
exit
fi
echo "Configuring curl for compilation"
./configure --prefix=/usr --enable-static --enable-pthreads --without-ssl --without-librtmp --without-libidn2 --without-nghttp2 --without-brotli
make -j8
if [ -f "./lib/.libs/libcurl.a" ]; then
echo "srthub: libcurl.a was compiled correctly"
else
echo "srthub: libcurl.a was not compiled correctly - please check manually, aborting installation!"
exit
fi
popd
echo "Clone of FFmpeg libraries (used for decoding audio/video preview)"
git clone https://github.com/cannonbeach/FFmpeg.git ./cbffmpeg
pushd cbffmpeg
git checkout -b release4.0 remotes/origin/release/4.0
./configure --prefix=/usr --disable-encoders --enable-avresample --disable-iconv --disable-v4l2-m2m --disable-muxers --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-muxers --disable-avdevice --enable-encoder=mjpeg
make -j8
if [ -f "./libavcodec/libavcodec.a" ]; then
echo "srthub: libavcodec.a was compiled correctly"
else
echo "srthub: libavcodec.a was not compiled correctly - please check manually, aborting installation!"
exit
fi
popd
echo "Building opensrthub"
make
if [ -f "srthub" ]; then
echo "srthub: srthub compiled correctly"
else
echo "srthub: srthub did not get built - please check manually, aborting installation!"
exit
fi
pushd docker
cp ../srthub .
echo "Building docker package for srthub"
sudo docker build -t dockersrthub .
popd
echo "Docker Package Built and Installed"
echo "Done!"