quick_jibri_installer.sh: organize echo and printf.

This commit is contained in:
Luis Guzmán 2023-11-13 22:39:41 -06:00
parent 079ddfde03
commit 5a9ae4d5f5
1 changed files with 93 additions and 91 deletions

View File

@ -47,11 +47,10 @@ printwc() {
}
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...
Please try again on a clean system.
If you think this is an error, please report to:
-> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
echo -e "\nThis instance already has $1 installed, exiting..."
echo -e "Please try again on a clean system."
echo -e " If you think this is an error, please report to:"
echo -e " -> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
exit
fi
}
@ -76,14 +75,10 @@ fi
}
check_serv() {
if [ "$APACHE_2" -eq 1 ]; then
echo "
The recommended setup is using NGINX, exiting...
"
echo -e "\nThe recommended setup is using NGINX, exiting...\n"
exit
elif [ "$NGINX" -eq 1 ]; then
printf "\nWebserver already installed!\n"
else
printf "\nInstalling nginx webserver!\n"
install_ifnot nginx
@ -94,16 +89,14 @@ printf "\n# Checking ALSA - Loopback module..."
echo "snd-aloop" | tee -a /etc/modules
modprobe snd-aloop
if [ "$(lsmod|awk '/snd_aloop/{print$1}'|awk 'NR==1')" = "snd_aloop" ]; then
echo "
#-----------------------------------------------------------------------
# Audio driver seems - OK.
#-----------------------------------------------------------------------"
echo -e "\n#-----------------------------------------------------------------------"
echo "# Audio driver seems - OK."
echo -e "#-----------------------------------------------------------------------\n"
else
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.
#-----------------------------------------------------------------------"
echo -e "\n#-----------------------------------------------------------------------"
echo "# Your audio driver might not be able to load."
echo "# We'll check the state of this Jibri with our 'test-jibri-env.sh' tool."
echo -e "#-----------------------------------------------------------------------\n"
#Test tool
if [ "$MODE" = "debug" ]; then
bash "$PWD"/tools/test-jibri-env.sh -m debug
@ -117,6 +110,12 @@ fi
var_dlim() {
grep -n "$1" add-jibri-node.sh|head -n1|cut -d ":" -f1
}
add_gpg_keyring() {
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com \$1
apt-key export \$1 | gpg --dearmour | tee /tmp/\$1.gpg >/dev/null
apt-key del \$1
mv /tmp/\$1.gpg /etc/apt/trusted.gpg.d/
}
add_prosody_repo() {
echo "Add Prosody repo"
if [ "$PROSODY_REPO" = "main" ]; then
@ -170,7 +169,7 @@ Featuring:
Learn more about these at,
Main repository: https://forge.switnet.net/switnet/quick-jibri-installer
Wiki and documentation: https://forge.switnet.net/switnet/quick-jibri-installer/wiki\n\n'
sleep .1
read -n 1 -s -r -p "Press any key to continue..."$'\n'
#Check if user is root
@ -193,8 +192,8 @@ NEXT_LTS_DATE=$(date -d 2024-04-01 +%s)
if [ "$DIST" = "focal" ]; then
if [ "$TODAY" -gt "$NEXT_LTS_DATE" ]; then
echo " > $(lsb_release -sc), even when it's compatible and functional.
We suggest to use the next (LTS) release, for longer support and security reasons."
echo " > $(lsb_release -sc), even when it's compatible and functional."
echo " We suggest to use the next (LTS) release, for longer support and security reasons."
read -n 1 -s -r -p "Press any key to continue..."$'\n'
else
echo "Focal is supported."
@ -281,9 +280,9 @@ printf "\nChecking for common desktop system oriented purpose....\n"
for de in "${SYSTEM_DE_ARRAY[@]}"
do
if [ "$(dpkg-query -W -f='${Status}' "$de" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
printf "\n > This instance has %s installed, exiting...
\nPlease avoid using this installer on a desktop-user oriented GNU/Linux system.
This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't." "$de"
printf "\n > This instance has %s installed, exiting...\n" "$de"
printf "\nPlease avoid using this installer on a desktop-user oriented GNU/Linux system.\n"
printf "This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't.\n"
exit
else
printf " > No standard desktop environment for user oriented porpuse detected, good!, continuing...\n\n"
@ -340,8 +339,10 @@ sleep .1
if [ "$PUBLIC_IP" = "$(dig -4 +short "$JITSI_DOMAIN"||awk -v RS='([0-9]+\\.){3}[0-9]+' 'RT{print RT}')" ]; then
printf "\nServer public IP & DNS record for %s seems to match, continuing..." "$JITSI_DOMAIN"
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."
echo -n "Server public IP ($PUBLIC_IP) & DNS record for $JITSI_DOMAIN"
echo " don't seem to match."
echo -n " > Please check your dns records are applied and updated,"
echo " otherwise components may fail."
read -p " > Do you want to continue?: (yes or no)$NL" -r DNS_CONTINUE
if [ "$DNS_CONTINUE" = "yes" ]; then
echo " - We'll continue anyway..."
@ -375,8 +376,8 @@ if [ "$LE_SSL" = "yes" ]; then
apt-get -y install \
certbot
if [ "$(dpkg-query -W -f='${Status}' ufw 2>/dev/null | grep -c "ok installed")" == "1" ]; then
echo "# Disable pre-installed ufw, more on firewall see:
> https://forge.switnet.net/switnet/quick-jibri-installer/wiki/Firewall"
echo "# Disable pre-installed ufw, more on firewall see:"
echo " > https://forge.switnet.net/switnet/quick-jibri-installer/wiki/Firewall"
ufw disable
fi
fi
@ -1117,9 +1118,9 @@ if [ "$ENABLE_SC" = "yes" ]; then
prosodyctl register "$SEC_ROOM_USER" "$DOMAIN" "$SEC_ROOM_PASS"
sleep .1
printf "\nSecure rooms are being enabled...\n"
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."
echo -n "You'll be able to login Secure Room chat with '${SEC_ROOM_USER}' "
echo "or '${SEC_ROOM_USER}@${DOMAIN}' using the password you just entered."
echo "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
fi
@ -1219,7 +1220,8 @@ if [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then
systemctl disable jibri
systemctl disable jibri-xorg
systemctl disable jibri-icewm
# Manually apply permissions since finalize_recording.sh won't be triggered under this server options.
# Manually apply permissions since finalize_recording.sh won't be
# triggered under this server options.
chmod -R 770 "$DIR_RECORD"
fi