Fix three findings from final clean-pass audit

- apply.sh: gate sitecustomize.py install on backup success; a failed
  backup cp (disk full, read-only mount) previously fell through and
  overwrote the vendor file with no recovery path
- create_task.py: handle unexpected 2xx response schema in cmd_create;
  bare KeyError on result['id'] is replaced with a diagnostic print
- uninstall.sh: mv inside while loop had no error handling; under
  set -euo pipefail a failed mv aborted the script before rm -rf PATCH_DIR,
  leaving the system in partial-uninstall limbo
This commit is contained in:
2026-06-15 16:10:09 +00:00
parent 8f64e4964c
commit 9481bf55f0
3 changed files with 24 additions and 11 deletions
+6 -3
View File
@@ -104,9 +104,12 @@ echo "Restoring UI bundle backup ..."
RESTORED=0
while IFS= read -r backup; do
original="${backup%.pre-truecloud-patch}"
mv "$backup" "$original"
echo " Restored: $original"
RESTORED=1
if mv "$backup" "$original"; then
echo " Restored: $original"
RESTORED=1
else
echo " WARNING: Could not restore $original — backup left at $backup"
fi
# Keep these paths in sync with WEBUI_CANDIDATES in patch/patch_ui.py
done < <(find /usr/share/truenas /usr/share/truenas-ui /var/www/truenas \
-name "*.js.pre-truecloud-patch" 2>/dev/null)