@@ -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+
6776start
6877build_container
6978description
0 commit comments