Fix backend patch never loading at boot: schedule deferred middlewared restart
PREINIT initshutdownscripts are executed by middlewared itself (ix-preinit.service, ordered after ix-zfs pool import), so the running process had already imported the stock modules when apply.sh patched them in the overlay — S3/B2 support silently reverted on every reboot until something restarted middlewared. install.sh masked the bug with its explicit restart. apply.sh now detects boot context (parent process is middlewared) and schedules a single detached restart via a transient systemd unit (truecloud-mw-restart, After=multi-user.target and ix-postinit.service). Manual runs never trigger a restart. create_task.py verify no longer trusts hook_status.json alone: it compares the middlewared main-process start time (derived from /proc/<pid>/stat and btime) against patched_at and reports FAIL when the running process predates the patch. recover.sh and uninstall.sh cancel a still-queued deferred restart before their own; docs updated to match the real boot ordering.
This commit is contained in:
+4
-2
@@ -10,13 +10,15 @@
|
||||
#
|
||||
# What this does:
|
||||
# 1. Registers a PREINIT initshutdownscript so patch/apply.sh re-runs on
|
||||
# every boot before middlewared starts.
|
||||
# every boot. At boot, apply.sh re-patches the overlay and schedules a
|
||||
# one-time deferred middlewared restart to load the patched modules
|
||||
# (PREINIT runs after middlewared starts, so a restart is required).
|
||||
# 2. Applies the patches immediately (no reboot required).
|
||||
# 3. Restarts middlewared so the backend change takes effect now.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="0.0.3"
|
||||
VERSION="0.0.4"
|
||||
|
||||
# The directory containing install.sh is the permanent install location.
|
||||
PATCH_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
Reference in New Issue
Block a user