Repo is the install location; all scripts self-locate

Users now clone to a persistent ZFS pool and the repo stays in place.
No files are copied on install — the PREINIT hook points directly into
the clone. Scripts derive PATCH_DIR from their own path at runtime.

- install.sh: PATCH_DIR=$(dirname $0); register patch/apply.sh as
  PREINIT target; chmod only, no cp; update pipe-install error message
- patch/apply.sh: PATCH_DIR=$(dirname $0)/..; substitute PATCH_DIR
  into sitecustomize.py via sed when writing to site-packages;
  reference patch_ui.py as patch/patch_ui.py
- recover.sh, uninstall.sh: PATCH_DIR=$(dirname $0)
- uninstall.sh: look for patch/apply.sh in PREINIT registry
- patch/create_task.py: _PATCH_DIR derived from __file__; apply.log
  path in error message derived from _PATCH_DIR
- patch/sitecustomize.py: /data/truecloud-patch remains as placeholder
  substituted by apply.sh on each install
- .gitignore: exclude runtime files (apply.log, hook_status.json, disabled)
- README: document clone-to-pool install; update all example paths
This commit is contained in:
2026-06-15 17:07:11 +00:00
parent 4c79403491
commit 70e84038d6
7 changed files with 94 additions and 76 deletions
+7 -7
View File
@@ -3,19 +3,19 @@
#
# Run this from the TrueNAS shell (local console, SSH, or debug shell):
#
# bash /data/truecloud-patch/recover.sh
# bash /mnt/tank/truenas-truecloud-patch/recover.sh
#
# What it does:
# 1. Creates /data/truecloud-patch/disabled — sitecustomize.py checks for this
# file at startup and skips the import hook entirely, so middlewared starts
# clean without any of our code running.
# 1. Creates a "disabled" file in the repo root — sitecustomize.py checks for
# this file at startup and skips the import hook entirely, so middlewared
# starts clean without any of our code running.
# 2. Restarts middlewared.
#
# To re-enable the patch after investigating:
# rm /data/truecloud-patch/disabled
# bash /data/truecloud-patch/apply.sh
# rm /mnt/tank/truenas-truecloud-patch/disabled
# bash /mnt/tank/truenas-truecloud-patch/patch/apply.sh
PATCH_DIR="/data/truecloud-patch"
PATCH_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: must be run as root." >&2