From 6e55269d9fdab34fc774839e93903b383816e79b Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Wed, 8 Jul 2026 13:04:13 +0200 Subject: [PATCH] BabyBuddy: Harden update script (#15642) Ensure cleanup runs from `/opt/babybuddy` before deleting old files, add `--` to the removal command for safer argument handling, and run `manage.py makemigrations` before `migrate` so database updates are applied reliably during upgrades. --- ct/babybuddy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ct/babybuddy.sh b/ct/babybuddy.sh index 29fc7703a..b718a42ef 100644 --- a/ct/babybuddy.sh +++ b/ct/babybuddy.sh @@ -40,7 +40,8 @@ function update_script() { create_backup /opt/babybuddy/babybuddy/settings/production.py msg_info "Cleaning old files" - find . -mindepth 1 -maxdepth 1 ! -name '.venv' -exec rm -rf {} + + cd /opt/babybuddy || exit + find . -mindepth 1 -maxdepth 1 ! -name '.venv' -exec rm -rf -- {} + msg_ok "Cleaned old files" fetch_and_deploy_gh_release "babybuddy" "babybuddy/babybuddy" "tarball" @@ -51,6 +52,7 @@ function update_script() { source .venv/bin/activate $STD uv pip install -r requirements.txt export DJANGO_SETTINGS_MODULE=babybuddy.settings.production + $STD python manage.py makemigrations $STD python manage.py migrate msg_ok "Updated ${APP}"