fix(2fauth): 🔊 Updated progress logging

This commit is contained in:
Janek 2024-12-23 11:02:18 +00:00
parent 5b95ff800c
commit 16a7377b49

View File

@ -38,7 +38,7 @@ function update_script() {
# Crawling the new version and checking whether an update is required # Crawling the new version and checking whether an update is required
RELEASE=$(curl -s https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Updating $APP" msg_info "Updating $APP to v${RELEASE}"
apt-get update &>/dev/null apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null apt-get -y upgrade &>/dev/null
@ -49,14 +49,12 @@ function update_script() {
msg_ok "Backup Created" msg_ok "Backup Created"
# Execute Update # Execute Update
msg_info "Updating $APP to v${RELEASE}"
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip" wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip" unzip -q "${RELEASE}.zip"
mv "2FAuth-${RELEASE//v}/" "/opt/2fauth" mv "2FAuth-${RELEASE//v}/" "/opt/2fauth"
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
msg_ok "Updated $APP to v${RELEASE}"
chown -R www-data: "/opt/2fauth" chown -R www-data: "/opt/2fauth"
chmod -R 755 "/opt/2fauth" chmod -R 755 "/opt/2fauth"
@ -65,7 +63,6 @@ function update_script() {
composer install --no-dev --prefer-source &>/dev/null composer install --no-dev --prefer-source &>/dev/null
php artisan 2fauth:install php artisan 2fauth:install
msg_ok "Updated $APP to v${RELEASE}"
# Cleaning up # Cleaning up
msg_info "Cleaning Up" msg_info "Cleaning Up"
@ -76,7 +73,7 @@ function update_script() {
# Last Action # Last Action
echo "${RELEASE}" >/opt/2fauth_version.txt echo "${RELEASE}" >/opt/2fauth_version.txt
msg_ok "Update Successful" msg_ok "Updated $APP to v${RELEASE}"
else else
msg_ok "No update required. ${APP} is already at v${RELEASE}" msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi fi