From ad8c4af3b82ad2de66b992d70b1515019b887bc0 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Apr 2021 17:13:19 -0500 Subject: [PATCH 1/7] Fix indentation Avoid force exit on DNS fail. --- jitsi-updater.sh | 6 +- quick_jibri_installer.sh | 477 ++++++++++++++++++++------------------- 2 files changed, 244 insertions(+), 239 deletions(-) diff --git a/jitsi-updater.sh b/jitsi-updater.sh index 5b9c1b0..16639bd 100644 --- a/jitsi-updater.sh +++ b/jitsi-updater.sh @@ -45,7 +45,7 @@ if [ -z $CHDB ]; then echo "Seems no chromedriver installed" else CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')" - CHD_VER_2D="$(echo $CHD_VER_LOCAL|cut -d "." -f 1,2)" + CHD_VER_2D="$(echo $CHD_VER_LOCAL|awk '{printf "%.1f\n", $NF}')" fi # True if $1 is greater than $2 @@ -85,7 +85,7 @@ update_google_repo() { echo "No Google repository found" fi } -GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{print$3}'|cut -d "." -f 1,2)" +GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')" upgrade_cd() { if [ ! -z $GOOGL_VER_2D ]; then if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \ @@ -97,7 +97,7 @@ if [ ! -z $GOOGL_VER_2D ]; then chown root:root $CHDB chmod 0755 $CHDB rm -rf /tpm/chromedriver_linux64.zip - printf "Current version: ${Green} "$($CHDB -v | awk '{print $2}'|cut -d "." -f 1,2)" ${Color_Off}\n" + printf "Current version: ${Green} "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')" ${Color_Off}\n" else echo "No need to upgrade Chromedriver" printf "Current version: ${Green} $CHD_VER_2D ${Color_Off}\n" diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index b9ca21f..68b6a22 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -7,11 +7,11 @@ echo "Started at $(date +'%Y-%m-%d %H:%M:%S')" >> qj-installer.log while getopts m: option do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo ./quick_jibri_installer.sh [-m debug]" && exit;; - esac + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./quick_jibri_installer.sh [-m debug]" && exit;; + esac done #DEBUG @@ -32,12 +32,12 @@ CR=`echo $'\n> '` exit_ifinstalled() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo " + echo " This instance already has $1 installed, exiting... Please try again on a clean system. If you think this is an error, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues" - exit + exit fi } exit_ifinstalled jitsi-meet @@ -50,18 +50,18 @@ DIST="bionic" fi install_ifnot() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo " $1 is installed, skipping..." + echo " $1 is installed, skipping..." else - echo -e "\n---- Installing $1 ----" - apt-get -yq2 install $1 + echo -e "\n---- Installing $1 ----" + apt-get -yq2 install $1 fi } check_serv() { if [ "$APACHE_2" -eq 1 ]; then - echo " + echo " The recommended setup is using NGINX, exiting... " - exit + exit elif [ "$NGINX" -eq 1 ]; then echo " @@ -69,10 +69,10 @@ Webserver already installed! " else - echo " + echo " Installing nginx webserver! " - install_ifnot nginx + install_ifnot nginx fi } check_snd_driver() { @@ -80,12 +80,12 @@ echo -e "\n# Checking ALSA - Loopback module..." echo "snd-aloop" | tee -a /etc/modules modprobe snd-aloop if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then - echo " + echo " #----------------------------------------------------------------------- # Audio driver seems - OK. #-----------------------------------------------------------------------" else - echo " + echo " #----------------------------------------------------------------------- # Your audio driver might not be able to load. # We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. @@ -106,10 +106,10 @@ var_dlim() { add_prosody_repo() { echo "Add Prosody repo" if [ "$PROSODY_REPO" = "main" ]; then - echo "Prosody repository already installed" + echo "Prosody repository already installed" else - echo "deb http://packages.prosody.im/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/prosody.list - wget -qO - https://prosody.im/files/prosody-debian-packages.key | apt-key add - + echo "deb http://packages.prosody.im/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/prosody.list + wget -qO - https://prosody.im/files/prosody-debian-packages.key | apt-key add - fi } dpkg-compare() { @@ -151,12 +151,12 @@ fi if [ "$DIST" = "xenial" ] || \ [ "$DIST" = "bionic" ] || \ [ "$DIST" = "focal" ]; then - echo "OS: $(lsb_release -sd)" - echo "Good, this is a supported platform!" + echo "OS: $(lsb_release -sd)" + echo "Good, this is a supported platform!" else - echo "OS: $(lsb_release -sd)" - echo "Sorry, this platform is not supported... exiting" - exit + echo "OS: $(lsb_release -sd)" + echo "Sorry, this platform is not supported... exiting" + exit fi #Suggest 18.04 LTS release over 16.04 if [ "$DIST" = "xenial" ]; then @@ -243,11 +243,11 @@ add_prosody_repo # Jitsi-Meet Repo echo -e "\nAdd Jitsi repo\n" if [ "$JITSI_REPO" = "stable" ]; then - echo "Jitsi stable repository already installed" + echo "Jitsi stable repository already installed" else - echo 'deb http://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list - wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - - JITSI_REPO="stable" + echo 'deb http://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list + wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - + JITSI_REPO="stable" fi #Default to LE SSL? while [[ "$LE_SSL" != "yes" && "$LE_SSL" != "no" ]] @@ -267,9 +267,9 @@ if [ "$LE_SSL" = "yes" ]; then 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." + echo "Alright, let's use $JITSI_DOMAIN." else - echo "Please try again." + echo "Please try again." fi done @@ -279,9 +279,14 @@ if [ "$LE_SSL" = "yes" ]; then " 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. Exiting for now... -" - exit + 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 + echo " - We'll continue anyway..." + else + echo " - Exiting for now..." + exit + fi fi fi # Requirements @@ -290,22 +295,22 @@ 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 \ - letsencrypt + letsencrypt fi echo "# Check and Install HWE kernel if possible..." @@ -327,13 +332,13 @@ echo " #-------------------------------------------------- " if [ "$LE_SSL" = "yes" ]; then -echo "set jitsi-meet/cert-choice select Generate a new self-signed certificate (You will later get a chance to obtain a Let's encrypt certificate)" | debconf-set-selections -echo "jitsi-videobridge2 jitsi-videobridge/jvb-hostname string $JITSI_DOMAIN" | debconf-set-selections +echo "set jitsi-meet/cert-choice select Generate a new self-signed certificate (You will later get a chance to obtain a Let's encrypt certificate)" | debconf-set-selections +echo "jitsi-videobridge2 jitsi-videobridge/jvb-hostname string $JITSI_DOMAIN" | debconf-set-selections fi apt-get -y install \ - jitsi-meet \ - jibri \ - openjdk-8-jre-headless + jitsi-meet \ + jibri \ + openjdk-8-jre-headless # Fix RAND_load_file error #https://github.com/openssl/openssl/issues/7754#issuecomment-444063355 @@ -345,19 +350,19 @@ echo " #-------------------------------------------------- " if [ "$(dpkg-query -W -f='${Status}' nodejs 2>/dev/null | grep -c "ok")" == "1" ]; then - echo "Nodejs is installed, skipping..." + 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 + 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 - echo "Installing nodejs esprima package..." - npm install -g esprima + echo "Installing nodejs esprima package..." + npm install -g esprima elif [ "$(npm list -g esprima 2>/dev/null | grep -c "esprima")" == "1" ]; then - echo "Good. Esprima package is already installed" + echo "Good. Esprima package is already installed" fi CHD_LTST=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE) @@ -365,26 +370,26 @@ GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json" echo "# Installing Google Chrome / ChromeDriver" if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then - echo "Google repository already set." + echo "Google repository already set." else - echo "Installing Google Chrome Stable" - wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee $GOOGL_REPO + echo "Installing Google Chrome Stable" + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - + echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee $GOOGL_REPO fi apt-get -q2 update apt-get install -yq2 google-chrome-stable rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list if [ -f /usr/local/bin/chromedriver ]; then - echo "Chromedriver already installed." + echo "Chromedriver already installed." else - echo "Installing Chromedriver" - wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \ - -O /tmp/chromedriver_linux64.zip - unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/ - chown root:root /usr/local/bin/chromedriver - chmod 0755 /usr/local/bin/chromedriver - rm -rf /tpm/chromedriver_linux64.zip + echo "Installing Chromedriver" + wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \ + -O /tmp/chromedriver_linux64.zip + unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/ + chown root:root /usr/local/bin/chromedriver + chmod 0755 /usr/local/bin/chromedriver + rm -rf /tpm/chromedriver_linux64.zip fi echo " @@ -466,9 +471,9 @@ 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." + echo "TLSv1.0/1.1 will remain." elif [ "$DROP_TLS1" = "yes" ]; then - echo "TLSv1.0/1.1 will be dropped" + echo "TLSv1.0/1.1 will be dropped" fi done #Dropbox -- no longer requirement for localrecording @@ -476,9 +481,9 @@ done #do #read -p "> Do you want to setup the Dropbox feature now: (yes or no)"$'\n' -r ENABLE_DB #if [ $ENABLE_DB = no ]; then -# echo "Dropbox won't be enable" +# echo "Dropbox won't be enable" #elif [ $ENABLE_DB = yes ]; then -# read -p "Please set your Drobbox App key: "$'\n' -r DB_CID +# read -p "Please set your Drobbox App key: "$'\n' -r DB_CID #fi #done #Brandless Mode @@ -486,9 +491,9 @@ 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." + echo "Brandless mode won't be set." elif [ "$ENABLE_BLESSM" = "yes" ]; then - echo "Brandless mode will be set." + echo "Brandless mode will be set." fi done #Welcome Page @@ -496,9 +501,9 @@ 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." + echo "Welcome page will be disabled." elif [ "$ENABLE_WELCP" = "no" ]; then - echo "Welcome page will be enabled." + echo "Welcome page will be enabled." fi done #Enable static avatar @@ -506,9 +511,9 @@ 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" + echo "Static avatar won't be enabled" elif [ "$ENABLE_SA" = "yes" ]; then - echo "Static avatar will be enabled" + echo "Static avatar will be enabled" fi done # #Enable local audio recording - disabling @@ -516,9 +521,9 @@ done #do #read -p "> Do you want to enable local audio recording option?: (yes or no)"$'\n' -r ENABLE_LAR #if [ "$ENABLE_LAR" = "no" ]; then -# echo "Local audio recording option won't be enabled" +# echo "Local audio recording option won't be enabled" #elif [ "$ENABLE_LAR" = "yes" ]; then -# echo "Local audio recording option will be enabled" +# echo "Local audio recording option will be enabled" #fi #done @@ -527,11 +532,11 @@ done #do #read -p "> Do you want to enable secure rooms?: (yes or no)"$'\n' -r ENABLE_SC #if [ "$ENABLE_SC" = "no" ]; then -# echo "-- Secure rooms won't be enabled." +# echo "-- Secure rooms won't be enabled." #elif [ "$ENABLE_SC" = "yes" ]; then -# echo "-- Secure rooms will be enabled." -# read -p "Set username for secure room moderator: "$'\n' -r SEC_ROOM_USER -# read -p "Secure room moderator password: "$'\n' -r SEC_ROOM_PASS +# echo "-- Secure rooms will be enabled." +# read -p "Set username for secure room moderator: "$'\n' -r SEC_ROOM_USER +# read -p "Secure room moderator password: "$'\n' -r SEC_ROOM_PASS #fi #done echo " @@ -566,29 +571,29 @@ do 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" + 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" + 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 - echo "> Sorry Google SDK doesn't have support yet for $(lsb_release -sd), + echo "> Sorry Google SDK doesn't have support yet for $(lsb_release -sd), thus, Jigasi Transcript can't be enable. " elif [ "$(curl -s -o /dev/null -w "%{http_code}" $GC_SDK_REL_FILE )" == "200" ]; then - while [[ "$ENABLE_TRANSCRIPT" != "yes" && "$ENABLE_TRANSCRIPT" != "no" ]] - do + while [[ "$ENABLE_TRANSCRIPT" != "yes" && "$ENABLE_TRANSCRIPT" != "no" ]] + do 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 - done + 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 + echo "No valid option for Jigasi. Please report this to https://github.com/switnet-ltd/quick-jibri-installer/issues " fi #Grafana @@ -597,9 +602,9 @@ do read -p "> Do you want to setup Grafana Dashboard: (yes or no) ( Please check requirements at: https://github.com/switnet-ltd/quick-jibri-installer )"$'\n' -r ENABLE_GRAFANA_DSH if [ "$ENABLE_GRAFANA_DSH" = "no" ]; then - echo -e "-- Grafana Dashboard won't be enabled.\n" + echo -e "-- Grafana Dashboard won't be enabled.\n" elif [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then - echo -e "-- Grafana Dashboard will be enabled. \n" + echo -e "-- Grafana Dashboard will be enabled. \n" fi done #Docker Etherpad @@ -608,9 +613,9 @@ done #read -p "> Do you want to setup Docker Etherpad: (yes or no) #( Please check requirements at: https://github.com/switnet-ltd/quick-jibri-installer )"$'\n' -r ENABLE_DOCKERPAD #if [ "$ENABLE_DOCKERPAD" = "no" ]; then -# echo -e "-- Docker Etherpad won't be enabled.\n" +# echo -e "-- Docker Etherpad won't be enabled.\n" #elif [ "$ENABLE_DOCKERPAD" = "yes" ]; then -# echo -e "-- Docker Etherpad will be enabled.\n" +# echo -e "-- Docker Etherpad will be enabled.\n" #fi #done #Start configuration @@ -627,13 +632,13 @@ WAN_IP=$(dig +short myip.opendns.com @resolver1.opendns.com) ssl_wa() { if [ "$LE_SSL" = "yes" ]; then systemctl stop $1 - letsencrypt certonly --standalone --renew-by-default --agree-tos --email $5 -d $6 - sed -i "s|/etc/jitsi/meet/$3.crt|/etc/letsencrypt/live/$3/fullchain.pem|" $4 - sed -i "s|/etc/jitsi/meet/$3.key|/etc/letsencrypt/live/$3/privkey.pem|" $4 + letsencrypt certonly --standalone --renew-by-default --agree-tos --email $5 -d $6 + sed -i "s|/etc/jitsi/meet/$3.crt|/etc/letsencrypt/live/$3/fullchain.pem|" $4 + sed -i "s|/etc/jitsi/meet/$3.key|/etc/letsencrypt/live/$3/privkey.pem|" $4 systemctl restart $1 - #Add cron - crontab -l | { cat; echo "@weekly certbot renew --${2} > $LE_RENEW_LOG 2>&1"; } | crontab - - crontab -l + #Add cron + crontab -l | { cat; echo "@weekly certbot renew --${2} > $LE_RENEW_LOG 2>&1"; } | crontab - + crontab -l fi } @@ -649,17 +654,17 @@ if [ "$LE_SSL" = "yes" ]; 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 + 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 + 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 - echo -e "\nCertbot PPA is not available for $(lsb_release -sc) just yet, it won't be installed...\n" + echo -e "\nCertbot PPA is not available for $(lsb_release -sc) just yet, it won't be installed...\n" fi else @@ -670,20 +675,20 @@ fi check_jibri() { if [ "$(dpkg-query -W -f='${Status}' "jibri" 2>/dev/null | grep -c "ok installed")" == "1" ] then - systemctl restart jibri - systemctl restart jibri-icewm - systemctl restart jibri-xorg + systemctl restart jibri + systemctl restart jibri-icewm + systemctl restart jibri-xorg else - echo "Jibri service not installed" + echo "Jibri service not installed" fi } # Restarting services restart_services() { - systemctl restart jitsi-videobridge2 - systemctl restart jicofo - systemctl restart prosody - check_jibri + systemctl restart jitsi-videobridge2 + systemctl restart jicofo + systemctl restart prosody + check_jibri } # Configure Jvb2 @@ -722,10 +727,10 @@ sed -i "/c2s_require_encryption = false/a \\ consider_bosh_secure = true" $PROSODY_SYS if [ ! -z $L10N_PARTICIPANT ]; then - sed -i "s|PART_USER=.*|PART_USER=\"$L10N_PARTICIPANT\"|" jm-bm.sh + sed -i "s|PART_USER=.*|PART_USER=\"$L10N_PARTICIPANT\"|" jm-bm.sh fi if [ ! -z $L10N_ME ]; then - sed -i "s|LOCAL_USER=.*|LOCAL_USER=\"$L10N_ME\"|" jm-bm.sh + sed -i "s|LOCAL_USER=.*|LOCAL_USER=\"$L10N_ME\"|" jm-bm.sh fi @@ -775,11 +780,11 @@ fi #Setup main language if [ -z $JB_LANG ] || [ "$JB_LANG" = "en" ]; then - echo "Leaving English (en) as default language..." - sed -i "s|// defaultLanguage: 'en',|defaultLanguage: 'en',|" $MEET_CONF + echo "Leaving English (en) as default language..." + sed -i "s|// defaultLanguage: 'en',|defaultLanguage: 'en',|" $MEET_CONF else - echo "Changing default language to: $JB_LANG" - sed -i "s|// defaultLanguage: 'en',|defaultLanguage: \'$JB_LANG\',|" $MEET_CONF + echo "Changing default language to: $JB_LANG" + sed -i "s|// defaultLanguage: 'en',|defaultLanguage: \'$JB_LANG\',|" $MEET_CONF fi # Recording directory @@ -836,57 +841,57 @@ jibri { xmpp { environments = [ { - // A user-friendly name for this environment - name = "$JB_NAME" + // A user-friendly name for this environment + name = "$JB_NAME" - // A list of XMPP server hosts to which we'll connect - xmpp-server-hosts = [ "$DOMAIN" ] + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ "$DOMAIN" ] - // The base XMPP domain - xmpp-domain = "$DOMAIN" + // The base XMPP domain + xmpp-domain = "$DOMAIN" - // The MUC we'll join to announce our presence for - // recording and streaming services - control-muc { - domain = "internal.auth.$DOMAIN" - room-name = "$JibriBrewery" - nickname = "Live" - } + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "internal.auth.$DOMAIN" + room-name = "$JibriBrewery" + nickname = "Live" + } - // The login information for the control MUC - control-login { - domain = "auth.$DOMAIN" - username = "jibri" - password = "$JB_AUTH_PASS" - } + // The login information for the control MUC + control-login { + domain = "auth.$DOMAIN" + username = "jibri" + password = "$JB_AUTH_PASS" + } - // An (optional) MUC configuration where we'll - // join to announce SIP gateway services - // sip-control-muc { - // domain = "domain" - // room-name = "room-name" - // nickname = "nickname" - // } + // An (optional) MUC configuration where we'll + // join to announce SIP gateway services + // sip-control-muc { + // domain = "domain" + // room-name = "room-name" + // nickname = "nickname" + // } - // The login information the selenium web client will use - call-login { - domain = "recorder.$DOMAIN" - username = "recorder" - password = "$JB_REC_PASS" - } + // The login information the selenium web client will use + call-login { + domain = "recorder.$DOMAIN" + username = "recorder" + password = "$JB_REC_PASS" + } - // The value we'll strip from the room JID domain to derive - // the call URL - strip-from-room-domain = "conference." + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "conference." - // How long Jibri sessions will be allowed to last before - // they are stopped. A value of 0 allows them to go on - // indefinitely - usage-timeout = 0 hour + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = 0 hour - // Whether or not we'll automatically trust any cert on - // this XMPP domain - trust-all-xmpp-certs = true + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = true } ] } @@ -963,38 +968,38 @@ sed -i "s|MJS_USER_PASS=.*|MJS_USER_PASS=\"$MJS_USER_PASS\"|" add-jvb2-node.sh #Tune webserver for Jitsi App control if [ -f $WS_CONF ]; then - sed -i "/Anything that didn't match above/i \\\n" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ location = \/external_api.min.js {" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ alias \/usr\/share\/jitsi-meet\/libs\/external_api.min.js;" $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 - systemctl reload nginx + sed -i "/Anything that didn't match above/i \\\n" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ location = \/external_api.min.js {" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ alias \/usr\/share\/jitsi-meet\/libs\/external_api.min.js;" $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 + systemctl reload nginx else - echo "No app configuration done to server file, please report to: + echo "No app configuration done to server file, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues" fi #Static avatar if [ "$ENABLE_SA" = "yes" ] && [ -f $WS_CONF ]; then - #wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png - cp images/avatar2.png /usr/share/jitsi-meet/images/ - sed -i "/location \/external_api.min.js/i \ \ \ \ location \~ \^\/avatar\/\(.\*\)\\\.png {" $WS_CONF - sed -i "/location \/external_api.min.js/i \ \ \ \ \ \ \ \ alias /usr/share/jitsi-meet/images/avatar2.png;" $WS_CONF - sed -i "/location \/external_api.min.js/i \ \ \ \ }\\ + #wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png + cp images/avatar2.png /usr/share/jitsi-meet/images/ + sed -i "/location \/external_api.min.js/i \ \ \ \ location \~ \^\/avatar\/\(.\*\)\\\.png {" $WS_CONF + sed -i "/location \/external_api.min.js/i \ \ \ \ \ \ \ \ alias /usr/share/jitsi-meet/images/avatar2.png;" $WS_CONF + sed -i "/location \/external_api.min.js/i \ \ \ \ }\\ \ " $WS_CONF - sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'https://$DOMAIN/avatar/\'|" $INT_CONF - sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF + sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'https://$DOMAIN/avatar/\'|" $INT_CONF + sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF fi #nginx -tlsv1/1.1 if [ "$DROP_TLS1" = "yes" ] && [ "$DIST" != "xenial" ];then - echo -e "\nDropping TLSv1/1.1 in favor of v1.3" - sed -i "s|TLSv1 TLSv1.1|TLSv1.3|" /etc/nginx/nginx.conf - #sed -i "s|TLSv1 TLSv1.1|TLSv1.3|" $WS_CONF + echo -e "\nDropping TLSv1/1.1 in favor of v1.3" + sed -i "s|TLSv1 TLSv1.1|TLSv1.3|" /etc/nginx/nginx.conf + #sed -i "s|TLSv1 TLSv1.1|TLSv1.3|" $WS_CONF elif [ "$DROP_TLS1" = "yes" ] && [ "$DIST" = "xenial" ];then - echo -e "\nOnly dropping TLSv1/1.1" - sed -i "s|TLSv1 TLSv1.1||" /etc/nginx/nginx.conf - sed -i "s| TLSv1.3||" $WS_CONF + echo -e "\nOnly dropping TLSv1/1.1" + sed -i "s|TLSv1 TLSv1.1||" /etc/nginx/nginx.conf + sed -i "s| TLSv1.3||" $WS_CONF elif [ "$DROP_TLS1" = "no" ];then - echo "No TLSv1/1.1 dropping was done." + echo "No TLSv1/1.1 dropping was done." else echo "No condition meet, please report to https://github.com/switnet-ltd/quick-jibri-installer/issues " @@ -1064,9 +1069,9 @@ sed -i "s|// startAudioMuted: 10,|startAudioMuted: 1,|" $MEET_CONF #Disable/enable welcome page if [ "$ENABLE_WELCP" = "yes" ]; then - sed -i "s|.*enableWelcomePage:.*| enableWelcomePage: false,|" $MEET_CONF + sed -i "s|.*enableWelcomePage:.*| enableWelcomePage: false,|" $MEET_CONF elif [ "$ENABLE_WELCP" = "no" ]; then - sed -i "s|.*enableWelcomePage:.*| enableWelcomePage: true,|" $MEET_CONF + sed -i "s|.*enableWelcomePage:.*| enableWelcomePage: true,|" $MEET_CONF fi #Set displayname as not required since jibri can't set it up. sed -i "s|// requireDisplayName: true,|requireDisplayName: false,|" $MEET_CONF @@ -1142,16 +1147,16 @@ chmod -R 650 /etc/prosody/certs/ #SSL workaround if [ "$(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then - ssl_wa nginx nginx $DOMAIN $WS_CONF $SYSADMIN_EMAIL $DOMAIN - install_ifnot python3-certbot-nginx + ssl_wa nginx nginx $DOMAIN $WS_CONF $SYSADMIN_EMAIL $DOMAIN + install_ifnot python3-certbot-nginx else - echo "No webserver found please report." + echo "No webserver found please report." fi #Brandless Mode if [ "$ENABLE_BLESSM" = "yes" ]; then - echo "Custom brandless mode will be enabled." - sed -i "s|ENABLE_BLESSM=.*|ENABLE_BLESSM=\"on\"|" jitsi-updater.sh - bash $PWD/jm-bm.sh + echo "Custom brandless mode will be enabled." + sed -i "s|ENABLE_BLESSM=.*|ENABLE_BLESSM=\"on\"|" jitsi-updater.sh + bash $PWD/jm-bm.sh fi # Applying best practives for interface config.js echo -e "\n> Setting up custom interface_config.js according to best practices." @@ -1159,58 +1164,58 @@ cp "$INT_CONF" "$INT_CONF_ETC" #Tune webserver for interface_config.js if [ -f $WS_CONF ]; then - sed -i "/external_api.js/i \\\n" $WS_CONF - sed -i "/external_api.js/i \ \ \ \ location = \/interface_config.js {" $WS_CONF - sed -i "/external_api.js/i \ \ \ \ \ \ \ \ alias \/etc\/jitsi\/meet\/$DOMAIN-interface_config.js;" $WS_CONF - sed -i "/external_api.js/i \ \ \ \ }" $WS_CONF - sed -i "/external_api.js/i \\\n" $WS_CONF - systemctl reload nginx + sed -i "/external_api.js/i \\\n" $WS_CONF + sed -i "/external_api.js/i \ \ \ \ location = \/interface_config.js {" $WS_CONF + sed -i "/external_api.js/i \ \ \ \ \ \ \ \ alias \/etc\/jitsi\/meet\/$DOMAIN-interface_config.js;" $WS_CONF + sed -i "/external_api.js/i \ \ \ \ }" $WS_CONF + sed -i "/external_api.js/i \\\n" $WS_CONF + systemctl reload nginx else - echo "No interface_config.js configuration done to server file, please report to: + echo "No interface_config.js configuration done to server file, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues" fi #JRA via Nextcloud if [ "$ENABLE_NC_ACCESS" = "yes" ]; then - echo -n "\nJRA via Nextcloud will be enabled." - if [ "$MODE" = "debug" ]; then - bash $PWD/jra_nextcloud.sh -m debug - else - bash $PWD/jra_nextcloud.sh - fi + echo -n "\nJRA via Nextcloud will be enabled." + if [ "$MODE" = "debug" ]; then + bash $PWD/jra_nextcloud.sh -m debug + else + bash $PWD/jra_nextcloud.sh + fi fi } > >(tee -a qj-installer.log) 2> >(tee -a qj-installer.log >&2) #Jigasi Transcript if [ "$ENABLE_TRANSCRIPT" = "yes" ]; then - echo -e "\nJigasi Transcription will be enabled." - # ToDo: Analyze behavior on debug - #if [ "$MODE" = "debug" ]; then - # bash $PWD/jigasi.sh -m debug - #else - bash $PWD/jigasi.sh - #fi + echo -e "\nJigasi Transcription will be enabled." + # ToDo: Analyze behavior on debug + #if [ "$MODE" = "debug" ]; then + # bash $PWD/jigasi.sh -m debug + #else + bash $PWD/jigasi.sh + #fi fi { #Grafana Dashboard if [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then - echo -e "\nGrafana Dashboard will be enabled." - if [ "$MODE" = "debug" ]; then - bash $PWD/grafana.sh -m debug - else - bash $PWD/grafana.sh - fi + echo -e "\nGrafana Dashboard will be enabled." + if [ "$MODE" = "debug" ]; then + bash $PWD/grafana.sh -m debug + else + bash $PWD/grafana.sh + fi fi #Docker Etherpad if [ "$ENABLE_DOCKERPAD" = "yes" ]; then - echo -e "\nDocker Etherpad will be enabled." - if [ "$MODE" = "debug" ]; then - bash $PWD/etherpad.sh -m debug - else - bash $PWD/etherpad.sh - fi + echo -e "\nDocker Etherpad will be enabled." + if [ "$MODE" = "debug" ]; then + bash $PWD/etherpad.sh -m debug + else + bash $PWD/etherpad.sh + fi fi #Prevent Jibri conecction issue if [ -z "$(grep -n $DOMAIN /etc/hosts)" ];then -sed -i "/127.0.0.1/a \\ + sed -i "/127.0.0.1/a \\ 127.0.0.1 $DOMAIN" /etc/hosts else echo "Local host already in place..." From 7f13eeafb39aaa21a44ba2c39b85ffa5952a97ea Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Apr 2021 22:58:35 -0500 Subject: [PATCH 2/7] Improve check on variables and logic Change indenting --- add-jibri-node.sh | 249 +++++++++++++++++++++++++--------------------- 1 file changed, 138 insertions(+), 111 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 2782034..e8cbbe2 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -9,18 +9,18 @@ #Make sure the file name is the required one if [ ! "$(basename $0)" = "add-jibri-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-jibri-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-jibri-node.sh', and run again." + exit fi while getopts m: option do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo ./add_jibri_node.sh [-m debug]" && exit;; - esac + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./add_jibri_node.sh [-m debug]" && exit;; + esac done #DEBUG @@ -66,33 +66,75 @@ TEST_JIBRI_ENV="$GITHUB_RAW/$GIT_REPO/unstable/tools/test-jibri-env.sh" # sed limiters for add-jibri-node.sh variables var_dlim() { - grep -n $1 add-jibri-node.sh|head -n1|cut -d ":" -f1 + grep -n $1 add-jibri-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 [ "$2" = "TBD" ]; then + echo -e "Check if variable $1 is set: \xE2\x9C\x96" + 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 +echo " +#----------------------------------------------------------------------- +# Checking initial necessary variables... +#-----------------------------------------------------------------------" + +JMS_DATA=($MAIN_SRV_DIST \ + $MAIN_SRV_REPO \ + $MAIN_SRV_DOMAIN \ + $JibriBrewery \ + $JB_NAME \ + $JB_AUTH_PASS \ + $JB_REC_PASS \ + $MJS_USER \ + $MJS_USER_PASS) + +JMS_EVAL=${JMS_DATA[0]} +for i in "${JMS_DATA[@]}"; do + if [[ "$JMS_EVAL" != "$i" ]]; then + ALL_TBD="no" + break + fi +done +if [ "$ALL_TBD" = "no" ];then + echo -e "Good, seems this is not a vanilla copy of add-jibri-node.sh, +let's check variables ...\n" +else + echo -e "You seem to be using a vanilla copy of the add-jibri-node.sh. + > Please use the content (or apply the changes) of add-jibri-node.sh from + the main Jitsi server installation folder, as it contains necessary data.\n" + exit +fi + +check_var MAIN_SRV_DIST "$MAIN_SRV_DIST" +check_var MAIN_SRV_REPO "$MAIN_SRV_REPO" +check_var MAIN_SRV_DOMAIN "$MAIN_SRV_DOMAIN" +check_var JibriBrewery "$JibriBrewery" +check_var JB_NAME "$JB_NAME" +check_var JB_AUTH_PASS "$JB_AUTH_PASS" +check_var JB_REC_PASS "$JB_REC_PASS" +check_var MJS_USER "$MJS_USER" +check_var MJS_USER_PASS "$MJS_USER_PASS" + #Check server and node OS if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then - echo "Please use the same OS for the jibri 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 jibri 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 @@ -140,21 +182,6 @@ else done fi -echo " -#----------------------------------------------------------------------- -# Checking initial necessary variables... -#-----------------------------------------------------------------------" - -check_var MAIN_SRV_DIST "$MAIN_SRV_DIST" -check_var MAIN_SRV_REPO "$MAIN_SRV_REPO" -check_var MAIN_SRV_DOMAIN "$MAIN_SRV_DOMAIN" -check_var JibriBrewery "$JibriBrewery" -check_var JB_NAME "$JB_NAME" -check_var JB_AUTH_PASS "$JB_AUTH_PASS" -check_var JB_REC_PASS "$JB_REC_PASS" -check_var MJS_USER "$MJS_USER" -check_var MJS_USER_PASS "$MJS_USER_PASS" - # Rename hostname for each jibri node hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" sed -i "1i 127.0.0.1 jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts @@ -162,15 +189,15 @@ sed -i "1i 127.0.0.1 jbnode${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 @@ -179,30 +206,30 @@ apt-get update -q2 apt-get dist-upgrade -yq2 apt-get -y install \ - apt-show-versions \ - bmon \ - curl \ - ffmpeg \ - git \ - htop \ - inotify-tools \ - jq \ - rsync \ - ssh \ - unzip \ - wget + apt-show-versions \ + bmon \ + curl \ + ffmpeg \ + git \ + htop \ + inotify-tools \ + jq \ + rsync \ + ssh \ + unzip \ + wget check_snd_driver() { echo -e "\n# Checking ALSA - Loopback module..." echo "snd-aloop" | tee -a /etc/modules modprobe snd-aloop if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then - echo " + echo " #----------------------------------------------------------------------- # Audio driver seems - OK. #-----------------------------------------------------------------------" else - echo " + echo " #----------------------------------------------------------------------- # Your audio driver might not be able to load. # We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. @@ -241,25 +268,25 @@ apt-get -y install \ echo "# Installing Google Chrome / ChromeDriver" if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then - echo "Google repository already set." + echo "Google repository already set." else - echo "Installing Google Chrome Stable" - wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee $GOOGL_REPO + echo "Installing Google Chrome Stable" + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - + echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee $GOOGL_REPO fi apt-get -q2 update apt-get install -y google-chrome-stable rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list if [ -f /usr/local/bin/chromedriver ]; then - echo "Chromedriver already installed." + echo "Chromedriver already installed." else - echo "Installing Chromedriver" - wget -q https://chromedriver.storage.googleapis.com/$CHD_VER/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip - unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/ - chown root:root /usr/local/bin/chromedriver - chmod 0755 /usr/local/bin/chromedriver - rm -rf /tpm/chromedriver_linux64.zip + echo "Installing Chromedriver" + wget -q https://chromedriver.storage.googleapis.com/$CHD_VER/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip + unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/ + chown root:root /usr/local/bin/chromedriver + chmod 0755 /usr/local/bin/chromedriver + rm -rf /tpm/chromedriver_linux64.zip fi echo " @@ -333,57 +360,57 @@ jibri { xmpp { environments = [ { - // A user-friendly name for this environment - name = "$JB_NAME" + // A user-friendly name for this environment + name = "$JB_NAME" - // A list of XMPP server hosts to which we'll connect - xmpp-server-hosts = [ "$MAIN_SRV_DOMAIN" ] + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ "$MAIN_SRV_DOMAIN" ] - // The base XMPP domain - xmpp-domain = "$MAIN_SRV_DOMAIN" + // The base XMPP domain + xmpp-domain = "$MAIN_SRV_DOMAIN" - // The MUC we'll join to announce our presence for - // recording and streaming services - control-muc { - domain = "internal.auth.$MAIN_SRV_DOMAIN" - room-name = "$JibriBrewery" - nickname = "Live-$ADDUP" - } + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "internal.auth.$MAIN_SRV_DOMAIN" + room-name = "$JibriBrewery" + nickname = "Live-$ADDUP" + } - // The login information for the control MUC - control-login { - domain = "auth.$MAIN_SRV_DOMAIN" - username = "jibri" - password = "$JB_AUTH_PASS" - } + // The login information for the control MUC + control-login { + domain = "auth.$MAIN_SRV_DOMAIN" + username = "jibri" + password = "$JB_AUTH_PASS" + } - // An (optional) MUC configuration where we'll - // join to announce SIP gateway services - // sip-control-muc { - // domain = "domain" - // room-name = "room-name" - // nickname = "nickname" - // } + // An (optional) MUC configuration where we'll + // join to announce SIP gateway services + // sip-control-muc { + // domain = "domain" + // room-name = "room-name" + // nickname = "nickname" + // } - // The login information the selenium web client will use - call-login { - domain = "recorder.$MAIN_SRV_DOMAIN" - username = "recorder" - password = "$JB_REC_PASS" - } + // The login information the selenium web client will use + call-login { + domain = "recorder.$MAIN_SRV_DOMAIN" + username = "recorder" + password = "$JB_REC_PASS" + } - // The value we'll strip from the room JID domain to derive - // the call URL - strip-from-room-domain = "conference." + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "conference." - // How long Jibri sessions will be allowed to last before - // they are stopped. A value of 0 allows them to go on - // indefinitely - usage-timeout = 0 hour + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = 0 hour - // Whether or not we'll automatically trust any cert on - // this XMPP domain - trust-all-xmpp-certs = true + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = true } ] } From c7ad6b34c923163755cd6edee96eb7574e793200 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Apr 2021 21:34:14 -0500 Subject: [PATCH 3/7] Move into apt-get for script Fix indenting too. --- grafana.sh | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/grafana.sh b/grafana.sh index 78b9857..12177c1 100644 --- a/grafana.sh +++ b/grafana.sh @@ -14,11 +14,11 @@ while getopts m: option do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo ./grafana.sh [-m debug]" && exit;; - esac + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./grafana.sh [-m debug]" && exit;; + esac done #DEBUG @@ -51,14 +51,18 @@ WS_CONF="/etc/nginx/sites-enabled/$DOMAIN.conf" GRAFANA_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)" # Min requirements -apt update && apt install -y gnupg2 curl wget jq +apt-get update && \ +apt-get install -y gnupg2 \ + curl \ + wget \ + jq echo " # Setup InfluxDB Packages " wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list -apt update && apt install influxdb -y +apt-get update && apt-get install influxdb -y run_service influxdb echo " @@ -66,7 +70,7 @@ echo " " curl -s https://packages.grafana.com/gpg.key | sudo apt-key add - add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" -apt update && apt install grafana -y +apt-get update && apt-get install grafana -y run_service grafana-server echo " @@ -74,7 +78,7 @@ echo " " wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list -apt update && apt install telegraf -y +apt-get update && apt-get install telegraf -y mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.original echo " @@ -159,13 +163,13 @@ while [ $secs -gt 0 ]; do done if [ -f $WS_CONF ]; then - sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF - sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" $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 - systemctl restart nginx + sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" $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 + systemctl restart nginx else - echo "No app configuration done to server file, please report to: + echo "No app configuration done to server file, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues" fi @@ -186,12 +190,12 @@ echo " curl -s -k -u "admin:$GRAFANA_PASS" -X \ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ '{ - "name": "InfluxDB", - "type": "influxdb", - "url": "http://localhost:8086", - "access": "proxy", - "isDefault": true, - "database": "jitsi" + "name": "InfluxDB", + "type": "influxdb", + "url": "http://localhost:8086", + "access": "proxy", + "isDefault": true, + "database": "jitsi" }' http://localhost:3000/api/datasources; echo "" echo " From 09ea0833ce56facee385857e0727d99adbe8c0b0 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Apr 2021 21:58:57 -0500 Subject: [PATCH 4/7] Update identing --- jigasi.sh | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/jigasi.sh b/jigasi.sh index e03d178..d5149cc 100644 --- a/jigasi.sh +++ b/jigasi.sh @@ -35,17 +35,17 @@ DIST=$(lsb_release -sc) CHECK_GC_REPO=$(apt-cache policy | grep http | grep cloud-sdk | head -n1 | awk '{print $3}' | awk -F '/' '{print $1}') install_gc_repo() { - if [ "$CHECK_GC_REPO" = "cloud-sdk-$DIST" ]; then - echo " +if [ "$CHECK_GC_REPO" = "cloud-sdk-$DIST" ]; then + echo " Google Cloud SDK repository already on the system! " else - echo " + echo " Adding Google Cloud SDK repository for latest updates " - export CLOUD_SDK_REPO="cloud-sdk-$DIST" - echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - + export CLOUD_SDK_REPO="cloud-sdk-$DIST" + echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - fi } @@ -56,14 +56,14 @@ apt-get -y install google-cloud-sdk google-cloud-sdk-app-engine-java echo "Please select one of the current options: [1] I want to configure a new project, service account, billing and JSON credentials. [2] I already have one project configured and already have a JSON key file from Google" -while [[ $SETUP_TYPE != 1 && $SETUP_TYPE != 2 ]] +while [[ "$SETUP_TYPE" != "1" && "$SETUP_TYPE" != "2" ]] do -read -p "What option suits your setup?: (1 or 2)"$'\n' -r SETUP_TYPE -if [ $SETUP_TYPE = 1 ]; then - echo "We'll setup a GC Projects from scratch" -elif [ $SETUP_TYPE = 2 ]; then - echo "We'll setup only the proect and JSON key." -fi + read -p "What option suits your setup?: (1 or 2)"$'\n' -r SETUP_TYPE + if [ "$SETUP_TYPE" = "1" ]; then + echo "We'll setup a GC Projects from scratch" + elif [ "$SETUP_TYPE" = "2" ]; then + echo "We'll setup only the proect and JSON key." + fi done if [ $SETUP_TYPE = 1 ]; then @@ -84,10 +84,10 @@ while [ -z $PROJECT_GC_ID ] do read -p "Enter the project name you just created for Jigasi Speech-to-Text"$'\n' -r GC_PROJECT_NAME if [ -z PROJECT_GC_ID ]; then - echo "Please check your project name, - There is no project listed with the provided name: $GC_PROJECT_NAME" - PROJECT_GC_ID=$(gcloud projects list | grep $GC_PROJECT_NAME | awk '{print$3}') -fi + echo "Please check your project name," + echo "There is no project listed with the provided name: $GC_PROJECT_NAME" + PROJECT_GC_ID=$(gcloud projects list | grep $GC_PROJECT_NAME | awk '{print$3}') + fi done echo "Your $GC_PROJECT_NAME ID's project is: $PROJECT_GC_ID" @@ -101,8 +101,8 @@ while [[ $? -eq 1 ]] do CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)" if [[ $? -eq 1 ]]; then - echo "Seems you haven't enabled billing for this project: $GC_PROJECT_NAME - For that go to: https://console.developers.google.com/project/$PROJECT_GC_ID/settings + echo "Seems you haven't enabled billing for this project: $GC_PROJECT_NAME" + exho " For that go to: https://console.developers.google.com/project/$PROJECT_GC_ID/settings " read -p "Press Enter to continue" CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)" @@ -122,7 +122,7 @@ https://console.developers.google.com/apis/credentials?folder=&organizationId=&p ### End of new project configuration - Google SDK fi -if [ $SETUP_TYPE = 2 ]; then +if [ "$SETUP_TYPE" = "2" ]; then #Setup option 1 - Google Cloud SDK echo "Once logged on Google Cloud SDK, please select the project that owns to the JSON key." gcloud init @@ -292,10 +292,10 @@ cat << JIG_JIC >> $JIC_SIP_PROP org.jitsi.jicofo.jigasi.BREWERY=JigasiBreweryRoom@internal.auth.$DOMAIN JIG_JIC -systemctl restart prosody \ - jicofo \ - jibri* \ - jitsi-videobridge2 +systemctl restart prosody \ + jicofo \ + jibri* \ + jitsi-videobridge2 echo " Full transcript files are available at: From bbbe7d56cdc6d639a4ed833a68d77bf809900a93 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Apr 2021 21:59:43 -0500 Subject: [PATCH 5/7] Fix indenting too. --- jitsi-updater.sh | 122 ++++++++++++++++++++++------------------------- 1 file changed, 58 insertions(+), 64 deletions(-) diff --git a/jitsi-updater.sh b/jitsi-updater.sh index 16639bd..833be2d 100644 --- a/jitsi-updater.sh +++ b/jitsi-updater.sh @@ -15,9 +15,9 @@ if ! [ $(id -u) = 0 ]; then exit 0 fi if [ ! -f jm-bm.sh ]; then - echo "Please check that you are running the jitsi updater while being on the project folder" - echo "other wise the updater might have errors or be incomplete. Exiting..." - exit + echo "Please check that you are running the jitsi updater while being on the project folder" + echo "other wise the updater might have errors or be incomplete. Exiting..." + exit fi support="https://switnet.net/support" apt_repo="/etc/apt/sources.list.d" @@ -26,7 +26,7 @@ ENABLE_BLESSM="TBD" CHD_LTST="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" CHD_LTST_2D="$(echo $CHD_LTST|cut -d "." -f 1,2)" CHDB="$(whereis chromedriver | awk '{print$2}')" -DOMAIN="$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++')" +DOMAIN="$(ls /etc/prosody/conf.d|awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" NC_DOMAIN="TBD" JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" if [ -f $JITSI_MEET_PROXY ];then @@ -42,7 +42,7 @@ else echo "Seems no Google repo installed" fi if [ -z $CHDB ]; then - echo "Seems no chromedriver installed" + echo "Seems no chromedriver installed" else CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')" CHD_VER_2D="$(echo $CHD_VER_LOCAL|awk '{printf "%.1f\n", $NF}')" @@ -54,20 +54,20 @@ version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } check_jibri() { if [ "$(dpkg-query -W -f='${Status}' "jibri" 2>/dev/null | grep -c "ok installed")" == "1" ] then - systemctl restart jibri - systemctl restart jibri-icewm - systemctl restart jibri-xorg + systemctl restart jibri + systemctl restart jibri-icewm + systemctl restart jibri-xorg else - echo "Jibri service not installed" + echo "Jibri service not installed" fi } # Restarting services restart_services() { - systemctl restart jitsi-videobridge2 - systemctl restart jicofo - check_jibri - systemctl restart prosody + systemctl restart jitsi-videobridge2 + systemctl restart jicofo + check_jibri + systemctl restart prosody } update_jitsi_repo() { @@ -77,25 +77,25 @@ update_jitsi_repo() { } update_google_repo() { - if [ -f $apt_repo/google-chrome.list ]; then + if [ -f $apt_repo/google-chrome.list ]; then apt-get update -o Dir::Etc::sourcelist="sources.list.d/google-chrome.list" \ -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" apt-get install -qq --only-upgrade $google_package else - echo "No Google repository found" - fi + echo "No Google repository found" + fi } GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')" upgrade_cd() { -if [ ! -z $GOOGL_VER_2D ]; then +if [ ! -z "$GOOGL_VER_2D" ]; then if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \ [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then echo "Upgrading Chromedriver to Google Chromes version" - wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \ + wget -q https://chromedriver.storage.googleapis.com/"$CHD_LTST"/chromedriver_linux64.zip \ -O /tmp/chromedriver_linux64.zip unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/ - chown root:root $CHDB - chmod 0755 $CHDB + chown root:root "$CHDB" + chmod 0755 "$CHDB" rm -rf /tpm/chromedriver_linux64.zip printf "Current version: ${Green} "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')" ${Color_Off}\n" else @@ -110,26 +110,26 @@ fi check_lst_cd() { printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n" if [ -f $CHDB ]; then - printf "Current installed Chromedriver: ${Yellow} $CHD_VER_2D ${Color_Off}\n" - printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n" - upgrade_cd + printf "Current installed Chromedriver: ${Yellow} $CHD_VER_2D ${Color_Off}\n" + printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n" + upgrade_cd else - printf "${Yellow} -> Seems there is no Chromedriver installed${Color_Off}\n" + printf "${Yellow} -> Seems there is no Chromedriver installed${Color_Off}\n" fi } printf "${Blue}Update & upgrade Jitsi and components${Color_Off}\n" if [ -f $apt_repo/jitsi-unstable.list ]; then - update_jitsi_repo unstable - update_google_repo - check_lst_cd + update_jitsi_repo unstable + update_google_repo + check_lst_cd elif [ -f $apt_repo/jitsi-stable.list ]; then - update_jitsi_repo stable - update_google_repo - check_lst_cd + update_jitsi_repo stable + update_google_repo + check_lst_cd else - echo "Please check your repositories, something is not right." - exit 1 + echo "Please check your repositories, something is not right." + exit 1 fi # Any customization, image, name or link change for any purpose should # be documented here so new updates won't remove those changes. @@ -146,32 +146,28 @@ if [ -f "$INT_CONF_ETC" ]; then echo "Static interface_config.js exists, skipping modification..." else echo "This setup doesn't have a static interface_config.js, checking changes..." - printf "${Purple}========== Setting Static Avatar ==========${Color_Off}\n" - if [[ -z "$AVATAR" ]]; then - echo "Moving on..." - else - echo "Setting Static Avatar" - sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" $INT_CONF - sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF - fi - - printf "${Purple}========== Setting Support Link ==========${Color_Off}\n" - if [[ -z $support ]]; then - echo "Moving on..." - else - echo "Setting Support custom link" - sed -i "s|https://jitsi.org/live|$support|g" $INT_CONF - fi - - printf "${Purple}========== Disable Localrecording ==========${Color_Off}\n" - if [ "$LOC_REC" != "on" ]; then - echo "Removing localrecording..." - sed -i "s|'localrecording',||" $INT_CONF - fi - - printf "${Purple}========== Disable Blur my background ==========${Color_Off}\n" - sed -i "s|'videobackgroundblur', ||" $INT_CONF - + printf "${Purple}========== Setting Static Avatar ==========${Color_Off}\n" + if [[ -z "$AVATAR" ]]; then + echo "Moving on..." + else + echo "Setting Static Avatar" + sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" $INT_CONF + sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF + fi + printf "${Purple}========== Setting Support Link ==========${Color_Off}\n" + if [[ -z $support ]]; then + echo "Moving on..." + else + echo "Setting Support custom link" + sed -i "s|https://jitsi.org/live|$support|g" $INT_CONF + fi + printf "${Purple}========== Disable Localrecording ==========${Color_Off}\n" + if [ "$LOC_REC" != "on" ]; then + echo "Removing localrecording..." + sed -i "s|'localrecording',||" $INT_CONF + fi + printf "${Purple}========== Disable Blur my background ==========${Color_Off}\n" + sed -i "s|'videobackgroundblur', ||" $INT_CONF fi if [ "$NC_DOMAIN" != "TBD" ]; then @@ -181,21 +177,19 @@ printf "${Purple}========== Enable $NC_DOMAIN for sync client ==========${Color_ 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 \ \ \ \ \ \ $DOMAIN web;" $JITSI_MEET_PROXY + sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" $JITSI_MEET_PROXY sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY else echo "$NC_DOMAIN seems to be on place, skipping..." fi fi - restart_services - ######################################################################## # Brandless mode # ######################################################################## -if [ $ENABLE_BLESSM = on ]; then - bash $PWD/jm-bm.sh +if [ "$ENABLE_BLESSM" = "on" ]; then + bash $PWD/jm-bm.sh fi printf "${Blue}Script completed \o/! ${Color_Off}\n" From 62854919641f54d8273cd59cb43be299d48d1374 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Apr 2021 22:06:27 -0500 Subject: [PATCH 6/7] Fix indenting too. --- jm-bm.sh | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/jm-bm.sh b/jm-bm.sh index 30fc320..ee37db3 100644 --- a/jm-bm.sh +++ b/jm-bm.sh @@ -28,38 +28,38 @@ echo ' #-------------------------------------------------- ' #Watermark -if [ ! -f $WTM2_PATH ]; then - cp images/watermark2.png $WTM2_PATH +if [ ! -f "$WTM2_PATH" ]; then + cp images/watermark2.png "$WTM2_PATH" else - echo "watermark2 file exists, skipping copying..." + echo "watermark2 file exists, skipping copying..." fi #Favicon -if [ ! -f $FICON_PATH ]; then - cp images/favicon2.ico $FICON_PATH +if [ ! -f "$FICON_PATH" ]; then + cp images/favicon2.ico "$FICON_PATH" else - echo "favicon2 file exists, skipping copying..." + echo "favicon2 file exists, skipping copying..." fi #Local recording icon -if [ ! -f $REC_ICON_PATH ];then - cp images/gnome_record.png $REC_ICON_PATH +if [ ! -f "$REC_ICON_PATH" ];then + cp images/gnome_record.png "$REC_ICON_PATH" else echo "recodring icon exists, skipping copying..." fi #Custom / Remove icons -sed -i "s|watermark.png|watermark2.png|g" $CSS_FILE -sed -i "s|favicon.ico|favicon2.ico|g" $TITLE_FILE -sed -i "s|jitsilogo.png|watermark2.png|g" $TITLE_FILE -sed -i "s|logo-deep-linking.png|watermark2.png|g" $BUNDLE_JS -sed -i "s|jitsiLogo_square.png|gnome_record.png|g" $BUNDLE_JS +sed -i "s|watermark.png|watermark2.png|g" "$CSS_FILE" +sed -i "s|favicon.ico|favicon2.ico|g" "$TITLE_FILE" +sed -i "s|jitsilogo.png|watermark2.png|g" "$TITLE_FILE" +sed -i "s|logo-deep-linking.png|watermark2.png|g" "$BUNDLE_JS" +sed -i "s|jitsiLogo_square.png|gnome_record.png|g" "$BUNDLE_JS" #Disable logo and url if [ -z "$(grep -nr ".leftwatermark{display:none" "$CSS_FILE")" ]; then -sed -i "s|.leftwatermark{|.leftwatermark{display:none;|" $CSS_FILE +sed -i "s|.leftwatermark{|.leftwatermark{display:none;|" "$CSS_FILE" fi #Customize room title -sed -i "s|Jitsi Meet|$APP_NAME|g" $TITLE_FILE -sed -i "s| powered by the Jitsi Videobridge||g" $TITLE_FILE +sed -i "s|Jitsi Meet|$APP_NAME|g" "$TITLE_FILE" +sed -i "s| powered by the Jitsi Videobridge||g" "$TITLE_FILE" sed -i "/appNotInstalled/ s|{{app}}|$MOVILE_APP_NAME|" /usr/share/jitsi-meet/lang/* #Custom UI changes @@ -67,13 +67,13 @@ if [ -f "$INT_CONF_ETC" ]; then echo "Static interface_config.js exists, skipping modification..." else echo "This setup doesn't have a static interface_config.js, checking changes..." - echo -e "\nPlease note that brandless mode will also overwrite support links.\n" - sed -i "21,32 s|Jitsi Meet|$APP_NAME|g" $INT_CONF - sed -i "s|\([[:space:]]\)APP_NAME:.*| APP_NAME: \'$APP_NAME\',|" $INT_CONF - sed -i "s|Fellow Jitster|$PART_USER|g" $INT_CONF - sed -i "s|'me'|'$LOCAL_USER'|" $INT_CONF - sed -i "s|LIVE_STREAMING_HELP_LINK: .*|LIVE_STREAMING_HELP_LINK: '#',|g" $INT_CONF - sed -i "s|SUPPORT_URL: .*|SUPPORT_URL: '#',|g" $INT_CONF - #Logo 2 - sed -i "s|watermark.png|watermark2.png|g" $INT_CONF + echo -e "\nPlease note that brandless mode will also overwrite support links.\n" + sed -i "21,32 s|Jitsi Meet|$APP_NAME|g" "$INT_CONF" + sed -i "s|\([[:space:]]\)APP_NAME:.*| APP_NAME: \'$APP_NAME\',|" "$INT_CONF" + sed -i "s|Fellow Jitster|$PART_USER|g" "$INT_CONF" + sed -i "s|'me'|'$LOCAL_USER'|" "$INT_CONF" + sed -i "s|LIVE_STREAMING_HELP_LINK: .*|LIVE_STREAMING_HELP_LINK: '#',|g" "$INT_CONF" + sed -i "s|SUPPORT_URL: .*|SUPPORT_URL: '#',|g" "$INT_CONF" + #Logo 2 + sed -i "s|watermark.png|watermark2.png|g" "$INT_CONF" fi From 457623b6016701b9ef52b65d18480fc24b337108 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Apr 2021 22:32:55 -0500 Subject: [PATCH 7/7] 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