relocate: rewrite the manager's crontab when a root moves

libreportal-relocate re-bakes the helpers, the systemd unit and the WebUI
compose, but never touched the manager's crontab — and the @reboot entry embeds
an absolute path under the SYSTEM dir:

    @reboot /libreportal-system/install/scripts/crontab/system/crontab_boot_app_reconcile.sh

Move that root and the path stops existing. The entry is redirected to
/dev/null, so nothing reports it; the only symptom is that apps quietly do not
come back after a reboot, which is easy to blame on anything else.

Rewrite it with the same old->new substitution already applied to the unit and
compose, keeping a copy in the relocation's backup dir first.

(A fresh install is unaffected — it generates the entry with the resolved
install_scripts_dir. Verified on a matrix case-4 install with all three roots on
test disks: the entry points at /mnt/lptest1/... and the target exists.)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
librelad 2026-08-28 06:38:07 +01:00
parent 7ed8539af7
commit 3518006205

View File

@ -235,6 +235,23 @@ if [[ -f "$COMPOSE" ]]; then
ok "WebUI compose bind-mounts"
fi
# ---- 4b. the manager's crontab ------------------------------------------------
# The @reboot boot-reconcile entry embeds an absolute path under the SYSTEM dir
# ("${install_scripts_dir}crontab/system/crontab_boot_app_reconcile.sh"). Move
# that root and the path stops existing — and the entry is redirected to
# /dev/null, so nothing reports it. The only symptom is that apps quietly do not
# come back after a reboot, which is easy to blame on anything else.
if crontab -u "$MANAGER" -l >/dev/null 2>&1; then
crontab -u "$MANAGER" -l > "$BACKUP_DIR/crontab.$MANAGER" 2>/dev/null
if sed -e "s#${CUR_SYSTEM}#${FIN_SYSTEM}#g" \
-e "s#${CUR_CONTAINERS}#${FIN_CONTAINERS}#g" \
"$BACKUP_DIR/crontab.$MANAGER" | crontab -u "$MANAGER" - 2>/dev/null; then
ok "manager crontab"
else
warn "could not rewrite ${MANAGER}'s crontab — check 'crontab -l -u $MANAGER'"
fi
fi
# ---- 5. ownership on the new trees -------------------------------------------
say "Reconciling ownership"
"$LIB_DIR/libreportal-ownership" reconcile >/dev/null 2>&1 && ok "ownership reconciled" \