This commit is contained in:
Slaviša Arežina
2025-07-05 22:30:08 +02:00
committed by GitHub
parent ae24b56c61
commit e140631760
2 changed files with 20 additions and 21 deletions

View File

@ -23,25 +23,31 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/bookstack ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/BookStackApp/BookStack/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 ~/.bookstack 2>/dev/null)" ]] || [[ ! -f ~/.bookstack ]]; then
msg_info "Stopping Apache2"
systemctl stop apache2
msg_ok "Services Stopped"
msg_info "Updating ${APP} to v${RELEASE}"
msg_info "Backing up data"
mv /opt/bookstack /opt/bookstack-backup
curl -fsSL "https://github.com/BookStackApp/BookStack/archive/refs/tags/v${RELEASE}.zip" -o "/opt/BookStack-${RELEASE}.zip"
$STD unzip "/opt/BookStack-${RELEASE}.zip" -d /opt
mv "/opt/BookStack-${RELEASE}" /opt/bookstack
msg_ok "Backup finished"
fetch_and_deploy_gh_release "bookstack" "BookStackApp/BookStack"
msg_info "Restoring backup"
cp /opt/bookstack-backup/.env /opt/bookstack/.env
[[ -d /opt/bookstack-backup/public/uploads ]] && cp -a /opt/bookstack-backup/public/uploads/. /opt/bookstack/public/uploads/
[[ -d /opt/bookstack-backup/storage/uploads ]] && cp -a /opt/bookstack-backup/storage/uploads/. /opt/bookstack/storage/uploads/
[[ -d /opt/bookstack-backup/themes ]] && cp -a /opt/bookstack-backup/themes/. /opt/bookstack/themes/
msg_ok "Backup restored"
msg_info "Configuring BookStack"
cd /opt/bookstack
export COMPOSER_ALLOW_SUPERUSER=1
$STD composer install --no-dev
@ -51,7 +57,7 @@ function update_script() {
chmod -R 775 /opt/bookstack/storage /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads
chmod -R 640 /opt/bookstack/.env
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to v${RELEASE}"
msg_ok "Configured BookStack"
msg_info "Starting Apache2"
systemctl start apache2
@ -59,7 +65,6 @@ function update_script() {
msg_info "Cleaning Up"
rm -rf /opt/bookstack-backup
rm -rf "/opt/BookStack-${RELEASE}.zip"
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else