quick_jibri_installer.sh: organize echo and printf.
This commit is contained in:
parent
079ddfde03
commit
5a9ae4d5f5
|
@ -46,110 +46,109 @@ printwc() {
|
||||||
printf "%b$2%b" "$1" "${Color_Off}"
|
printf "%b$2%b" "$1" "${Color_Off}"
|
||||||
}
|
}
|
||||||
exit_ifinstalled() {
|
exit_ifinstalled() {
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
||||||
echo "
|
echo -e "\nThis instance already has $1 installed, exiting..."
|
||||||
This instance already has $1 installed, exiting...
|
echo -e "Please try again on a clean system."
|
||||||
Please try again on a clean system.
|
echo -e " If you think this is an error, please report to:"
|
||||||
If you think this is an error, please report to:
|
echo -e " -> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
|
||||||
-> https://forge.switnet.net/switnet/quick-jibri-installer/issues"
|
exit
|
||||||
exit
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
exit_ifinstalled jitsi-meet
|
exit_ifinstalled jitsi-meet
|
||||||
|
|
||||||
rename_distro() {
|
rename_distro() {
|
||||||
if [ "$DIST" = "$1" ]; then
|
if [ "$DIST" = "$1" ]; then
|
||||||
DIST="$2"
|
DIST="$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
#Trisquel distro upstream referencing.
|
#Trisquel distro upstream referencing.
|
||||||
rename_distro nabia focal
|
rename_distro nabia focal
|
||||||
rename_distro aramo jammy
|
rename_distro aramo jammy
|
||||||
|
|
||||||
install_ifnot() {
|
install_ifnot() {
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
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
|
else
|
||||||
printf "\n---- Installing %s ----" "$1"
|
printf "\n---- Installing %s ----" "$1"
|
||||||
apt-get -yq2 install "$1"
|
apt-get -yq2 install "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_serv() {
|
check_serv() {
|
||||||
if [ "$APACHE_2" -eq 1 ]; then
|
if [ "$APACHE_2" -eq 1 ]; then
|
||||||
echo "
|
echo -e "\nThe recommended setup is using NGINX, exiting...\n"
|
||||||
The recommended setup is using NGINX, exiting...
|
exit
|
||||||
"
|
elif [ "$NGINX" -eq 1 ]; then
|
||||||
exit
|
printf "\nWebserver already installed!\n"
|
||||||
elif [ "$NGINX" -eq 1 ]; then
|
else
|
||||||
|
printf "\nInstalling nginx webserver!\n"
|
||||||
printf "\nWebserver already installed!\n"
|
install_ifnot nginx
|
||||||
|
fi
|
||||||
else
|
|
||||||
printf "\nInstalling nginx webserver!\n"
|
|
||||||
install_ifnot nginx
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
check_snd_driver() {
|
check_snd_driver() {
|
||||||
printf "\n# Checking ALSA - Loopback module..."
|
printf "\n# Checking ALSA - Loopback module..."
|
||||||
echo "snd-aloop" | tee -a /etc/modules
|
echo "snd-aloop" | tee -a /etc/modules
|
||||||
modprobe snd-aloop
|
modprobe snd-aloop
|
||||||
if [ "$(lsmod|awk '/snd_aloop/{print$1}'|awk 'NR==1')" = "snd_aloop" ]; then
|
if [ "$(lsmod|awk '/snd_aloop/{print$1}'|awk 'NR==1')" = "snd_aloop" ]; then
|
||||||
echo "
|
echo -e "\n#-----------------------------------------------------------------------"
|
||||||
#-----------------------------------------------------------------------
|
echo "# Audio driver seems - OK."
|
||||||
# Audio driver seems - OK.
|
echo -e "#-----------------------------------------------------------------------\n"
|
||||||
#-----------------------------------------------------------------------"
|
else
|
||||||
else
|
echo -e "\n#-----------------------------------------------------------------------"
|
||||||
echo "
|
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."
|
||||||
# Your audio driver might not be able to load.
|
echo -e "#-----------------------------------------------------------------------\n"
|
||||||
# We'll check the state of this Jibri with our 'test-jibri-env.sh' tool.
|
#Test tool
|
||||||
#-----------------------------------------------------------------------"
|
if [ "$MODE" = "debug" ]; then
|
||||||
#Test tool
|
bash "$PWD"/tools/test-jibri-env.sh -m debug
|
||||||
if [ "$MODE" = "debug" ]; then
|
else
|
||||||
bash "$PWD"/tools/test-jibri-env.sh -m debug
|
bash "$PWD"/tools/test-jibri-env.sh
|
||||||
else
|
fi
|
||||||
bash "$PWD"/tools/test-jibri-env.sh
|
read -n 1 -s -r -p "Press any key to continue..."$'\n'
|
||||||
fi
|
fi
|
||||||
read -n 1 -s -r -p "Press any key to continue..."$'\n'
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
# sed limiters for add-jibri-node.sh variables
|
# sed limiters for add-jibri-node.sh variables
|
||||||
var_dlim() {
|
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
|
||||||
}
|
}
|
||||||
|
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() {
|
add_prosody_repo() {
|
||||||
echo "Add Prosody repo"
|
echo "Add Prosody repo"
|
||||||
if [ "$PROSODY_REPO" = "main" ]; then
|
if [ "$PROSODY_REPO" = "main" ]; then
|
||||||
echo "Prosody repository already installed"
|
echo "Prosody repository already installed"
|
||||||
else
|
else
|
||||||
echo "deb [signed-by=/etc/apt/trusted.gpg.d/prosody-debian-packages.key] http://packages.prosody.im/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/prosody.list
|
echo "deb [signed-by=/etc/apt/trusted.gpg.d/prosody-debian-packages.key] http://packages.prosody.im/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/prosody.list
|
||||||
curl -s https://prosody.im/files/prosody-debian-packages.key > /etc/apt/trusted.gpg.d/prosody-debian-packages.key
|
curl -s https://prosody.im/files/prosody-debian-packages.key > /etc/apt/trusted.gpg.d/prosody-debian-packages.key
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
dpkg-compare() {
|
dpkg-compare() {
|
||||||
dpkg --compare-versions "$(dpkg-query -f='${Version}' --show "$1")" "$2" "$3"
|
dpkg --compare-versions "$(dpkg-query -f='${Version}' --show "$1")" "$2" "$3"
|
||||||
}
|
}
|
||||||
wait_seconds() {
|
wait_seconds() {
|
||||||
secs=$(($1))
|
secs=$(($1))
|
||||||
while [ $secs -gt 0 ]; do
|
while [ $secs -gt 0 ]; do
|
||||||
echo -ne "$secs\033[0K\r"
|
echo -ne "$secs\033[0K\r"
|
||||||
sleep 1
|
sleep 1
|
||||||
: $((secs--))
|
: $((secs--))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
print_title() {
|
print_title() {
|
||||||
printwc "${Blue}" "\n#--------------------------------------------------"
|
printwc "${Blue}" "\n#--------------------------------------------------"
|
||||||
printwc "${Blue}" "\n# $1"
|
printwc "${Blue}" "\n# $1"
|
||||||
printwc "${Blue}" "\n#--------------------------------------------------\n"
|
printwc "${Blue}" "\n#--------------------------------------------------\n"
|
||||||
}
|
}
|
||||||
test_match() {
|
test_match() {
|
||||||
if grep -q "$1" "$2" ; then
|
if grep -q "$1" "$2" ; then
|
||||||
echo "$(basename "$2") - OK..."
|
echo "$(basename "$2") - OK..."
|
||||||
else
|
else
|
||||||
echo "$(basename "$2"), FAIL..."
|
echo "$(basename "$2"), FAIL..."
|
||||||
echo "Please report this to https://forge.switnet.net/switnet/quick-jibri-installer"
|
echo "Please report this to https://forge.switnet.net/switnet/quick-jibri-installer"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
printwc "${Green}" '
|
printwc "${Green}" '
|
||||||
|
@ -170,7 +169,7 @@ Featuring:
|
||||||
Learn more about these at,
|
Learn more about these at,
|
||||||
Main repository: https://forge.switnet.net/switnet/quick-jibri-installer
|
Main repository: https://forge.switnet.net/switnet/quick-jibri-installer
|
||||||
Wiki and documentation: https://forge.switnet.net/switnet/quick-jibri-installer/wiki\n\n'
|
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'
|
read -n 1 -s -r -p "Press any key to continue..."$'\n'
|
||||||
|
|
||||||
#Check if user is root
|
#Check if user is root
|
||||||
|
@ -193,8 +192,8 @@ NEXT_LTS_DATE=$(date -d 2024-04-01 +%s)
|
||||||
|
|
||||||
if [ "$DIST" = "focal" ]; then
|
if [ "$DIST" = "focal" ]; then
|
||||||
if [ "$TODAY" -gt "$NEXT_LTS_DATE" ]; then
|
if [ "$TODAY" -gt "$NEXT_LTS_DATE" ]; then
|
||||||
echo " > $(lsb_release -sc), even when it's compatible and functional.
|
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 " 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'
|
read -n 1 -s -r -p "Press any key to continue..."$'\n'
|
||||||
else
|
else
|
||||||
echo "Focal is supported."
|
echo "Focal is supported."
|
||||||
|
@ -281,9 +280,9 @@ printf "\nChecking for common desktop system oriented purpose....\n"
|
||||||
for de in "${SYSTEM_DE_ARRAY[@]}"
|
for de in "${SYSTEM_DE_ARRAY[@]}"
|
||||||
do
|
do
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$de" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
if [ "$(dpkg-query -W -f='${Status}' "$de" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
||||||
printf "\n > This instance has %s installed, exiting...
|
printf "\n > This instance has %s installed, exiting...\n" "$de"
|
||||||
\nPlease avoid using this installer on a desktop-user oriented GNU/Linux system.
|
printf "\nPlease avoid using this installer on a desktop-user oriented GNU/Linux system.\n"
|
||||||
This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't." "$de"
|
printf "This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't.\n"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
printf " > No standard desktop environment for user oriented porpuse detected, good!, continuing...\n\n"
|
printf " > No standard desktop environment for user oriented porpuse detected, good!, continuing...\n\n"
|
||||||
|
@ -340,14 +339,16 @@ sleep .1
|
||||||
if [ "$PUBLIC_IP" = "$(dig -4 +short "$JITSI_DOMAIN"||awk -v RS='([0-9]+\\.){3}[0-9]+' 'RT{print RT}')" ]; then
|
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"
|
printf "\nServer public IP & DNS record for %s seems to match, continuing..." "$JITSI_DOMAIN"
|
||||||
else
|
else
|
||||||
echo "Server public IP ($PUBLIC_IP) & DNS record for $JITSI_DOMAIN don't seem to match."
|
echo -n "Server public IP ($PUBLIC_IP) & DNS record for $JITSI_DOMAIN"
|
||||||
echo " > Please check your dns records are applied and updated, otherwise components may fail."
|
echo " don't seem to match."
|
||||||
read -p " > Do you want to continue?: (yes or no)$NL" -r DNS_CONTINUE
|
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
|
if [ "$DNS_CONTINUE" = "yes" ]; then
|
||||||
echo " - We'll continue anyway..."
|
echo " - We'll continue anyway..."
|
||||||
else
|
else
|
||||||
echo " - Exiting for now..."
|
echo " - Exiting for now..."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -375,8 +376,8 @@ if [ "$LE_SSL" = "yes" ]; then
|
||||||
apt-get -y install \
|
apt-get -y install \
|
||||||
certbot
|
certbot
|
||||||
if [ "$(dpkg-query -W -f='${Status}' ufw 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
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:
|
echo "# Disable pre-installed ufw, more on firewall see:"
|
||||||
> https://forge.switnet.net/switnet/quick-jibri-installer/wiki/Firewall"
|
echo " > https://forge.switnet.net/switnet/quick-jibri-installer/wiki/Firewall"
|
||||||
ufw disable
|
ufw disable
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1117,9 +1118,9 @@ if [ "$ENABLE_SC" = "yes" ]; then
|
||||||
prosodyctl register "$SEC_ROOM_USER" "$DOMAIN" "$SEC_ROOM_PASS"
|
prosodyctl register "$SEC_ROOM_USER" "$DOMAIN" "$SEC_ROOM_PASS"
|
||||||
sleep .1
|
sleep .1
|
||||||
printf "\nSecure rooms are being enabled...\n"
|
printf "\nSecure rooms are being enabled...\n"
|
||||||
echo "You'll be able to login Secure Room chat with '${SEC_ROOM_USER}' \
|
echo -n "You'll be able to login Secure Room chat with '${SEC_ROOM_USER}' "
|
||||||
or '${SEC_ROOM_USER}@${DOMAIN}' using the password you just entered.
|
echo "or '${SEC_ROOM_USER}@${DOMAIN}' using the password you just entered."
|
||||||
If you have issues with the password refer to your sysadmin."
|
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|#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|SEC_ROOM=.*|SEC_ROOM=\"on\"|" jm-bm.sh
|
||||||
fi
|
fi
|
||||||
|
@ -1219,7 +1220,8 @@ if [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then
|
||||||
systemctl disable jibri
|
systemctl disable jibri
|
||||||
systemctl disable jibri-xorg
|
systemctl disable jibri-xorg
|
||||||
systemctl disable jibri-icewm
|
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"
|
chmod -R 770 "$DIR_RECORD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue