Fixed Formating

This commit is contained in:
Michel Roegl-Brunner 2024-12-16 13:58:10 +01:00
parent 5669616afc
commit 93a80a04b1

View File

@ -25,46 +25,49 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/bookstack ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/bookstack ]]; then
RELEASE=$(curl -s https://api.github.com/repos/BookStackApp/BookStack/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') msg_error "No ${APP} Installation Found!"
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then exit
msg_info "Stopping Apache2" fi
systemctl stop apache2 RELEASE=$(curl -s https://api.github.com/repos/BookStackApp/BookStack/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
msg_ok "Services Stopped" if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to v${RELEASE}" msg_info "Stopping Apache2"
mv /opt/bookstack /opt/bookstack-backup systemctl stop apache2
wget -q --directory-prefix=/root/ "https://github.com/BookStackApp/BookStack/archive/refs/tags/v${RELEASE}.zip" msg_ok "Services Stopped"
unzip -q ~/v${RELEASE}.zip msg_info "Updating ${APP} to v${RELEASE}"
mv ~/BookStack-${RELEASE} /opt/bookstack mv /opt/bookstack /opt/bookstack-backup
cp /opt/bookstack-backup/.env /opt/bookstack/.env wget -q --directory-prefix=/root/ "https://github.com/BookStackApp/BookStack/archive/refs/tags/v${RELEASE}.zip"
cp -r /opt/bookstack-backup/public/uploads/ /opt/bookstack/public/uploads unzip -q ~/v${RELEASE}.zip
cp -r /opt/bookstack-backup/storage/uploads/ /opt/bookstack/storage/uploads mv ~/BookStack-${RELEASE} /opt/bookstack
cp -r /opt/bookstack-backup/themes/ /opt/bookstack/themes cp /opt/bookstack-backup/.env /opt/bookstack/.env
cd /opt/bookstack cp -r /opt/bookstack-backup/public/uploads/ /opt/bookstack/public/uploads
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev &>/dev/null cp -r /opt/bookstack-backup/storage/uploads/ /opt/bookstack/storage/uploads
php artisan key:generate --force &>/dev/null cp -r /opt/bookstack-backup/themes/ /opt/bookstack/themes
php artisan migrate --force &>/dev/null cd /opt/bookstack
chown www-data:www-data -R /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev &>/dev/null
chmod -R 755 /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage php artisan key:generate --force &>/dev/null
chmod -R 775 /opt/bookstack/storage /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads php artisan migrate --force &>/dev/null
chmod -R 640 /opt/bookstack/.env chown www-data:www-data -R /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage
echo "${RELEASE}" >/opt/${APP}_version.txt chmod -R 755 /opt/bookstack /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads /opt/bookstack/storage
msg_ok "Updated ${APP}" chmod -R 775 /opt/bookstack/storage /opt/bookstack/bootstrap/cache /opt/bookstack/public/uploads
msg_info "Starting Apache2 " chmod -R 640 /opt/bookstack/.env
systemctl start apache2 echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Started Apache2" msg_ok "Updated ${APP}"
msg_info "Cleaning Up" msg_info "Starting Apache2 "
rm -rf /opt/bookstack-backup systemctl start apache2
rm -rf ~/v${RELEASE}.zip msg_ok "Started Apache2"
msg_ok "Cleaned" msg_info "Cleaning Up"
msg_ok "Updated Successfully" rm -rf /opt/bookstack-backup
else rm -rf ~/v${RELEASE}.zip
msg_ok "No update required. ${APP} is already at v${RELEASE}" msg_ok "Cleaned"
fi msg_ok "Updated Successfully"
exit else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit
} }
start start
build_container build_container