From 49d9984841289aa2d165dac6f19f087e305f4a21 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 22 Jul 2025 09:28:50 +0200 Subject: [PATCH] finalize --- ct/linkstack.sh | 42 +++++++++++++++++++++++++++++------- install/linkstack-install.sh | 2 +- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/ct/linkstack.sh b/ct/linkstack.sh index 2a88277d..db1ad4ef 100644 --- a/ct/linkstack.sh +++ b/ct/linkstack.sh @@ -23,20 +23,46 @@ function update_script() { header_info check_container_storage check_container_resources - - if [[ ! -d /var ]]; then + + if [[ ! -f /.linkstack ]]; then msg_error "No ${APP} Installation Found!" exit fi - - msg_info "Updating $APP LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" - + + RELEASE=$(curl -fsSL https://api.github.com/repos/linkstackorg/linkstack/releases/latest | jq -r '.tag_name | ltrimstr("v")') + if [[ "${RELEASE}" != "$(cat ~/.linkstack 2>/dev/null)" ]] || [[ ! -f ~/.linkstack ]]; then + msg_info "Stopping $APP" + systemctl stop apache2 + msg_ok "Stopped $APP" + + msg_info "Creating Backup" + BACKUP_FILE="/opt/linkstack_backup_$(date +%F).tar.gz" + $STD tar -czf "$BACKUP_FILE" /var/www/html/linkstack + msg_ok "Backup Created" + + PHP_VERSION="8.3" PHP_MODULE="sqlite3" PHP_APACHE="YES" setup_php + fetch_and_deploy_gh_release "linkstack" "linkstackorg/linkstack" "prebuild" "latest" "/var/www/html/linkstack" "linkstack.zip" + + msg_info "Updating $APP to v${RELEASE}" + chown -R www-data:www-data /var/www/html/linkstack + chmod -R 755 /var/www/html/linkstack + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start linkstack + msg_ok "Started $APP" + + msg_info "Cleaning Up" + rm -rf "$BACKUP_FILE" + msg_ok "Cleanup Completed" + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi exit } + start build_container description diff --git a/install/linkstack-install.sh b/install/linkstack-install.sh index afcd4b02..72d30386 100644 --- a/install/linkstack-install.sh +++ b/install/linkstack-install.sh @@ -48,7 +48,7 @@ EOF $STD a2dissite 000-default.conf $STD a2ensite linkstack.conf $STD systemctl restart apache2 -msg_ok "Installed LinkStack" +msg_ok "Configured LinkStack" motd_ssh customize