This commit is contained in:
Slaviša Arežina 2025-07-06 10:44:16 +02:00 committed by GitHub
parent e492a9b5d9
commit a6517f4d7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 21 deletions

View File

@ -23,27 +23,28 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/barcodebuddy ]]; then if [[ ! -d /opt/barcodebuddy ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/Forceu/barcodebuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/Forceu/barcodebuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then if [[ "${RELEASE}" != "$(cat ~/.barcodebuddy 2>/dev/null)" ]] || [[ ! -f ~/.barcodebuddy ]]; then
msg_info "Stopping Service" msg_info "Stopping Service"
systemctl stop apache2 systemctl stop apache2
systemctl stop barcodebuddy systemctl stop barcodebuddy
msg_ok "Stopped Service" msg_ok "Stopped Service"
msg_info "Updating ${APP} to v${RELEASE}" msg_info "Backing up data"
cd /opt
mv /opt/barcodebuddy/ /opt/barcodebuddy-backup mv /opt/barcodebuddy/ /opt/barcodebuddy-backup
curl -fsSL "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip") msg_ok "Backed up data"
$STD unzip "v${RELEASE}.zip"
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy fetch_and_deploy_gh_release "barcodebuddy" "Forceu/barcodebuddy"
msg_info "Configuring ${APP}"
cp -r /opt/barcodebuddy-backup/data/. /opt/barcodebuddy/data cp -r /opt/barcodebuddy-backup/data/. /opt/barcodebuddy/data
chown -R www-data:www-data /opt/barcodebuddy/data chown -R www-data:www-data /opt/barcodebuddy/data
echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Configured ${APP}"
msg_ok "Updated $APP to v${RELEASE}"
msg_info "Starting Service" msg_info "Starting Service"
systemctl start apache2 systemctl start apache2
@ -51,7 +52,6 @@ function update_script() {
msg_ok "Started Service" msg_ok "Started Service"
msg_info "Cleaning up" msg_info "Cleaning up"
rm -r "/opt/v${RELEASE}.zip"
rm -r /opt/barcodebuddy-backup rm -r /opt/barcodebuddy-backup
msg_ok "Cleaned" msg_ok "Cleaned"
msg_ok "Updated Successfully" msg_ok "Updated Successfully"

View File

@ -16,20 +16,15 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
apache2 \ apache2 \
redis \ redis
php-{curl,date,json,mbstring,redis,sqlite3,sockets} \
libapache2-mod-php
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing barcodebuddy" PHP_VERSION="8.2" PHP_APACHE="YES" PHP_MODULE="date, json, redis, sqlite3, sockets" setup_php
RELEASE=$(curl -fsSL https://api.github.com/repos/Forceu/barcodebuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') fetch_and_deploy_gh_release "barcodebuddy" "Forceu/barcodebuddy"
cd /opt
curl -fsSL "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip" -o "v${RELEASE}.zip" msg_info "Configuring barcodebuddy"
$STD unzip "v${RELEASE}.zip"
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy
chown -R www-data:www-data /opt/barcodebuddy/data chown -R www-data:www-data /opt/barcodebuddy/data
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Configured barcodebuddy"
msg_ok "Installed barcodebuddy"
msg_info "Creating Services" msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/barcodebuddy.service cat <<EOF >/etc/systemd/system/barcodebuddy.service
@ -73,7 +68,6 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf "/opt/v${RELEASE}.zip"
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"