From bfe25ea8ee440f84cfc2cf96512dd94cf3a79c1c Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:23:56 +0200 Subject: [PATCH] fix(mealie): restore start.sh before build steps to prevent broken container When CLEAN_INSTALL=1 wipes /opt/mealie/* and a subsequent build step fails (uv sync, yarn install, yarn generate - e.g. due to OOM or network error), start.sh was never written because it was created at the very end of the update function. On the next reboot systemd could not find the ExecStart binary and the container was left in a permanently broken state. Fix: move mealie.env restore and start.sh creation to immediately after fetch_and_deploy_gh_release, before any build steps that can fail. This ensures the service entry point is always present even if the build is interrupted, allowing uv to self-heal on next startup. Fixes: #13945 --- ct/mealie.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ct/mealie.sh b/ct/mealie.sh index fb51f0471..8cd1c9198 100644 --- a/ct/mealie.sh +++ b/ct/mealie.sh @@ -42,6 +42,18 @@ function update_script() { CLEAN_INSTALL=1 fetch_and_deploy_gh_release "mealie" "mealie-recipes/mealie" "tarball" + msg_info "Restoring Configuration" + mv -f /opt/mealie.env /opt/mealie/mealie.env + cat <<'STARTEOF' >/opt/mealie/start.sh +#!/bin/bash +set -a +source /opt/mealie/mealie.env +set +a +exec uv run mealie +STARTEOF + chmod +x /opt/mealie/start.sh + msg_ok "Configuration restored" + msg_info "Installing Python Dependencies with uv" cd /opt/mealie $STD uv sync --frozen --extra pgsql @@ -70,18 +82,6 @@ function update_script() { $STD uv run python -m nltk.downloader -d /nltk_data averaged_perceptron_tagger_eng msg_ok "Updated NLTK Data" - msg_info "Restoring Configuration" - mv -f /opt/mealie.env /opt/mealie/mealie.env - cat <<'STARTEOF' >/opt/mealie/start.sh -#!/bin/bash -set -a -source /opt/mealie/mealie.env -set +a -exec uv run mealie -STARTEOF - chmod +x /opt/mealie/start.sh - msg_ok "Configuration restored" - msg_info "Starting Service" systemctl start mealie msg_ok "Started Service"