Fix indenting too.

This commit is contained in:
Luis Guzmán 2021-04-11 21:59:43 -05:00
parent 09ea0833ce
commit bbbe7d56cd
1 changed files with 58 additions and 64 deletions

View File

@ -15,9 +15,9 @@ if ! [ $(id -u) = 0 ]; then
exit 0 exit 0
fi fi
if [ ! -f jm-bm.sh ]; then if [ ! -f jm-bm.sh ]; then
echo "Please check that you are running the jitsi updater while being on the project folder" 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..." echo "other wise the updater might have errors or be incomplete. Exiting..."
exit exit
fi fi
support="https://switnet.net/support" support="https://switnet.net/support"
apt_repo="/etc/apt/sources.list.d" 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="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)"
CHD_LTST_2D="$(echo $CHD_LTST|cut -d "." -f 1,2)" CHD_LTST_2D="$(echo $CHD_LTST|cut -d "." -f 1,2)"
CHDB="$(whereis chromedriver | awk '{print$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" NC_DOMAIN="TBD"
JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf"
if [ -f $JITSI_MEET_PROXY ];then if [ -f $JITSI_MEET_PROXY ];then
@ -42,7 +42,7 @@ else
echo "Seems no Google repo installed" echo "Seems no Google repo installed"
fi fi
if [ -z $CHDB ]; then if [ -z $CHDB ]; then
echo "Seems no chromedriver installed" echo "Seems no chromedriver installed"
else else
CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')" CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')"
CHD_VER_2D="$(echo $CHD_VER_LOCAL|awk '{printf "%.1f\n", $NF}')" 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() { check_jibri() {
if [ "$(dpkg-query -W -f='${Status}' "jibri" 2>/dev/null | grep -c "ok installed")" == "1" ] if [ "$(dpkg-query -W -f='${Status}' "jibri" 2>/dev/null | grep -c "ok installed")" == "1" ]
then then
systemctl restart jibri systemctl restart jibri
systemctl restart jibri-icewm systemctl restart jibri-icewm
systemctl restart jibri-xorg systemctl restart jibri-xorg
else else
echo "Jibri service not installed" echo "Jibri service not installed"
fi fi
} }
# Restarting services # Restarting services
restart_services() { restart_services() {
systemctl restart jitsi-videobridge2 systemctl restart jitsi-videobridge2
systemctl restart jicofo systemctl restart jicofo
check_jibri check_jibri
systemctl restart prosody systemctl restart prosody
} }
update_jitsi_repo() { update_jitsi_repo() {
@ -77,25 +77,25 @@ update_jitsi_repo() {
} }
update_google_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" \ apt-get update -o Dir::Etc::sourcelist="sources.list.d/google-chrome.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install -qq --only-upgrade $google_package apt-get install -qq --only-upgrade $google_package
else else
echo "No Google repository found" echo "No Google repository found"
fi fi
} }
GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')" GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')"
upgrade_cd() { upgrade_cd() {
if [ ! -z $GOOGL_VER_2D ]; then if [ ! -z "$GOOGL_VER_2D" ]; then
if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \ if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \
[ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then
echo "Upgrading Chromedriver to Google Chromes version" 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 -O /tmp/chromedriver_linux64.zip
unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/ unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/
chown root:root $CHDB chown root:root "$CHDB"
chmod 0755 $CHDB chmod 0755 "$CHDB"
rm -rf /tpm/chromedriver_linux64.zip rm -rf /tpm/chromedriver_linux64.zip
printf "Current version: ${Green} "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')" ${Color_Off}\n" printf "Current version: ${Green} "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')" ${Color_Off}\n"
else else
@ -110,26 +110,26 @@ fi
check_lst_cd() { check_lst_cd() {
printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n" printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n"
if [ -f $CHDB ]; then if [ -f $CHDB ]; then
printf "Current installed Chromedriver: ${Yellow} $CHD_VER_2D ${Color_Off}\n" printf "Current installed Chromedriver: ${Yellow} $CHD_VER_2D ${Color_Off}\n"
printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n" printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n"
upgrade_cd upgrade_cd
else else
printf "${Yellow} -> Seems there is no Chromedriver installed${Color_Off}\n" printf "${Yellow} -> Seems there is no Chromedriver installed${Color_Off}\n"
fi fi
} }
printf "${Blue}Update & upgrade Jitsi and components${Color_Off}\n" printf "${Blue}Update & upgrade Jitsi and components${Color_Off}\n"
if [ -f $apt_repo/jitsi-unstable.list ]; then if [ -f $apt_repo/jitsi-unstable.list ]; then
update_jitsi_repo unstable update_jitsi_repo unstable
update_google_repo update_google_repo
check_lst_cd check_lst_cd
elif [ -f $apt_repo/jitsi-stable.list ]; then elif [ -f $apt_repo/jitsi-stable.list ]; then
update_jitsi_repo stable update_jitsi_repo stable
update_google_repo update_google_repo
check_lst_cd check_lst_cd
else else
echo "Please check your repositories, something is not right." echo "Please check your repositories, something is not right."
exit 1 exit 1
fi fi
# Any customization, image, name or link change for any purpose should # Any customization, image, name or link change for any purpose should
# be documented here so new updates won't remove those changes. # 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..." echo "Static interface_config.js exists, skipping modification..."
else else
echo "This setup doesn't have a static interface_config.js, checking changes..." echo "This setup doesn't have a static interface_config.js, checking changes..."
printf "${Purple}========== Setting Static Avatar ==========${Color_Off}\n" printf "${Purple}========== Setting Static Avatar ==========${Color_Off}\n"
if [[ -z "$AVATAR" ]]; then if [[ -z "$AVATAR" ]]; then
echo "Moving on..." echo "Moving on..."
else else
echo "Setting Static Avatar" echo "Setting Static Avatar"
sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" $INT_CONF sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" $INT_CONF
sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF
fi fi
printf "${Purple}========== Setting Support Link ==========${Color_Off}\n"
printf "${Purple}========== Setting Support Link ==========${Color_Off}\n" if [[ -z $support ]]; then
if [[ -z $support ]]; then echo "Moving on..."
echo "Moving on..." else
else echo "Setting Support custom link"
echo "Setting Support custom link" sed -i "s|https://jitsi.org/live|$support|g" $INT_CONF
sed -i "s|https://jitsi.org/live|$support|g" $INT_CONF fi
fi printf "${Purple}========== Disable Localrecording ==========${Color_Off}\n"
if [ "$LOC_REC" != "on" ]; then
printf "${Purple}========== Disable Localrecording ==========${Color_Off}\n" echo "Removing localrecording..."
if [ "$LOC_REC" != "on" ]; then sed -i "s|'localrecording',||" $INT_CONF
echo "Removing localrecording..." fi
sed -i "s|'localrecording',||" $INT_CONF printf "${Purple}========== Disable Blur my background ==========${Color_Off}\n"
fi sed -i "s|'videobackgroundblur', ||" $INT_CONF
printf "${Purple}========== Disable Blur my background ==========${Color_Off}\n"
sed -i "s|'videobackgroundblur', ||" $INT_CONF
fi fi
if [ "$NC_DOMAIN" != "TBD" ]; then 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 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 \ \ map \$ssl_preread_server_name \$upstream {" $JITSI_MEET_PROXY
sed -i "/server {/i \ \ \ \ \ \ $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 \ \ \ \ \ \ $NC_DOMAIN web;" $JITSI_MEET_PROXY
sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY
else else
echo "$NC_DOMAIN seems to be on place, skipping..." echo "$NC_DOMAIN seems to be on place, skipping..."
fi fi
fi fi
restart_services restart_services
######################################################################## ########################################################################
# Brandless mode # # Brandless mode #
######################################################################## ########################################################################
if [ $ENABLE_BLESSM = on ]; then if [ "$ENABLE_BLESSM" = "on" ]; then
bash $PWD/jm-bm.sh bash $PWD/jm-bm.sh
fi fi
printf "${Blue}Script completed \o/! ${Color_Off}\n" printf "${Blue}Script completed \o/! ${Color_Off}\n"