From 457623b6016701b9ef52b65d18480fc24b337108 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Apr 2021 22:32:55 -0500 Subject: [PATCH] Update indenting too. --- add-jibri-node.sh | 8 +- add-jvb2-node.sh | 78 +++++++------- etherpad.sh | 50 ++++----- jra_nextcloud.sh | 111 ++++++++++---------- quick_jibri_installer.sh | 213 +++++++++++++++++++-------------------- tools/test-jibri-env.sh | 10 +- 6 files changed, 233 insertions(+), 237 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index e8cbbe2..015e3aa 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -174,10 +174,10 @@ else do read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_LOW_RES if [ "$CONTINUE_LOW_RES" = "no" ]; then - echo "See you next time with more resources!..." - exit + echo "See you next time with more resources!..." + exit elif [ "$CONTINUE_LOW_RES" = "yes" ]; then - echo "Please keep in mind that we might not support underpowered nodes." + echo "Please keep in mind that we might not support underpowered nodes." fi done fi @@ -251,7 +251,7 @@ HWE_VIR_MOD=$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr) 2>/de if [ "$HWE_VIR_MOD" = "1" ]; then apt-get -y install \ linux-image-generic-hwe-$(lsb_release -sr) - else +else apt-get -y install \ linux-image-generic \ linux-modules-extra-$(uname -r) diff --git a/add-jvb2-node.sh b/add-jvb2-node.sh index e731605..8d844fd 100644 --- a/add-jvb2-node.sh +++ b/add-jvb2-node.sh @@ -9,18 +9,18 @@ #Make sure the file name is the required one if [ ! "$(basename $0)" = "add-jvb2-node.sh" ]; then - echo "For most cases naming won't matter, for this one it does." - echo "Please use the original name for this script: \`add-jvb2-node.sh', and run again." - exit + echo "For most cases naming won't matter, for this one it does." + echo "Please use the original name for this script: \`add-jvb2-node.sh', and run again." + exit fi while getopts m: option do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo ./add-jvb2-node.sh [-m debug]" && exit;; - esac + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./add-jvb2-node.sh [-m debug]" && exit;; + esac done #DEBUG @@ -73,33 +73,33 @@ NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" # sed limiters for add-jvb2-node.sh variables var_dlim() { - grep -n $1 add-jvb2-node.sh|head -n1|cut -d ":" -f1 + grep -n $1 add-jvb2-node.sh|head -n1|cut -d ":" -f1 } check_var() { - if [ -z "$2" ]; then - echo -e "Check if variable $1 is set: \xE2\x9C\x96 \nExiting..." - exit - else - echo -e "Check if variable $1 is set: \xE2\x9C\x94" - fi + if [ -z "$2" ]; then + echo -e "Check if variable $1 is set: \xE2\x9C\x96 \nExiting..." + exit + else + echo -e "Check if variable $1 is set: \xE2\x9C\x94" + fi } if [ -z "$LAST" ]; then - echo "There is an error on the LAST definition, please report." - exit + echo "There is an error on the LAST definition, please report." + exit elif [ "$LAST" = "TBD" ]; then - ADDUP=$((START + 1)) + ADDUP=$((START + 1)) else - ADDUP=$((LAST + 1)) + ADDUP=$((LAST + 1)) fi #Check server and node OS if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then - echo "Please use the same OS for the JVB2 setup on both servers." - echo "This server is based on: $THIS_SRV_DIST" - echo "The main server record claims is based on: $MAIN_SRV_DIST" - exit + echo "Please use the same OS for the JVB2 setup on both servers." + echo "This server is based on: $THIS_SRV_DIST" + echo "The main server record claims is based on: $MAIN_SRV_DIST" + exit fi #Check system resources @@ -177,15 +177,15 @@ sed -i "1i 127.0.0.1 jvb${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts # Jitsi-Meet Repo echo "Add Jitsi repo" if [ -z "$JITSI_REPO" ]; then - echo "deb http://download.jitsi.org $MAIN_SRV_REPO/" > /etc/apt/sources.list.d/jitsi-$MAIN_SRV_REPO.list - wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - + echo "deb http://download.jitsi.org $MAIN_SRV_REPO/" > /etc/apt/sources.list.d/jitsi-$MAIN_SRV_REPO.list + wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - elif [ ! "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then - echo "Main and node servers repository don't match, extiting.." - exit + echo "Main and node servers repository don't match, extiting.." + exit elif [ "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then - echo "Main and node servers repository match, continuing..." + echo "Main and node servers repository match, continuing..." else - echo "Jitsi $JITSI_REPO repository already installed" + echo "Jitsi $JITSI_REPO repository already installed" fi # Requirements @@ -194,14 +194,14 @@ apt-get update -q2 apt-get dist-upgrade -yq2 apt-get -y install \ - apt-show-versions \ - bmon \ - curl \ - git \ - htop \ - ssh \ - unzip \ - wget + apt-show-versions \ + bmon \ + curl \ + git \ + htop \ + ssh \ + unzip \ + wget echo "# Check and Install HWE kernel if possible..." HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") @@ -222,8 +222,8 @@ echo " echo "jitsi-videobridge jitsi-videobridge/jvb-hostname string $MAIN_SRV_DOMAIN" | debconf-set-selections apt-get -y install \ - jitsi-videobridge2 \ - openjdk-8-jre-headless + jitsi-videobridge2 \ + openjdk-8-jre-headless echo ' ######################################################################## diff --git a/etherpad.sh b/etherpad.sh index 04cdfb9..29736b4 100644 --- a/etherpad.sh +++ b/etherpad.sh @@ -6,11 +6,11 @@ while getopts m: option do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo ./etherpad.sh [-m debug]" && exit;; - esac + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./etherpad.sh [-m debug]" && exit;; + esac done #DEBUG @@ -19,8 +19,8 @@ set -x fi if ! [ $(id -u) = 0 ]; then - echo "You need to be root or have sudo privileges!" - exit 0 + echo "You need to be root or have sudo privileges!" + exit 0 fi clear @@ -41,10 +41,10 @@ cut -d "/" -f2 } install_ifnot() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo " $1 is installed, skipping..." - else - echo -e "\n---- Installing $1 ----" - apt-get -yq2 install $1 + echo " $1 is installed, skipping..." +else + echo -e "\n---- Installing $1 ----" + apt-get -yq2 install $1 fi } DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') @@ -63,10 +63,10 @@ ETHERPAD_SYSTEMD="/etc/systemd/system/etherpad-lite.service" echo "Addin NodeJS repo..." if [ "$NODE_JS_REPO" = "main" ]; then - echo "NodeJS repository already installed" + echo "NodeJS repository already installed" else - curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - - apt-get update + curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - + apt-get update fi read -p "Set your etherpad docker admin password: " -r ETHERPAD_ADMIN_PASS @@ -162,15 +162,15 @@ if [ $(grep -c "etherpad" $WS_CONF) != 0 ]; then echo "> Webserver seems configured, skipping..." elif [ -f $WS_CONF ]; then echo "> Setting up webserver configuration file..." - sed -i "/Anything that didn't match above/i \ \ \ \ location \^\~\ \/etherpad\/ {" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:9001\/;" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_set_header X-Forwarded-For \$remote_addr;" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_buffering off;" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ location \^\~\ \/etherpad\/ {" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:9001\/;" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_set_header X-Forwarded-For \$remote_addr;" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_buffering off;" $WS_CONF sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_set_header Host \$host;" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ }" $WS_CONF - sed -i "/Anything that didn't match above/i \\\n" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ }" $WS_CONF + sed -i "/Anything that didn't match above/i \\\n" $WS_CONF else - echo "> No etherpad config done to server file, please report to: + echo "> No etherpad config done to server file, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues" fi @@ -186,10 +186,10 @@ echo "> Checking nginx configuration..." nginx -t 2>/dev/null if [ $? = 0 ]; then - echo -e " -- Docker configuration seems fine, enabling it." - systemctl reload nginx + echo -e " -- Docker configuration seems fine, enabling it." + systemctl reload nginx else - echo "Please check your configuration, something may be wrong." - echo "Will not try to enable etherpad nginx configuration, please report to: + echo "Please check your configuration, something may be wrong." + echo "Will not try to enable etherpad nginx configuration, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues" fi diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index bff2ea6..cd27a91 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -4,11 +4,11 @@ # GPLv3 or later. while getopts m: option do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo ./jra_nextcloud.sh [-m debug]" && exit;; - esac + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./jra_nextcloud.sh [-m debug]" && exit;; + esac done #DEBUG @@ -22,10 +22,10 @@ if ! [ $(id -u) = 0 ]; then fi exit_if_not_installed() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" != "1" ]; then - echo " This instance doesn't have $1 installed, exiting..." - echo " If you think this is an error, please report to: + echo " This instance doesn't have $1 installed, exiting..." + echo " If you think this is an error, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues " - exit + exit fi } clear @@ -63,40 +63,39 @@ fi while [[ -z "$NC_DOMAIN" ]] do -read -p "Please enter the domain to use for Nextcloud: " -r NC_DOMAIN -if [ -z "$NC_DOMAIN" ];then - echo "-- This field is mandatory." -elif [ "$NC_DOMAIN" = "$DOMAIN" ]; then - echo "-- You can not use the same domain for both, Jitsi Meet and JRA via Nextcloud." -fi + read -p "Please enter the domain to use for Nextcloud: " -r NC_DOMAIN + if [ -z "$NC_DOMAIN" ];then + echo "-- This field is mandatory." + elif [ "$NC_DOMAIN" = "$DOMAIN" ]; then + echo "-- You can not use the same domain for both, Jitsi Meet and JRA via Nextcloud." + fi done NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf" while [[ -z "$NC_USER" ]] do -read -p "Nextcloud user: " -r NC_USER -if [ -z "$NC_USER" ]; then - echo "-- This field is mandatory." -fi + read -p "Nextcloud user: " -r NC_USER + if [ -z "$NC_USER" ]; then + echo "-- This field is mandatory." + fi done while [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ] do -read -p "Nextcloud user password: " -r NC_PASS - -if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]; then - echo -e "-- This field is mandatory. \nPlease make sure it's at least 6 caracters.\n" -fi + read -p "Nextcloud user password: " -r NC_PASS + if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]; then + echo -e "-- This field is mandatory. \nPlease make sure it's at least 6 caracters.\n" + fi done #Enable HSTS while [[ "$ENABLE_HSTS" != "yes" && "$ENABLE_HSTS" != "no" ]] do -read -p "> Do you want to enable HSTS for this domain?: (yes or no) + read -p "> Do you want to enable HSTS for this domain?: (yes or no) Be aware this option apply mid-term effects on the domain, choose \"no\" in case you don't know what you are doing. More at https://hstspreload.org/"$'\n' -r ENABLE_HSTS -if [ "$ENABLE_HSTS" = "no" ]; then - echo "-- HSTS won't be enabled." -elif [ "$ENABLE_HSTS" = "yes" ]; then - echo "-- HSTS will be enabled." -fi + if [ "$ENABLE_HSTS" = "no" ]; then + echo "-- HSTS won't be enabled." + elif [ "$ENABLE_HSTS" = "yes" ]; then + echo "-- HSTS will be enabled." + fi done echo -e "\n# Check for jitsi-meet/jibri\n" @@ -111,31 +110,31 @@ fi exit_ifinstalled() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo " This instance already has $1 installed, exiting..." - echo " If you think this is an error, please report to: + echo " This instance already has $1 installed, exiting..." + echo " If you think this is an error, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues " - exit + exit fi } install_ifnot() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo " $1 is installed, skipping..." - else - echo -e "\n---- Installing $1 ----" - apt-get -yq2 install $1 + echo " $1 is installed, skipping..." +else + echo -e "\n---- Installing $1 ----" + apt-get -yq2 install $1 fi } add_php74() { - if [ "$PHP_REPO" = "php" ]; then - echo "PHP $PHPVER already installed" - apt-get -q2 update - apt-get -yq2 dist-upgrade - else - echo "# Adding Ondrej PHP $PHPVER PPA Repository" - apt-key adv --recv-keys --keyserver keyserver.ubuntu.com E5267A6C - echo "deb [arch=amd64] http://ppa.launchpad.net/ondrej/php/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/php7x.list - apt-get update -q2 - fi +if [ "$PHP_REPO" = "php" ]; then + echo "PHP $PHPVER already installed" + apt-get -q2 update + apt-get -yq2 dist-upgrade +else + echo "# Adding Ondrej PHP $PHPVER PPA Repository" + apt-key adv --recv-keys --keyserver keyserver.ubuntu.com E5267A6C + echo "deb [arch=amd64] http://ppa.launchpad.net/ondrej/php/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/php7x.list + apt-get update -q2 +fi } #Prevent root folder permission issues cp $PWD/files/jra-nc-app-ef.json /tmp @@ -374,26 +373,26 @@ NC_NGINX systemctl stop nginx letsencrypt certonly --standalone --renew-by-default --agree-tos -d $NC_DOMAIN if [ -f /etc/letsencrypt/live/$NC_DOMAIN/fullchain.pem ];then - ln -s $NC_NGINX_CONF /etc/nginx/sites-enabled/ + ln -s $NC_NGINX_CONF /etc/nginx/sites-enabled/ else - echo "There are issues on getting the SSL certs..." - read -n 1 -s -r -p "Press any key to continue" + echo "There are issues on getting the SSL certs..." + read -n 1 -s -r -p "Press any key to continue" fi nginx -t systemctl restart nginx if [ "$ENABLE_HSTS" = "yes" ]; then -sed -i "s|# add_header Strict-Transport-Security|add_header Strict-Transport-Security|g" $NC_NGINX_CONF + sed -i "s|# add_header Strict-Transport-Security|add_header Strict-Transport-Security|g" $NC_NGINX_CONF fi -if [ "$DISTRO_RELEASE" != "xenial" ] && [ ! -z $PREAD_PROXY ]; then -echo " +if [ "$DISTRO_RELEASE" != "xenial" ] && [ ! -z "$PREAD_PROXY" ]; then + echo " Setting up Nextcloud domain on Jitsi Meet turn proxy " - sed -i "/server {/i \ \ map \$ssl_preread_server_name \$upstream {" $JITSI_MEET_PROXY - sed -i "/server {/i \ \ \ \ \ \ $DOMAIN web;" $JITSI_MEET_PROXY - sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" $JITSI_MEET_PROXY - sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY + sed -i "/server {/i \ \ map \$ssl_preread_server_name \$upstream {" $JITSI_MEET_PROXY + sed -i "/server {/i \ \ \ \ \ \ $DOMAIN web;" $JITSI_MEET_PROXY + sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" $JITSI_MEET_PROXY + sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY fi echo " diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 68b6a22..585575d 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -266,19 +266,18 @@ if [ "$LE_SSL" = "yes" ]; then do read -p "> Please set your domain (or subdmain) here: (e.g.: jitsi.domain.com)"$'\n' -r JITSI_DOMAIN read -p "> Did you mean?: $JITSI_DOMAIN (yes or no)"$'\n' -r ANS_JD - if [ "$ANS_JD" = "yes" ]; then - echo "Alright, let's use $JITSI_DOMAIN." - else - echo "Please try again." - fi + if [ "$ANS_JD" = "yes" ]; then + echo "Alright, let's use $JITSI_DOMAIN." + else + echo "Please try again." + fi done - #Simple DNS test - if [ "$PUBLIC_IP" = "$(dig -4 +short $JITSI_DOMAIN)" ]; then - echo "Server public IP & DNS record for $JITSI_DOMAIN seems to match, continuing... + if [ "$PUBLIC_IP" = "$(dig -4 +short $JITSI_DOMAIN)" ]; then + echo "Server public IP & DNS record for $JITSI_DOMAIN seems to match, continuing... " - else - echo "Server public IP ($PUBLIC_IP) & DNS record for $JITSI_DOMAIN don't seem to match." + else + echo "Server public IP ($PUBLIC_IP) & DNS record for $JITSI_DOMAIN don't seem to match." echo " > Please check your dns records are applied and updated, otherwise components may fail." read -p " > Do you want to continue?: (yes or no)"$'\n' -r DNS_CONTINUE if [ "$DNS_CONTINUE" = "yes" ]; then @@ -295,18 +294,18 @@ apt-get update -q2 apt-get dist-upgrade -yq2 apt-get -y install \ - apt-show-versions \ - bmon \ - curl \ - ffmpeg \ - git \ - htop \ - jq \ - net-tools \ - rsync \ - ssh \ - unzip \ - wget + apt-show-versions \ + bmon \ + curl \ + ffmpeg \ + git \ + htop \ + jq \ + net-tools \ + rsync \ + ssh \ + unzip \ + wget if [ "$LE_SSL" = "yes" ]; then apt-get -y install \ @@ -318,7 +317,7 @@ HWE_VIR_MOD=$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr) 2>/de if [ "$HWE_VIR_MOD" = "1" ]; then apt-get -y install \ linux-image-generic-hwe-$(lsb_release -sr) - else +else apt-get -y install \ linux-image-generic \ linux-modules-extra-$(uname -r) @@ -350,12 +349,12 @@ echo " #-------------------------------------------------- " if [ "$(dpkg-query -W -f='${Status}' nodejs 2>/dev/null | grep -c "ok")" == "1" ]; then - echo "Nodejs is installed, skipping..." - else - curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - - apt-get install -yq2 nodejs - echo "Installing nodejs esprima package..." - npm install -g esprima + echo "Nodejs is installed, skipping..." +else + curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - + apt-get install -yq2 nodejs + echo "Installing nodejs esprima package..." + npm install -g esprima fi if [ "$(npm list -g esprima 2>/dev/null | grep -c "empty")" == "1" ]; then @@ -469,12 +468,12 @@ read -p "Leave empty to use the default one (English): "$'\n' L10N_ME #Drop unsecure TLS while [[ "$DROP_TLS1" != "yes" && "$DROP_TLS1" != "no" ]] do -read -p "> Do you want to drop support for unsecure protocols TLSv1.0/1.1 now: (yes or no)"$'\n' -r DROP_TLS1 -if [ "$DROP_TLS1" = "no" ]; then - echo "TLSv1.0/1.1 will remain." -elif [ "$DROP_TLS1" = "yes" ]; then - echo "TLSv1.0/1.1 will be dropped" -fi + read -p "> Do you want to drop support for unsecure protocols TLSv1.0/1.1 now: (yes or no)"$'\n' -r DROP_TLS1 + if [ "$DROP_TLS1" = "no" ]; then + echo "TLSv1.0/1.1 will remain." + elif [ "$DROP_TLS1" = "yes" ]; then + echo "TLSv1.0/1.1 will be dropped" + fi done #Dropbox -- no longer requirement for localrecording #while [[ $ENABLE_DB != yes && $ENABLE_DB != no ]] @@ -489,32 +488,32 @@ done #Brandless Mode while [[ "$ENABLE_BLESSM" != "yes" && "$ENABLE_BLESSM" != "no" ]] do -read -p "> Do you want to install customized \"brandless mode\"?: (yes or no)"$'\n' -r ENABLE_BLESSM -if [ "$ENABLE_BLESSM" = "no" ]; then - echo "Brandless mode won't be set." -elif [ "$ENABLE_BLESSM" = "yes" ]; then - echo "Brandless mode will be set." -fi + read -p "> Do you want to install customized \"brandless mode\"?: (yes or no)"$'\n' -r ENABLE_BLESSM + if [ "$ENABLE_BLESSM" = "no" ]; then + echo "Brandless mode won't be set." + elif [ "$ENABLE_BLESSM" = "yes" ]; then + echo "Brandless mode will be set." + fi done #Welcome Page while [[ "$ENABLE_WELCP" != "yes" && "$ENABLE_WELCP" != "no" ]] do -read -p "> Do you want to disable the Welcome page: (yes or no)"$'\n' -r ENABLE_WELCP -if [ "$ENABLE_WELCP" = "yes" ]; then - echo "Welcome page will be disabled." -elif [ "$ENABLE_WELCP" = "no" ]; then - echo "Welcome page will be enabled." -fi + read -p "> Do you want to disable the Welcome page: (yes or no)"$'\n' -r ENABLE_WELCP + if [ "$ENABLE_WELCP" = "yes" ]; then + echo "Welcome page will be disabled." + elif [ "$ENABLE_WELCP" = "no" ]; then + echo "Welcome page will be enabled." + fi done #Enable static avatar while [[ "$ENABLE_SA" != "yes" && "$ENABLE_SA" != "no" ]] do -read -p "> (Legacy) Do you want to enable static avatar?: (yes or no)"$'\n' -r ENABLE_SA -if [ "$ENABLE_SA" = "no" ]; then - echo "Static avatar won't be enabled" -elif [ "$ENABLE_SA" = "yes" ]; then - echo "Static avatar will be enabled" -fi + read -p "> (Legacy) Do you want to enable static avatar?: (yes or no)"$'\n' -r ENABLE_SA + if [ "$ENABLE_SA" = "no" ]; then + echo "Static avatar won't be enabled" + elif [ "$ENABLE_SA" = "yes" ]; then + echo "Static avatar will be enabled" + fi done # #Enable local audio recording - disabling #while [[ "$ENABLE_LAR" != "yes" && "$ENABLE_LAR" != "no" ]] @@ -568,13 +567,13 @@ done #Jibri Records Access (JRA) via Nextcloud while [[ "$ENABLE_NC_ACCESS" != "yes" && "$ENABLE_NC_ACCESS" != "no" ]] do -read -p "> Do you want to setup Jibri Records Access via Nextcloud: (yes or no) + read -p "> Do you want to setup Jibri Records Access via Nextcloud: (yes or no) ( Please check requirements at: https://github.com/switnet-ltd/quick-jibri-installer )"$'\n' -r ENABLE_NC_ACCESS -if [ "$ENABLE_NC_ACCESS" = "no" ]; then - echo -e "-- JRA via Nextcloud won't be enabled.\n" -elif [ "$ENABLE_NC_ACCESS" = "yes" ]; then - echo -e "-- JRA via Nextcloud will be enabled.\n" -fi + if [ "$ENABLE_NC_ACCESS" = "no" ]; then + echo -e "-- JRA via Nextcloud won't be enabled.\n" + elif [ "$ENABLE_NC_ACCESS" = "yes" ]; then + echo -e "-- JRA via Nextcloud will be enabled.\n" + fi done #Jigasi if [ "$(curl -s -o /dev/null -w "%{http_code}" $GC_SDK_REL_FILE )" == "404" ]; then @@ -584,13 +583,13 @@ if [ "$(curl -s -o /dev/null -w "%{http_code}" $GC_SDK_REL_FILE )" == "404" ]; t elif [ "$(curl -s -o /dev/null -w "%{http_code}" $GC_SDK_REL_FILE )" == "200" ]; then while [[ "$ENABLE_TRANSCRIPT" != "yes" && "$ENABLE_TRANSCRIPT" != "no" ]] do -read -p "> Do you want to setup Jigasi Transcription: (yes or no) + read -p "> Do you want to setup Jigasi Transcription: (yes or no) ( Please check requirements at: https://github.com/switnet-ltd/quick-jibri-installer )"$'\n' -r ENABLE_TRANSCRIPT - if [ "$ENABLE_TRANSCRIPT" = "no" ]; then - echo -e "-- Jigasi Transcription won't be enabled.\n" - elif [ "$ENABLE_TRANSCRIPT" = "yes" ]; then - echo -e "-- Jigasi Transcription will be enabled.\n" - fi + if [ "$ENABLE_TRANSCRIPT" = "no" ]; then + echo -e "-- Jigasi Transcription won't be enabled.\n" + elif [ "$ENABLE_TRANSCRIPT" = "yes" ]; then + echo -e "-- Jigasi Transcription will be enabled.\n" + fi done else echo "No valid option for Jigasi. Please report this to @@ -644,7 +643,7 @@ fi enable_letsencrypt() { if [ "$LE_SSL" = "yes" ]; then - echo ' + echo ' #-------------------------------------------------- # Starting LetsEncrypt configuration #-------------------------------------------------- @@ -652,23 +651,22 @@ if [ "$LE_SSL" = "yes" ]; then #Disabled 'til fixed upstream #bash /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh - echo "#Set and upgrade certbot PPA if posssible..." - if [ "$CERTBOT_REPO" = "certbot" ]; then - echo -e "\nCerbot repository already on the system!\nChecking for updates...\n" - apt-get -q2 update - apt-get -yq2 dist-upgrade - elif [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "200" ]; then + echo "#Set and upgrade certbot PPA if posssible..." + if [ "$CERTBOT_REPO" = "certbot" ]; then + echo -e "\nCerbot repository already on the system!\nChecking for updates...\n" + apt-get -q2 update + apt-get -yq2 dist-upgrade + elif [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "200" ]; then echo -e "\nAdding cerbot (formerly letsencrypt) PPA repository for latest updates\n" echo "deb http://ppa.launchpad.net/certbot/certbot/ubuntu $DIST main" > /etc/apt/sources.list.d/certbot.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 75BCA694 apt-get -q2 update apt-get -yq2 dist-upgrade - elif [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "404" ]; then + elif [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "404" ]; then echo -e "\nCertbot PPA is not available for $(lsb_release -sc) just yet, it won't be installed...\n" - fi - + fi else - echo "SSL setup will be skipped." + echo "SSL setup will be skipped." fi } @@ -766,16 +764,15 @@ sed -i "s|// liveStreamingEnabled: false,|liveStreamingEnabled: true,\\ #LocalAudioRecording if [ "$ENABLE_LAR" = "yes" ]; then -echo "# Enabling local recording (audio only)." -LR_STR=$(grep -n "// Local Recording" $MEET_CONF | cut -d ":" -f1) -LR_END=$((LR_STR + 18)) -sed -i "$LR_STR,$LR_END{s|// localRecording: {|localRecording: {|}" $MEET_CONF -sed -i "$LR_STR,$LR_END{s|// enabled: true,|enabled: true,|}" $MEET_CONF -sed -i "$LR_STR,$LR_END{s|// format: 'flac'|format: 'flac'|}" $MEET_CONF -sed -i "$LR_STR,$LR_END{s|// }|}|}" $MEET_CONF - -sed -i "s|'tileview'|'tileview', 'localrecording'|" $INT_CONF -sed -i "s|LOC_REC=.*|LOC_REC=\"on\"|" jitsi-updater.sh + echo "# Enabling local recording (audio only)." + LR_STR=$(grep -n "// Local Recording" $MEET_CONF | cut -d ":" -f1) + LR_END=$((LR_STR + 18)) + sed -i "$LR_STR,$LR_END{s|// localRecording: {|localRecording: {|}" $MEET_CONF + sed -i "$LR_STR,$LR_END{s|// enabled: true,|enabled: true,|}" $MEET_CONF + sed -i "$LR_STR,$LR_END{s|// format: 'flac'|format: 'flac'|}" $MEET_CONF + sed -i "$LR_STR,$LR_END{s|// }|}|}" $MEET_CONF + sed -i "s|'tileview'|'tileview', 'localrecording'|" $INT_CONF + sed -i "s|LOC_REC=.*|LOC_REC=\"on\"|" jitsi-updater.sh fi #Setup main language @@ -789,7 +786,7 @@ fi # Recording directory if [ ! -d $DIR_RECORD ]; then -mkdir $DIR_RECORD + mkdir $DIR_RECORD fi chown -R jibri:jibri $DIR_RECORD @@ -1001,7 +998,7 @@ elif [ "$DROP_TLS1" = "yes" ] && [ "$DIST" = "xenial" ];then elif [ "$DROP_TLS1" = "no" ];then echo "No TLSv1/1.1 dropping was done." else -echo "No condition meet, please report to + echo "No condition meet, please report to https://github.com/switnet-ltd/quick-jibri-installer/issues " fi @@ -1012,28 +1009,28 @@ sed -i "s|'videobackgroundblur', ||" $INT_CONF ###Setup secure rooms if [ "$ENABLE_SC" = "yes" ]; then -SRP_STR=$(grep -n "VirtualHost \"$DOMAIN\"" $PROSODY_FILE | head -n1 | cut -d ":" -f1) -SRP_END=$((SRP_STR + 10)) -sed -i "$SRP_STR,$SRP_END{s|authentication = \"anonymous\"|authentication = \"internal_plain\"|}" $PROSODY_FILE -sed -i "s|// anonymousdomain: 'guest.example.com'|anonymousdomain: \'guest.$DOMAIN\'|" $MEET_CONF + SRP_STR=$(grep -n "VirtualHost \"$DOMAIN\"" $PROSODY_FILE | head -n1 | cut -d ":" -f1) + SRP_END=$((SRP_STR + 10)) + sed -i "$SRP_STR,$SRP_END{s|authentication = \"anonymous\"|authentication = \"internal_plain\"|}" $PROSODY_FILE + sed -i "s|// anonymousdomain: 'guest.example.com'|anonymousdomain: \'guest.$DOMAIN\'|" $MEET_CONF -#Secure room initial user -read -p "Set username for secure room moderator: "$'\n' -r SEC_ROOM_USER -read -p "Secure room moderator password: "$'\n' -r SEC_ROOM_PASS -prosodyctl register $SEC_ROOM_USER $DOMAIN $SEC_ROOM_PASS + #Secure room initial user + read -p "Set username for secure room moderator: "$'\n' -r SEC_ROOM_USER + read -p "Secure room moderator password: "$'\n' -r SEC_ROOM_PASS + prosodyctl register $SEC_ROOM_USER $DOMAIN $SEC_ROOM_PASS -echo -e "\nSecure rooms are being enabled..." -echo "You'll be able to login Secure Room chat with '${SEC_ROOM_USER}' \ + echo -e "\nSecure rooms are being enabled..." + echo "You'll be able to login Secure Room chat with '${SEC_ROOM_USER}' \ or '${SEC_ROOM_USER}@${DOMAIN}' using the password you just entered. If you have issues with the password refer to your sysadmin." -sed -i "s|#org.jitsi.jicofo.auth.URL=XMPP:|org.jitsi.jicofo.auth.URL=XMPP:|" $JICOFO_SIP -sed -i "s|SEC_ROOM=.*|SEC_ROOM=\"on\"|" jm-bm.sh + sed -i "s|#org.jitsi.jicofo.auth.URL=XMPP:|org.jitsi.jicofo.auth.URL=XMPP:|" $JICOFO_SIP + sed -i "s|SEC_ROOM=.*|SEC_ROOM=\"on\"|" jm-bm.sh fi ###JWT if [ "$ENABLE_JWT" = "yes" ]; then -echo -e "\nJWT auth is being setup..." -bash $PWD/mode/jwt.sh + echo -e "\nJWT auth is being setup..." + bash $PWD/mode/jwt.sh fi #Guest allow @@ -1104,9 +1101,9 @@ sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" $MEET_CONF echo -e "\n# Checking $MEET_CONF file for errors\n" CHECKJS=$(esvalidate $MEET_CONF| cut -d ":" -f2) if [[ -z "$CHECKJS" ]]; then -echo -e "\n# The $MEET_CONF configuration seems correct. =)\n" + echo -e "\n# The $MEET_CONF configuration seems correct. =)\n" else -echo " + echo " Watch out!, there seems to be an issue on $MEET_CONF line: $CHECKJS Most of the times this is due upstream changes, please report to @@ -1131,13 +1128,13 @@ fi enable_letsencrypt if [ "$ENABLE_SC" = "yes" ];then -echo "Waiting prosody restart to continue configuration, 15s..." -wait_seconds 15 + echo "Waiting prosody restart to continue configuration, 15s..." + wait_seconds 15 #Move mucs when using secure rooms - https://community.jitsi.org/t/27752/112 #Change back - https://community.jitsi.org/t/64769/136 #sed -i "s| lobby_muc = \"lobby.|-- lobby_muc = \"lobby.|" $PROSODY_FILE #sed -i "s| main_muc = \"conference.|-- main_muc = \"conference.|" $PROSODY_FILE -sed -i "s| muc_lobby_whitelist = { \"recorder.*| muc_lobby_whitelist = { \"recorder.$DOMAIN\", \"auth.$DOMAIN\" }|" $PROSODY_FILE + sed -i "s| muc_lobby_whitelist = { \"recorder.*| muc_lobby_whitelist = { \"recorder.$DOMAIN\", \"auth.$DOMAIN\" }|" $PROSODY_FILE #EO_TF fi @@ -1191,7 +1188,7 @@ if [ "$ENABLE_TRANSCRIPT" = "yes" ]; then #if [ "$MODE" = "debug" ]; then # bash $PWD/jigasi.sh -m debug #else - bash $PWD/jigasi.sh + bash $PWD/jigasi.sh #fi fi { diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index e7fc46a..cfa6be5 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -154,8 +154,8 @@ if [ -z $SND_AL_MODULE ]; then please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." echo "# Check and Install HWE kernel if possible..." if uname -r | grep -q aws;then - KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|head -n1|awk '{print$3}'|cut -d "." -f1-4)" - KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg | grep generic | grep -v recovery | awk '{print$3,$4}'|grep $KNL_HWE)" + KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|awk 'NR__1{print$3}'|cut -d "." -f1-4)" + KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg|awk '!/recovery/&&/generic/{print$3,$4}'|grep $KNL_HWE)" if [ ! -z "$KNL_MENU" ];then echo -e "\nSeems you are using an AWS kernel \xE2\x9C\x96 <== IMPORTANT! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ echo -e "\n > $KNL_MENU" @@ -193,13 +193,13 @@ if [ -f ${CONF_JSON}_disabled ] && \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" T6=1 elif [ ! -f $CONF_JSON ] && \ - [ -f $JIBRI_CONF ] && \ - [ -f ${JIBRI_CONF}-dpkg-file ]; then + [ -f $JIBRI_CONF ] && \ + [ -f ${JIBRI_CONF}-dpkg-file ]; then echo -e "\n> This jibri seems to be running the lastest configuration already. \xE2\x9C\x94 \n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" T6=1 elif [ -f ${CONF_JSON} ] && \ - [ -f $JIBRI_CONF ]; then + [ -f $JIBRI_CONF ]; then echo -e "\n> This jibri config seems to be candidate for upgrading. \xE2\x9C\x96 \nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" T6=0