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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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
}

View File

@ -17,23 +17,10 @@ msg_info "Installing Dependencies"
$STD apt-get install -y apt-transport-https
msg_ok "Installed Dependencies"
msg_info "Installing PHP8.2"
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
echo -e "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $VERSION main" >/etc/apt/sources.list.d/php.list
$STD apt-get update
$STD apt-get install -y php8.2
$STD apt-get install -y libapache2-mod-php8.2
$STD apt-get install -y php8.2-sqlite3
$STD apt-get install -y php8.2-gd
$STD apt-get install -y php8.2-intl
$STD apt-get install -y php8.2-mbstring
msg_ok "Installed PHP8.2"
PHP_VERSION="8.3" PHP_MODULE="sqlite3,bz2" PHP_APACHE="yes" setup_php
fetch_and_deploy_gh_release "grocy" "grocy/grocy" "prebuild" "latest" "/var/www/html" "grocy*.zip"
msg_info "Installing grocy"
latest=$(curl -fsSL https://api.github.com/repos/grocy/grocy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/grocy/grocy/releases/download/v${latest}/grocy_${latest}.zip" -o "grocy_${latest}.zip"
$STD unzip grocy_${latest}.zip -d /var/www/html
msg_info "Configuring grocy"
chown -R www-data:www-data /var/www/html
cp /var/www/html/config-dist.php /var/www/html/data/config.php
chmod +x /var/www/html/update.sh
@ -64,5 +51,4 @@ customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
rm -rf /root/grocy_${latest}.zip
msg_ok "Cleaned"