Fix two audit findings in install/uninstall hook management

- Extract hook comment string to _HOOK_COMMENT variable in both
  install.sh and uninstall.sh; previously the literal string
  'TrueCloud provider patch (S3/B2)' appeared three times across two
  files with no shared constant — a silent mismatch on any divergence
  would cause hook lookup to return empty with no error output
- Wrap midclt update and create calls with if/else error handlers;
  previously a midclt failure under set -euo pipefail silently aborted
  the script at "Updating path and enabling ..." with no diagnostic
  or recovery guidance
This commit is contained in:
2026-06-15 17:43:46 +00:00
parent 6a8ed7fa67
commit d97b87bc5d
2 changed files with 16 additions and 7 deletions
+2 -1
View File
@@ -4,6 +4,7 @@
set -euo pipefail
PATCH_DIR="$(cd "$(dirname "$0")" && pwd)"
_HOOK_COMMENT='TrueCloud provider patch (S3/B2)'
echo "=== TrueNAS TrueCloud Provider Patch — Uninstall ==="
echo ""
@@ -26,7 +27,7 @@ IDS=$(midclt call initshutdownscript.query '[]' | \
python3 -c "
import sys, json
for s in json.load(sys.stdin):
if s.get('comment') == 'TrueCloud provider patch (S3/B2)':
if s.get('comment') == '$_HOOK_COMMENT':
print(s['id'])
" 2>/dev/null || true)