jitsi-updater.sh: fix check version update loop

This commit is contained in:
Luis Guzmán 2025-09-01 04:11:25 -06:00
parent 74dc62a425
commit ebda930729
1 changed files with 12 additions and 4 deletions

View File

@ -77,7 +77,7 @@ 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() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } version_gt() { dpkg --compare-versions "$1" gt "$2"; }
restart_jibri() { restart_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" ]
@ -116,7 +116,7 @@ update_google_repo() {
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="$(awk '{printf "%.1f\n", $NF}' <<< "$CHD_VER_LOCAL")" CHD_VER_2D="$(cut -d. -f1,2 <<< "$CHD_VER_LOCAL")"
fi fi
} }
update_nodejs_repo() { update_nodejs_repo() {
@ -127,7 +127,7 @@ update_nodejs_repo() {
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
GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')" GOOGL_VER_2D="$(/usr/bin/google-chrome --product-version 2>/dev/null | cut -d. -f1,2)"
else else
printwc "${Yellow}" " -> Seems there is no Google Chrome installed\n" printwc "${Yellow}" " -> Seems there is no Google Chrome installed\n"
IS_GLG_CHRM="no" IS_GLG_CHRM="no"
@ -139,6 +139,14 @@ if [ -n "$GOOGL_VER_2D" ]; then
check_latest_gc check_latest_gc
if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" ; then if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" ; then
echo "Upgrading Chromedriver to Google Chromes version" echo "Upgrading Chromedriver to Google Chromes version"
if [ -x /usr/bin/google-chrome ]; then
G_CHROME="$(/usr/bin/google-chrome --product-version 2>/dev/null | cut -d. -f1-3)"
fi
CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json | \
jq -r ".versions[].downloads.chromedriver | select(. != null) | .[].url" | \
grep linux64 | grep "$G_CHROME" | tail -1)
CHD_LTST=$(awk -F '/' '{print$7}' <<< "$CHD_LTST_DWNL")
CHD_LTST_2D="$(cut -d. -f1,2 <<< "$CHD_LTST")"
wget -q "$CHD_LTST_DWNL" \ wget -q "$CHD_LTST_DWNL" \
-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/
@ -147,7 +155,7 @@ if [ -n "$GOOGL_VER_2D" ]; then
chmod 0755 "$CHDB" chmod 0755 "$CHDB"
rm -rf /tpm/chromedriver_linux64.zip rm -rf /tpm/chromedriver_linux64.zip
printf "Current version: " printf "Current version: "
printwc "$Green" "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')" printwc "$Green" "$($CHDB -v | awk '{print $2}' | cut -d. -f1,2)"
echo -e " (latest available)\n" echo -e " (latest available)\n"
elif [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then elif [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then
echo "No need to upgrade Chromedriver" echo "No need to upgrade Chromedriver"