From 1a90d90d5e7068d989f3e160746f25bfb1f25c7e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 15 Jul 2025 13:12:32 +0200 Subject: [PATCH] 2FAuth: Improve Update-Check (#5998) --- ct/2fauth.sh | 10 +++++++--- install/2fauth-install.sh | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ct/2fauth.sh b/ct/2fauth.sh index 416f86914..469942756 100644 --- a/ct/2fauth.sh +++ b/ct/2fauth.sh @@ -28,8 +28,11 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ "${RELEASE}" != "$(cat ~/.2fauth 2>/dev/null || cat /opt/2fauth_version.txt 2>/dev/null)" ]]; then + if ! command -v jq &>/dev/null; then + $STD apt-get install -y jq + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/Bubka/2FAuth/releases/latest | jq -r '.tag_name' | sed 's/^v//') + if [[ "${RELEASE}" != "$(cat ~/.2fauth 2>/dev/null)" ]] || [[ ! -f ~/.2fauth ]]; then msg_info "Updating $APP to ${RELEASE}" $STD apt-get update $STD apt-get -y upgrade @@ -45,10 +48,11 @@ function update_script() { $STD apt-get install -y \ lsb-release \ gnupg2 - PHP_VERSION="8.3" PHP_MODULE="common,ctype,fileinfo,fpm,mysql,cli" setup_php + PHP_VERSION="8.3" PHP_MODULE="common,ctype,fileinfo,mysql,cli" PHP_FPM="YES" setup_php sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf fi fetch_and_deploy_gh_release "2fauth" "Bubka/2FAuth" + setup_composer mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env" mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage" cd "/opt/2fauth" || return diff --git a/install/2fauth-install.sh b/install/2fauth-install.sh index d5102d017..8b190d7f1 100644 --- a/install/2fauth-install.sh +++ b/install/2fauth-install.sh @@ -19,7 +19,7 @@ $STD apt-get install -y \ nginx msg_ok "Installed Dependencies" -PHP_VERSION="8.3" PHP_MODULE="common,ctype,fileinfo,fpm,mysql,cli" setup_php +PHP_VERSION="8.3" PHP_MODULE="common,ctype,fileinfo,mysql,cli" PHP_FPM="YES" setup_php setup_composer setup_mariadb