From a3917e9f15705cd0331a763198d6375950950c2f Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 26 Feb 2026 11:06:29 -0600 Subject: [PATCH] jitsi-updater: add fallback support for legacy apt sources --- jitsi-updater.sh | 85 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 24 deletions(-) diff --git a/jitsi-updater.sh b/jitsi-updater.sh index 70f5337..ff7a2cc 100644 --- a/jitsi-updater.sh +++ b/jitsi-updater.sh @@ -37,10 +37,11 @@ if [ ! -f jm-bm.sh ]; then echo "other wise the updater might have errors or be incomplete. Exiting..." exit fi + support="https://switnet.net/support" apt_repo="/etc/apt/sources.list.d" 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" CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json | \ 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_2D="$(cut -d "." -f 1,2 <<< "$CHD_LTST")" CHDB="$(whereis chromedriver | awk '{print$2}')" + if [ -d /etc/prosody/conf.d/ ]; then 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 echo -e "Seems no prosody is installed...\n > is this a jibri node?" fi @@ -61,21 +63,44 @@ PREAD_PROXY="$(grep -nr "preread_server_name" "$JITSI_MEET_PROXY" | cut -d ":" - fi INT_CONF="/usr/share/jitsi-meet/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) 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) else echo "Seems no Google repo installed" 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) else echo "Seems no nodejs repo installed" fi + # True if $1 is greater than $2 version_gt() { dpkg --compare-versions "$1" gt "$2"; } @@ -99,16 +124,17 @@ restart_services() { } 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" - apt-get install -q2 --only-upgrade <<< printf "${jibri_packages[@]}" + apt-get install -y -q2 --only-upgrade <<< printf "${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" \ + if [ -n "$GC_REPO" ]; then + apt-get update -o Dir::Etc::sourcelist="sources.list.d/$GC_REPO" \ -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 echo "No Google repository found" fi @@ -119,11 +145,13 @@ update_google_repo() { CHD_VER_2D="$(cut -d. -f1,2 <<< "$CHD_VER_LOCAL")" fi } + 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" - apt-get install -q2 --only-upgrade <<< printf "${nodejs_package[@]}" + apt-get install -y -q2 --only-upgrade <<< printf "${nodejs_package[@]}" } + check_latest_gc() { printwc "${Purple}" "Checking for Google Chrome\n" if [ -f /usr/bin/google-chrome ]; then @@ -133,7 +161,9 @@ else IS_GLG_CHRM="no" fi } + check_latest_gc + upgrade_cd() { if [ -n "$GOOGL_VER_2D" ]; then check_latest_gc @@ -153,7 +183,7 @@ if [ -n "$GOOGL_VER_2D" ]; then mv /usr/local/bin/chromedriver-linux64/chromedriver "$CHDB" chown root:root "$CHDB" chmod 0755 "$CHDB" - rm -rf /tpm/chromedriver_linux64.zip + rm -rf /tmp/chromedriver_linux64.zip printf "Current version: " printwc "$Green" "$($CHDB -v | awk '{print $2}' | cut -d. -f1,2)" echo -e " (latest available)\n" @@ -163,7 +193,7 @@ if [ -n "$GOOGL_VER_2D" ]; then printwc "$Green" "$CHD_VER_2D\n" fi 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 } @@ -182,25 +212,29 @@ fi } printwc "${Blue}" "Update & upgrade Jitsi and components\n" -if [ -f "$apt_repo"/jitsi-unstable.list ]; then - update_jitsi_repo unstable +if [ -n "$JITSI_UNSTABLE_REPO" ]; then + update_jitsi_repo "$JITSI_UNSTABLE_REPO" update_google_repo check_lst_cd -elif [ -f "$apt_repo"/jitsi-stable.list ]; then - update_jitsi_repo stable +elif [ -n "$JITSI_STABLE_REPO" ]; then + update_jitsi_repo "$JITSI_STABLE_REPO" update_google_repo check_lst_cd else echo "Please check your repositories, something is not right." exit 1 fi -printwc "${Blue}" "Check for supported nodejs LTS version" -if version_gt "14" "$(dpkg-query -W -f='${Version}' nodejs)"; then - curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - + +printwc "${Blue}" "Check for supported nodejs LTS version\n" +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 -else +elif [ -n "$NODE_REPO" ]; then update_nodejs_repo fi + check_if_installed(){ if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo "1" @@ -208,6 +242,7 @@ else echo "0" fi } + check_for_jibri_node() { if [ "$(check_if_installed jibri)" = 1 ] && \ [ "$(check_if_installed jitsi-meet)" = 0 ] && \ @@ -216,6 +251,7 @@ if [ "$(check_if_installed jibri)" = 1 ] && \ JIBRI_NODE="yes" fi } + # Any customization, image, name or link change for any purpose should # be documented here so new updates won't remove those changes. # 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" sed -i "s|'videobackgroundblur', ||" "$INT_CONF" fi + if [ "$(check_if_installed openjdk-8-jre-headless)" = 1 ]; then printwc "${Red}" "\n::: Unsupported OpenJDK JRE version found :::\n" apt-get install -y openjdk-11-jre-headless