2FAuth: Improve Update-Check (#5998)

This commit is contained in:
CanbiZ 2025-07-15 13:12:32 +02:00 committed by GitHub
parent 11f1e86500
commit 1a90d90d5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -28,8 +28,11 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi 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 ! command -v jq &>/dev/null; then
if [[ "${RELEASE}" != "$(cat ~/.2fauth 2>/dev/null || cat /opt/2fauth_version.txt 2>/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}" msg_info "Updating $APP to ${RELEASE}"
$STD apt-get update $STD apt-get update
$STD apt-get -y upgrade $STD apt-get -y upgrade
@ -45,10 +48,11 @@ function update_script() {
$STD apt-get install -y \ $STD apt-get install -y \
lsb-release \ lsb-release \
gnupg2 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 sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf
fi fi
fetch_and_deploy_gh_release "2fauth" "Bubka/2FAuth" fetch_and_deploy_gh_release "2fauth" "Bubka/2FAuth"
setup_composer
mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env" mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env"
mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage" mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage"
cd "/opt/2fauth" || return cd "/opt/2fauth" || return

View File

@ -19,7 +19,7 @@ $STD apt-get install -y \
nginx nginx
msg_ok "Installed Dependencies" 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_composer
setup_mariadb setup_mariadb