Refactor: grocy (#6307)

This commit is contained in:
Slaviša Arežina
2025-07-28 22:14:32 +02:00
committed by GitHub
parent 8846915506
commit 89ab0f162c
2 changed files with 16 additions and 30 deletions

View File

@@ -27,20 +27,20 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
php_version=$(php -v | head -n 1 | awk '{print $2}')
if [[ ! $php_version == "8.3"* ]]; then
msg_info "Updating PHP"
curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ bookworm main" >/etc/apt/sources.list.d/php.list
apt-get update
apt-get install -y php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl,sqlite3,fpm,gd,zip,xml}
systemctl reload apache2
apt autoremove
msg_ok "Updated PHP"
php_ver=$(php -v | head -n 1 | awk '{print $2}')
if [[ ! $php_ver == "8.3"* ]]; then
PHP_VERSION="8.3" PHP_MODULE="sqlite3,bz2" PHP_APACHE="yes" setup_php
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/grocy/grocy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat ~/.grocy 2>/dev/null)" ]] || [[ ! -f ~/.grocy ]]; then
msg_info "Updating ${APP}"
bash /var/www/html/update.sh
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
msg_info "Updating ${APP}"
bash /var/www/html/update.sh
msg_ok "Updated Successfully"
exit
}