Fix two confirmed findings from full codebase audit

- patch_ui.py: wrap shutil.copy2 backup in try/except OSError so a
  permission or read-only filesystem error prints a specific diagnostic
  instead of crashing the script with a generic 'exited non-zero' message
- install.sh: add early guard that detects pipe-install (bash <(curl ...))
  and exits with a clear error pointing to the git clone workflow
This commit is contained in:
2026-06-15 16:03:19 +00:00
parent 2a3b15b4b2
commit 7c9aa7159a
2 changed files with 13 additions and 1 deletions
+8
View File
@@ -15,6 +15,14 @@ set -euo pipefail
PATCH_DIR="/data/truecloud-patch"
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ ! -f "$REPO_DIR/patch/sitecustomize.py" ]; then
echo "ERROR: patch files not found at $REPO_DIR/patch/" >&2
echo "Run install.sh from the cloned repository, not via pipe:" >&2
echo " git clone https://github.com/sudolulo/truenas-truecloud-patch" >&2
echo " cd truenas-truecloud-patch && bash install.sh" >&2
exit 1
fi
echo "=== TrueNAS TrueCloud Provider Patch — Install ==="
echo ""