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
This commit is contained in:
CanbiZ (MickLesk)
2026-04-23 12:23:56 +02:00
parent aa54abcf50
commit bfe25ea8ee

View File

@@ -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"