Skip to content

Commit 6487885

Browse files
Fix: Bookstack Update Function (#844)
* Fix: Bookstack Update Function * Fixed Formating * Update Identions and Spaces * Changes * Add leadng / to unzip --------- Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
1 parent 700902b commit 6487885

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

ct/bookstack.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,41 @@ function update_script() {
3838
systemctl stop apache2
3939
msg_ok "Services Stopped"
4040

41-
msg_info "Updating ${APP} to ${RELEASE}"
42-
cp /opt/bookstack/.env /opt/.env
43-
wget -q "https://github.com/BookStackApp/BookStack/archive/refs/tags/v${RELEASE}.zip"
44-
unzip -q v${RELEASE}.zip
45-
mv BookStack-${RELEASE} /opt/bookstack
46-
mv /opt/.env /opt/bookstack/.env
41+
msg_info "Updating ${APP} to v${RELEASE}"
42+
mv /opt/bookstack /opt/bookstack-backup
43+
wget -q --directory-prefix=/opt "https://github.com/BookStackApp/BookStack/archive/refs/tags/v${RELEASE}.zip"
44+
unzip -q /opt/v${RELEASE}.zip -d /opt
45+
mv /opt/BookStack-${RELEASE} /opt/bookstack
46+
cp /opt/bookstack-backup/.env /opt/bookstack/.env
47+
cp -r /opt/bookstack-backup/public/uploads/ /opt/bookstack/public/uploads
48+
cp -r /opt/bookstack-backup/storage/uploads/ /opt/bookstack/storage/uploads
49+
cp -r /opt/bookstack-backup/themes/ /opt/bookstack/themes
4750
cd /opt/bookstack
4851
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev &>/dev/null
4952
php artisan key:generate --force &>/dev/null
5053
php artisan migrate --force &>/dev/null
54+
chown www-data:www-data -R /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage
55+
chmod -R 755 /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage
56+
chmod -R 775 /opt/bookstack/storage /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads
57+
chmod -R 640 /opt/bookstack/.env
5158
echo "${RELEASE}" >/opt/${APP}_version.txt
52-
msg_ok "Updated ${APP}"
59+
msg_ok "Updated ${APP} to v${RELEASE}"
5360

5461
msg_info "Starting Apache2"
5562
systemctl start apache2
5663
msg_ok "Started Apache2"
5764

5865
msg_info "Cleaning Up"
59-
rm -rf v${RELEASE}.zip
66+
rm -rf /opt/bookstack-backup
67+
rm -rf /opt/v${RELEASE}.zip
6068
msg_ok "Cleaned"
6169
msg_ok "Updated Successfully"
6270
else
63-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
71+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
6472
fi
6573
exit
6674
}
75+
6776
start
6877
build_container
6978
description

0 commit comments

Comments
 (0)