jitsi-updater: add fallback support for legacy apt sources

This commit is contained in:
Luis Guzmán 2026-02-26 11:06:29 -06:00
parent adb4e32c27
commit a3917e9f15
1 changed files with 61 additions and 24 deletions

View File

@ -37,10 +37,11 @@ if [ ! -f jm-bm.sh ]; then
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"
ENABLE_BLESSM="TBD" ENABLE_BLESSM="TBD"
G_CHROME=$(apt-cache madison google-chrome-stable|awk '{print$3}'|cut -d. -f1-3) G_CHROME=$(apt-cache madison google-chrome-stable 2>/dev/null | awk '{print$3}'|cut -d. -f1-3)
CHROMELAB_URL="https://googlechromelabs.github.io/chrome-for-testing" CHROMELAB_URL="https://googlechromelabs.github.io/chrome-for-testing"
CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json | \ CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json | \
jq -r ".versions[].downloads.chromedriver | select(. != null) | .[].url" | \ jq -r ".versions[].downloads.chromedriver | select(. != null) | .[].url" | \
@ -48,9 +49,10 @@ CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json |
CHD_LTST=$(awk -F '/' '{print$7}' <<< "$CHD_LTST_DWNL") CHD_LTST=$(awk -F '/' '{print$7}' <<< "$CHD_LTST_DWNL")
CHD_LTST_2D="$(cut -d "." -f 1,2 <<< "$CHD_LTST")" CHD_LTST_2D="$(cut -d "." -f 1,2 <<< "$CHD_LTST")"
CHDB="$(whereis chromedriver | awk '{print$2}')" CHDB="$(whereis chromedriver | awk '{print$2}')"
if [ -d /etc/prosody/conf.d/ ]; then if [ -d /etc/prosody/conf.d/ ]; then
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua | \ DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua | \
awk -F'.cfg' '!/localhost/{print $1}' | xargs basename)" awk -F'.cfg' '!/localhost/{print $1}' | xargs basename 2>/dev/null)"
else else
echo -e "Seems no prosody is installed...\n > is this a jibri node?" echo -e "Seems no prosody is installed...\n > is this a jibri node?"
fi fi
@ -61,21 +63,44 @@ PREAD_PROXY="$(grep -nr "preread_server_name" "$JITSI_MEET_PROXY" | cut -d ":" -
fi fi
INT_CONF="/usr/share/jitsi-meet/interface_config.js" INT_CONF="/usr/share/jitsi-meet/interface_config.js"
INT_CONF_ETC="/etc/jitsi/meet/$DOMAIN-interface_config.js" INT_CONF_ETC="/etc/jitsi/meet/$DOMAIN-interface_config.js"
read -r -a jibri_packages < <(grep ^Package /var/lib/apt/lists/download.jitsi.org_*_Packages | \
# ----------------------------------------------------------------------
# Helper to detect .list or .sources files
# ----------------------------------------------------------------------
get_repo_file() {
local base_name=$1
if [ -f "$apt_repo/${base_name}.sources" ]; then
echo "${base_name}.sources"
elif [ -f "$apt_repo/${base_name}.list" ]; then
echo "${base_name}.list"
else
echo ""
fi
}
JITSI_STABLE_REPO=$(get_repo_file "jitsi-stable")
JITSI_UNSTABLE_REPO=$(get_repo_file "jitsi-unstable")
GC_REPO=$(get_repo_file "google-chrome")
NODE_REPO=$(get_repo_file "nodesource")
read -r -a jibri_packages < <(grep ^Package /var/lib/apt/lists/download.jitsi.org_*_Packages 2>/dev/null | \
sort -u | awk '{print $2}' | xargs) sort -u | awk '{print $2}' | xargs)
AVATAR="$(grep -r avatar /etc/nginx/sites-*/ 2>/dev/null)" AVATAR="$(grep -r avatar /etc/nginx/sites-*/ 2>/dev/null)"
if [ -f "$apt_repo"/google-chrome.list ]; then
read -r -a google_package < <(grep ^Package /var/lib/apt/lists/dl.google.com_*_Packages | \ if [ -n "$GC_REPO" ]; then
read -r -a google_package < <(grep ^Package /var/lib/apt/lists/dl.google.com_*_Packages 2>/dev/null | \
sort -u | awk '{print $2}' | xargs) sort -u | awk '{print $2}' | xargs)
else else
echo "Seems no Google repo installed" echo "Seems no Google repo installed"
fi fi
if [ -f "$apt_repo"/nodesource.list ]; then
read -r -a nodejs_package < <(grep ^Package /var/lib/apt/lists/deb.nodesource.com_node*_Packages | \ if [ -n "$NODE_REPO" ]; then
read -r -a nodejs_package < <(grep ^Package /var/lib/apt/lists/deb.nodesource.com_node*_Packages 2>/dev/null | \
sort -u | awk '{print $2}' | xargs) sort -u | awk '{print $2}' | xargs)
else else
echo "Seems no nodejs repo installed" echo "Seems no nodejs repo installed"
fi fi
# True if $1 is greater than $2 # True if $1 is greater than $2
version_gt() { dpkg --compare-versions "$1" gt "$2"; } version_gt() { dpkg --compare-versions "$1" gt "$2"; }
@ -99,16 +124,17 @@ restart_services() {
} }
update_jitsi_repo() { update_jitsi_repo() {
apt-get update -o Dir::Etc::sourcelist="sources.list.d/jitsi-$1.list" \ # Takes the specific repo file (e.g. jitsi-stable.list or jitsi-stable.sources) as argument
apt-get update -o Dir::Etc::sourcelist="sources.list.d/$1" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install -q2 --only-upgrade <<< printf "${jibri_packages[@]}" apt-get install -y -q2 --only-upgrade <<< printf "${jibri_packages[@]}"
} }
update_google_repo() { update_google_repo() {
if [ -f "$apt_repo"/google-chrome.list ]; then if [ -n "$GC_REPO" ]; then
apt-get update -o Dir::Etc::sourcelist="sources.list.d/google-chrome.list" \ apt-get update -o Dir::Etc::sourcelist="sources.list.d/$GC_REPO" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install -q2 --only-upgrade <<< printf "${google_package[@]}" apt-get install -y -q2 --only-upgrade <<< printf "${google_package[@]}"
else else
echo "No Google repository found" echo "No Google repository found"
fi fi
@ -119,11 +145,13 @@ update_google_repo() {
CHD_VER_2D="$(cut -d. -f1,2 <<< "$CHD_VER_LOCAL")" CHD_VER_2D="$(cut -d. -f1,2 <<< "$CHD_VER_LOCAL")"
fi fi
} }
update_nodejs_repo() { update_nodejs_repo() {
apt-get update -o Dir::Etc::sourcelist="sources.list.d/nodesource.list" \ apt-get update -o Dir::Etc::sourcelist="sources.list.d/$NODE_REPO" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install -q2 --only-upgrade <<< printf "${nodejs_package[@]}" apt-get install -y -q2 --only-upgrade <<< printf "${nodejs_package[@]}"
} }
check_latest_gc() { check_latest_gc() {
printwc "${Purple}" "Checking for Google Chrome\n" printwc "${Purple}" "Checking for Google Chrome\n"
if [ -f /usr/bin/google-chrome ]; then if [ -f /usr/bin/google-chrome ]; then
@ -133,7 +161,9 @@ else
IS_GLG_CHRM="no" IS_GLG_CHRM="no"
fi fi
} }
check_latest_gc check_latest_gc
upgrade_cd() { upgrade_cd() {
if [ -n "$GOOGL_VER_2D" ]; then if [ -n "$GOOGL_VER_2D" ]; then
check_latest_gc check_latest_gc
@ -153,7 +183,7 @@ if [ -n "$GOOGL_VER_2D" ]; then
mv /usr/local/bin/chromedriver-linux64/chromedriver "$CHDB" mv /usr/local/bin/chromedriver-linux64/chromedriver "$CHDB"
chown root:root "$CHDB" chown root:root "$CHDB"
chmod 0755 "$CHDB" chmod 0755 "$CHDB"
rm -rf /tpm/chromedriver_linux64.zip rm -rf /tmp/chromedriver_linux64.zip
printf "Current version: " printf "Current version: "
printwc "$Green" "$($CHDB -v | awk '{print $2}' | cut -d. -f1,2)" printwc "$Green" "$($CHDB -v | awk '{print $2}' | cut -d. -f1,2)"
echo -e " (latest available)\n" echo -e " (latest available)\n"
@ -163,7 +193,7 @@ if [ -n "$GOOGL_VER_2D" ]; then
printwc "$Green" "$CHD_VER_2D\n" printwc "$Green" "$CHD_VER_2D\n"
fi fi
else else
printwc "${Yellow}" " -> No Google Chrome versión to match, leaving untouched.\n" printwc "${Yellow}" " -> No Google Chrome version to match, leaving untouched.\n"
fi fi
} }
@ -182,25 +212,29 @@ fi
} }
printwc "${Blue}" "Update & upgrade Jitsi and components\n" printwc "${Blue}" "Update & upgrade Jitsi and components\n"
if [ -f "$apt_repo"/jitsi-unstable.list ]; then if [ -n "$JITSI_UNSTABLE_REPO" ]; then
update_jitsi_repo unstable update_jitsi_repo "$JITSI_UNSTABLE_REPO"
update_google_repo update_google_repo
check_lst_cd check_lst_cd
elif [ -f "$apt_repo"/jitsi-stable.list ]; then elif [ -n "$JITSI_STABLE_REPO" ]; then
update_jitsi_repo stable update_jitsi_repo "$JITSI_STABLE_REPO"
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
printwc "${Blue}" "Check for supported nodejs LTS version"
if version_gt "14" "$(dpkg-query -W -f='${Version}' nodejs)"; then printwc "${Blue}" "Check for supported nodejs LTS version\n"
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - CURRENT_NODE_VER=$(dpkg-query -W -f='${Version}' nodejs 2>/dev/null || echo "0")
# Target to 22.x, in the future newer versions.
if version_gt "22" "$CURRENT_NODE_VER"; then
curl -sL https://deb.nodesource.com/setup_22.x | sudo -E bash -
apt-get install -yq2 nodejs apt-get install -yq2 nodejs
else elif [ -n "$NODE_REPO" ]; then
update_nodejs_repo update_nodejs_repo
fi fi
check_if_installed(){ check_if_installed(){
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" echo "1"
@ -208,6 +242,7 @@ else
echo "0" echo "0"
fi fi
} }
check_for_jibri_node() { check_for_jibri_node() {
if [ "$(check_if_installed jibri)" = 1 ] && \ if [ "$(check_if_installed jibri)" = 1 ] && \
[ "$(check_if_installed jitsi-meet)" = 0 ] && \ [ "$(check_if_installed jitsi-meet)" = 0 ] && \
@ -216,6 +251,7 @@ if [ "$(check_if_installed jibri)" = 1 ] && \
JIBRI_NODE="yes" JIBRI_NODE="yes"
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.
# We divide them on UI changes and branding changes, feel free to adapt # We divide them on UI changes and branding changes, feel free to adapt
@ -252,6 +288,7 @@ else
printwc "${Purple}" "========== Disable Blur my background ==========\n" printwc "${Purple}" "========== Disable Blur my background ==========\n"
sed -i "s|'videobackgroundblur', ||" "$INT_CONF" sed -i "s|'videobackgroundblur', ||" "$INT_CONF"
fi fi
if [ "$(check_if_installed openjdk-8-jre-headless)" = 1 ]; then if [ "$(check_if_installed openjdk-8-jre-headless)" = 1 ]; then
printwc "${Red}" "\n::: Unsupported OpenJDK JRE version found :::\n" printwc "${Red}" "\n::: Unsupported OpenJDK JRE version found :::\n"
apt-get install -y openjdk-11-jre-headless apt-get install -y openjdk-11-jre-headless