Compare commits

...

3 Commits

Author SHA1 Message Date
CanbiZ (MickLesk)
4f68f18961 fix(mealie): fallback heredoc if start.sh missing before backup 2026-04-23 12:26:31 +02:00
CanbiZ (MickLesk)
a6fb551ee5 fix(mealie): backup and restore start.sh alongside mealie.env
Instead of recreating start.sh from a heredoc after CLEAN_INSTALL wipes
/opt/mealie/*, simply back it up before the wipe and restore it together
with mealie.env. Simpler and avoids any drift between the hardcoded
heredoc and what was actually installed.
2026-04-23 12:25:07 +02:00
CanbiZ (MickLesk)
bfe25ea8ee 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
2026-04-23 12:23:56 +02:00

View File

@@ -38,10 +38,27 @@ function update_script() {
msg_info "Backing up Configuration"
cp -f /opt/mealie/mealie.env /opt/mealie.env
[[ -f /opt/mealie/start.sh ]] && cp -f /opt/mealie/start.sh /opt/mealie.start.sh
msg_ok "Backup completed"
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
if [[ -f /opt/mealie.start.sh ]]; then
mv -f /opt/mealie.start.sh /opt/mealie/start.sh
else
cat <<'STARTEOF' >/opt/mealie/start.sh
#!/bin/bash
set -a
source /opt/mealie/mealie.env
set +a
exec uv run mealie
STARTEOF
fi
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 +87,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"