Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the install script #341

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions bbb-install-2.5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ main() {
if ! apt-key list MongoDB | grep -q 4.4; then
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
fi
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list > /dev/null
rm -f /etc/apt/sources.list.d/mongodb-org-4.2.list

touch /root/.rnd
Expand Down Expand Up @@ -447,8 +447,9 @@ get_IP() {

# Check if the external IP reaches the internal IP
if [ -n "$external_ip" ] && [ "$IP" != "$external_ip" ]; then
if which nginx; then
if systemctl -q is-active nginx; then
systemctl stop nginx
NGINX_WAS_RUNING=true
fi

need_pkg netcat-openbsd
Expand All @@ -473,14 +474,18 @@ get_IP() {

kill $nc_PID > /dev/null 2>&1;

if which nginx; then
if [ ! -z $NGINX_WAS_RUNING ]; then
systemctl start nginx
fi
fi

if [ -z "$IP" ]; then err "Unable to determine local IP address."; fi
}

is_pkg_installed() {
[[ $(dpkg-query -W -f '${db:status-status}' $1 2>/dev/null) == "installed" ]]
}

need_pkg() {
check_root
while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do echo "Sleeping for 1 second because of dpkg lock"; sleep 1; done
Expand Down Expand Up @@ -554,7 +559,7 @@ check_coturn() {
}

check_apache2() {
if dpkg -l | grep -q apache2-bin; then
if is_pkg_installed apache2-bin; then
echo "You must uninstall the Apache2 server first"
if [ "$SKIP_APACHE_INSTALLED_CHECK" != true ]; then
exit 1
Expand Down Expand Up @@ -675,7 +680,7 @@ install_greenlight(){
docker pull bigbluebutton/greenlight:v2 # Ensure the current version of greenlight is pulled

# Purge older docker compose
if dpkg -l | grep -q docker-compose; then
if is_pkg_installed docker-compose; then
apt-get purge -y docker-compose
fi

Expand Down Expand Up @@ -708,7 +713,7 @@ install_greenlight(){
# need_pkg bbb-webhooks

if [ ! -f /usr/share/bigbluebutton/nginx/greenlight.nginx ]; then
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | tee /usr/share/bigbluebutton/nginx/greenlight.nginx
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | tee /usr/share/bigbluebutton/nginx/greenlight.nginx >/dev/null
cat > /usr/share/bigbluebutton/nginx/greenlight-redirect.nginx << HERE
location = / {
return 307 /b;
Expand Down Expand Up @@ -753,7 +758,7 @@ install_docker() {
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
fi

if ! dpkg -l | grep -q docker-ce; then
if ! is_pkg_installed docker-ce; then
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
Expand Down
19 changes: 12 additions & 7 deletions bbb-install-2.6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ main() {
if ! apt-key list MongoDB | grep -q 4.4; then
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
fi
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list > /dev/null
rm -f /etc/apt/sources.list.d/mongodb-org-4.2.list

touch /root/.rnd
Expand Down Expand Up @@ -436,8 +436,9 @@ get_IP() {

# Check if the external IP reaches the internal IP
if [ -n "$external_ip" ] && [ "$IP" != "$external_ip" ]; then
if which nginx; then
if systemctl -q is-active nginx; then
systemctl stop nginx
NGINX_WAS_RUNING=true
fi

need_pkg netcat-openbsd
Expand All @@ -462,14 +463,18 @@ get_IP() {

kill $nc_PID > /dev/null 2>&1;

if which nginx; then
if [ ! -z $NGINX_WAS_RUNING ]; then
systemctl start nginx
fi
fi

if [ -z "$IP" ]; then err "Unable to determine local IP address."; fi
}

is_pkg_installed() {
[[ $(dpkg-query -W -f '${db:status-status}' $1 2>/dev/null) == "installed" ]]
}

need_pkg() {
check_root
while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do echo "Sleeping for 1 second because of dpkg lock"; sleep 1; done
Expand Down Expand Up @@ -543,7 +548,7 @@ check_coturn() {
}

check_apache2() {
if dpkg -l | grep -q apache2-bin; then
if is_pkg_installed apache2-bin; then
echo "You must uninstall the Apache2 server first"
if [ "$SKIP_APACHE_INSTALLED_CHECK" != true ]; then
exit 1;
Expand Down Expand Up @@ -664,7 +669,7 @@ install_greenlight(){
docker pull bigbluebutton/greenlight:v2 # Ensure the current version of greenlight is pulled

# Purge older docker compose
if dpkg -l | grep -q docker-compose; then
if is_pkg_installed docker-compose; then
apt-get purge -y docker-compose
fi

Expand Down Expand Up @@ -697,7 +702,7 @@ install_greenlight(){
# need_pkg bbb-webhooks

if [ ! -f /usr/share/bigbluebutton/nginx/greenlight.nginx ]; then
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | tee /usr/share/bigbluebutton/nginx/greenlight.nginx
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | tee /usr/share/bigbluebutton/nginx/greenlight.nginx >/dev/null
cat > /usr/share/bigbluebutton/nginx/greenlight-redirect.nginx << HERE
location = / {
return 307 /b/;
Expand Down Expand Up @@ -742,7 +747,7 @@ install_docker() {
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
fi

if ! dpkg -l | grep -q docker-ce; then
if ! is_pkg_installed docker-ce; then
echo "deb [ arch=amd64 ] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

Expand Down
21 changes: 14 additions & 7 deletions bbb-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ main() {
if ! apt-key list MongoDB | grep -q 4.2; then
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
fi
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list > /dev/null
rm -f /etc/apt/sources.list.d/mongodb-org-4.0.list

touch /root/.rnd
Expand Down Expand Up @@ -484,8 +484,9 @@ get_IP() {

# Check if the external IP reaches the internal IP
if [ -n "$external_ip" ] && [ "$IP" != "$external_ip" ]; then
if which nginx; then
if systemctl -q is-active nginx; then
systemctl stop nginx
NGINX_WAS_RUNING=true
fi

need_pkg netcat-openbsd
Expand All @@ -510,14 +511,18 @@ get_IP() {

kill $nc_PID > /dev/null 2>&1;

if which nginx; then
if [ ! -z $NGINX_WAS_RUNING ]; then
systemctl start nginx
fi
fi

if [ -z "$IP" ]; then err "Unable to determine local IP address."; fi
}

is_pkg_installed() {
[[ $(dpkg-query -W -f '${db:status-status}' $1 2>/dev/null) == "installed" ]]
}

need_pkg() {
check_root
while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do sleep 1; done
Expand Down Expand Up @@ -601,7 +606,9 @@ check_coturn() {
}

check_apache2() {
if dpkg -l | grep -q apache2-bin; then err "You must uninstall the Apache2 server first"; fi
if is_pkg_installed apache2-bin; then
err "You must uninstall the Apache2 server first"
fi
}

# If running under LXC, then modify the FreeSWITCH systemctl service so it does not use realtime scheduler
Expand Down Expand Up @@ -722,7 +729,7 @@ install_greenlight(){
install_docker

# Purge older docker compose
if dpkg -l | grep -q docker-compose; then
if is_pkg_installed docker-compose; then
apt-get purge -y docker-compose
fi

Expand Down Expand Up @@ -755,7 +762,7 @@ install_greenlight(){
# need_pkg bbb-webhooks

if [ ! -f /etc/bigbluebutton/nginx/greenlight.nginx ]; then
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | tee /etc/bigbluebutton/nginx/greenlight.nginx
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | tee /etc/bigbluebutton/nginx/greenlight.nginx >/dev/null
cat > /etc/bigbluebutton/nginx/greenlight-redirect.nginx << HERE
location = / {
return 307 /b;
Expand Down Expand Up @@ -800,7 +807,7 @@ install_docker() {
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
fi

if ! dpkg -l | grep -q docker-ce; then
if ! is_pkg_installed docker-ce; then
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
Expand Down