-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjanus.sh
132 lines (116 loc) · 3.59 KB
/
janus.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
#!/bin/bash
sudo apt-get install -y lsb-release
# apt versions are different per distro - check with apt-cache policy janus to check which one you get
detect_linux_distribution() {
# Function to see if a specific linux distribution is supported by this script
# If it is supported then the global variable SETUP_ENTRYPOINT is set to the
# function to be executed for the FS setup
local distro_name=$(lsb_release -si)
local distro_version=$(lsb_release -sr)
local distro_codename=$(lsb_release -sc)
DISTRO="$distro_name"
DISTRO_VERSION="$distro_version"
DISTRO_CODENAME="$distro_codename"
case "$distro_name" in
Ubuntu ) case "$distro_version" in
20.04* | 22.04* ) SETUP_ENTRYPOINT="setup_apt"
return 0 ;; # Suported Distribution
* ) return 1 ;; # Unsupported Distribution
esac
;;
Debian ) case "$distro_version" in
10* | 11* | 12* ) SETUP_ENTRYPOINT="setup_apt"
return 0 ;; # Suported Distribution
* ) return 1 ;; # Unsupported Distribution
esac
;;
* ) return 1 ;; # Unsupported Distribution
esac
}
setup_apt() {
sudo apt-get install -y janus
VERSION="janus --version"
}
setup_manual() {
# Confirmed working on 20.04 - haven't tested this script but manually this works.
apt-get install -y apt-utils libmicrohttpd-dev libjansson-dev libssl-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libusrsctp1 libusrsctp-dev libcurl4-openssl-dev liblua5.3-dev libconfig-dev pkg-config gengetopt libtool automake autoconf cmake gtk-doc-tools libini-config-dev libcollection-dev autotools-dev make git doxygen graphviz ffmpeg python3-pip sudo
# pip install of meson & Ninja
pip3 install meson ninja
# lib websockets
mkdir janus-build
cd janus-build
git clone https://libwebsockets.org/repo/libwebsockets
cd libwebsockets
mkdir build
cd build
cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make install
cd ../..
# lib nice
git clone https://gitlab.freedesktop.org/libnice/libnice
cd libnice
meson --prefix=/usr build && ninja -C build && sudo ninja -C build install
cd ..
# libsrtp2
wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz
tar xfv v2.2.0.tar.gz
cd libsrtp-2.2.0
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
cd ..
# Janus:
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --prefix=/opt/janus
make
make install
mkdir /var/log/janus
cd /opt/janus/bin
./janus --version
}
reboot_selection() {
echo "Install done. Press 1 to reboot..."
echo "Otherwise press any other key to exit"
options=("1")
select choice in "${options[@]}"
do
case $choice in
"1")
echo "Rebooting now..."
sudo reboot
break
;;
*)
echo "You pressed a key! Exiting..."
break
;;
esac
done
}
banner_start() {
clear;
echo "Installing Janus $VERSION on $distro_name"
echo "Standby"
echo;
}
banner_end() {
clear;
echo "Hopefully Janus $VERSION is now installed on $distro_name"
echo "Run turnserver to be sure after rebooting"
echo;
}
# Actual install logic
start_app() {
detect_linux_distribution
banner_start
$SETUP_ENTRYPOINT
banner_end
reboot_selection
}
######################################################################
#
# Start of main script
#
######################################################################
[[ "$0" == "$BASH_SOURCE" ]] && start_app