From 694cafec4d12239bbf96a1dbcff909cf79eab71c Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sun, 24 Feb 2019 22:10:26 -0600 Subject: [PATCH] Update from upstream --- README.md | 2 + jitsi-updater.sh | 125 +++++++++++++++++++++++++++++++++++++++ quick_jibri_installer.sh | 63 +++++++++++++++----- 3 files changed, 175 insertions(+), 15 deletions(-) create mode 100644 jitsi-updater.sh diff --git a/README.md b/README.md index c5cdc4d..3142dac 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Quick Jibri installer based for Xenial servers. +======= # Quick Jibri Installer Bash installer for Jibri on *buntu 16.04 LTS based systems diff --git a/jitsi-updater.sh b/jitsi-updater.sh new file mode 100644 index 0000000..aa420d0 --- /dev/null +++ b/jitsi-updater.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# Jitsi Meet upgrade and custom keeper for Debian/*buntu binaries. +# 2018 - SwITNet Ltd +# GNU GPLv3 or later. + +Blue='\e[0;34m' +Purple='\e[0;35m' +Color_Off='\e[0m' +support="https://switnet.net/support" +apt_repo="/etc/apt/sources.list.d" +jibri_packages=$(grep Package /var/lib/apt/lists/download.jitsi.org_*_Packages | sort -u | awk '{print $2}' | paste -s -d ' ') +CHD_LST=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE) +CHDB=/usr/local/bin/chromedriver +DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | cut -d "." -f "1-3") +if [ -f $apt_repo/google-chrome.list ]; then + google_package=$(grep Package /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages | sort -u | cut -d ' ' -f2 | paste -s -d ' ') +else + echo "Seems no Google repo installed" +fi +if [ -f $CHDB ]; then + CHD_AVB=$(chromedriver -v | awk '{print $2}' | cut -d . -f "1,2") +else + echo "Seems no chromedriver installed" +fi + +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 + service jibri restart + service jibri-icewm restart + service jibri-xorg restart +else + echo "Jibri service not installed" +fi +} + +# Restarting services +restart_services() { + service jitsi-videobridge restart + service jicofo restart + check_jibri + service prosody restart +} + +upgrade_cd() { +if version_gt $CHD_LST $CHD_AVB +then + echo "Upgrading ..." + wget https://chromedriver.storage.googleapis.com/$CHD_LST/chromedriver_linux64.zip + unzip chromedriver_linux64.zip + sudo cp chromedriver $CHDB + rm -rf chromedriver chromedriver_linux64.zip + chromedriver -v +else + echo "No need to upgrade Chromedriver" + printf "Current version: ${Green} $CHD_AVB ${Color_Off}\n" +fi +} + +update_jitsi_repo() { + apt-get update -o Dir::Etc::sourcelist="sources.list.d/jitsi-$1.list" \ + -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" + apt-get install -qq --only-upgrade $jibri_packages +} + +update_google_repo() { + 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 +} + +check_lst_cd() { +printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n" +if [ -f $CHDB ]; then + printf "Current installed Chromedriver: ${Yellow} $CHD_AVB ${Color_Off}\n" + printf "Latest Chromedriver version available: ${Green} $CHD_LST ${Color_Off}\n" + upgrade_cd +else + printf "${Yellow} -> Seems there is no Chromedriver installed${Color_Off}\n" +fi +} + +printf "${Blue}Update & upgrade Jitsi and components - v2.3${Color_Off}\n" +if [ -f $apt_repo/jitsi-unstable.list ]; then + 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 +else + echo "Please check your repositories, something is not right." + exit 1 +fi + +######################################################################## +# Keeping changes # +######################################################################## +printf "${Purple}========== Setting Static Avatar ==========${Color_Off}\n" +avatar="$(grep -r avatar /etc/*/sites-*/ 2>/dev/null)" +if ($avatar) < /dev/null > /dev/null 2>&1; then + echo "Moving on..." +else + echo "Setting Static Avatar" + sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" /usr/share/jitsi-meet/interface_config.js + sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" /usr/share/jitsi-meet/interface_config.js +fi + +printf "${Purple}========== Setting Support Link ==========${Color_Off}\n" +if ($support) < /dev/null > /dev/null 2>&1; then + echo "Moving on..." +else + echo "Setting Support custom link" + sed -i "s|https://jitsi.org/live|$support|g" /usr/share/jitsi-meet/interface_config.js +fi + +restart_services +printf "${Blue}Script completed \o/! ${Color_Off}\n" diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 9fb8c22..ee260b2 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -10,7 +10,6 @@ APACHE_2=$(dpkg-query -W -f='${Status}' apache2 2>/dev/null | grep -c "ok instal NGINX=$(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed") DIST=$(lsb_release -sc) GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list" -CHD_VER=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE) if [ $DIST = flidas ]; then DIST="xenial" @@ -122,7 +121,7 @@ fi echo "snd-aloop" | tee -a /etc/modules check_snd_driver - +CHD_VER=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE) echo "# Installing Google Chrome / ChromeDriver" if [ -f $GOOGL_REPO ]; then echo "Google repository already set." @@ -224,8 +223,8 @@ fi restart_services() { service jitsi-videobridge restart service jicofo restart - check_jibri service prosody restart + check_jibri } # Configure Jibri @@ -265,7 +264,7 @@ org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90 BREWERY # Jibri tweaks for /etc/jitsi/meet/$DOMAIN-config.js -sed -i "s|guest.example.com|guest.$DOMAIN|" $MEET_CONF +sed -i "s|// anonymousdomain: 'guest.example.com'|anonymousdomain: \'guest.$DOMAIN\'|" $MEET_CONF sed -i "s|conference.$DOMAIN|internal.auth.$DOMAIN|" $MEET_CONF sed -i "s|// fileRecordingsEnabled: false,|fileRecordingsEnabled: true,| " $MEET_CONF sed -i "s|// liveStreamingEnabled: false,|liveStreamingEnabled: true,\\ @@ -364,21 +363,14 @@ cat << CONF_JSON > $CONF_JSON } CONF_JSON -#Tune webserver for Jitsi App control. +#Tune webserver for Jitsi App control if [ -f /etc/apache2/sites-available/$DOMAIN.conf ]; then WS_CONF=/etc/apache2/sites-available/$DOMAIN.conf sed -i '$ d' $WS_CONF cat << NG_APP >> $WS_CONF Alias "/external_api.js" "/usr/share/jitsi-meet/libs/external_api.min.js" - - Require all granted - - Alias "/external_api.min.js" "/usr/share/jitsi-meet/libs/external_api.min.js" - - Require all granted - NG_APP @@ -406,13 +398,45 @@ else -> https://github.com/switnet-ltd/quick-jibri-installer/issues" fi +#Enable static avatar +while [[ "$ENABLE_SA" != "yes" && "$ENABLE_SA" != "no" ]] +do +read -p "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 enable" +elif [ "$ENABLE_SA" = "yes" ] && [ -f /etc/apache2/sites-available/$DOMAIN.conf ]; then + echo "Static avatar are being enable" + wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png + WS_CONF=/etc/apache2/sites-available/$DOMAIN.conf + sed -i "/Alias \"\/external_api.js\"/i \ \ AliasMatch \^\/avatar\/\(.\*\)\\\.png /usr/share/jitsi-meet/images/avatar2.png" $WS_CONF + service apache2 reload + sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'https://$DOMAIN/avatar/\'|" $INT_CONF + sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF +elif [ "$ENABLE_SA" = "yes" ] && [ -f /etc/nginx/sites-available/$DOMAIN.conf ]; then + wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png + WS_CONF=/etc/nginx/sites-available/$DOMAIN.conf + sed -i "/location \/external_api.min.js/i \ \ \ \ location \~ \^\/avatar\/\(.\*\)\\\.png {\\ +\ +\ \ \ \ \ \ \ \ alias /usr/share/jitsi-meet/images/avatar2.png;\\ +\ +\ \ \ \ }\\ +\ " $WS_CONF + service nginx reload + sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" $INT_CONF + sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF +else + echo "No app configuration done to server file, please report to: + -> https://github.com/switnet-ltd/quick-jibri-installer/issues" +fi +done + #Enable secure rooms? -while [[ $ENABLE_SC != yes && $ENABLE_SC != no ]] +while [[ "$ENABLE_SC" != "yes" && "$ENABLE_SC" != "no" ]] do read -p "Do you want to enable secure rooms?: (yes or no)"$'\n' -r ENABLE_SC -if [ $ENABLE_SC = no ]; then +if [ "$ENABLE_SC" = "no" ]; then echo "Secure rooms won't be enable" -elif [ $ENABLE_SC = yes ]; then +elif [ "$ENABLE_SC" = "yes" ]; then echo "Secure rooms are being enable" cat << P_SR >> $PROSODY_FILE VirtualHost "$DOMAIN" @@ -425,6 +449,15 @@ P_SR fi done +#Set main language (Spanish) +sed -i "s|// defaultLanguage: 'en',|defaultLanguage: 'es',|" $MEET_CONF + +#Start with video muted by default +sed -i "s|// startWithVideoMuted: false,|startWithVideoMuted: true,|" $MEET_CONF + +#Start with audio muted but admin +sed -i "s|// startAudioMuted: 10,|startAudioMuted: 1,|" $MEET_CONF + #Enable jibri services systemctl enable jibri systemctl enable jibri-xorg