Fix four audit findings; simplify apply.sh boolean gate
- uninstall.sh: track _restore_failed separately from RESTORED so "No backup files found" only prints when find returns nothing (not when mv fails on existing backups); abort with exit 1 before rm -rf when any restore fails, leaving PATCH_DIR and recover.sh intact - install.sh: extend log-scan grep to catch ERROR: lines from patch_ui.py (backup OSError was silently missed by WARNING:-only grep) - install.sh: reword restart-failure message — hook IS already registered and sitecustomize.py IS installed; patch activates on next boot regardless - apply.sh: replace `if $_can_install` with `[ "$_can_install" = true ]` (explicit test, no implicit command lookup); drop 2>/dev/null on install cp so OS error detail reaches the log
This commit is contained in:
+5
-3
@@ -98,7 +98,7 @@ echo ""
|
||||
echo "Patch log ($PATCH_DIR/apply.log):"
|
||||
tail -30 "$PATCH_DIR/apply.log"
|
||||
echo ""
|
||||
if tail -c "+$((_log_start + 1))" "$PATCH_DIR/apply.log" 2>/dev/null | grep -q "WARNING:"; then
|
||||
if tail -c "+$((_log_start + 1))" "$PATCH_DIR/apply.log" 2>/dev/null | grep -qE "WARNING:|ERROR:"; then
|
||||
echo "WARNING: apply.sh reported one or more issues — see log above for details."
|
||||
echo ""
|
||||
fi
|
||||
@@ -108,8 +108,10 @@ fi
|
||||
echo "Restarting middlewared so the backend patch takes effect ..."
|
||||
if ! systemctl restart middlewared; then
|
||||
echo "" >&2
|
||||
echo "ERROR: middlewared failed to restart. The patch files are installed but" >&2
|
||||
echo "the hook is not yet active. Check the system log for the root cause:" >&2
|
||||
echo "ERROR: middlewared failed to restart." >&2
|
||||
echo " The patch IS installed and will activate automatically on the next boot." >&2
|
||||
echo " To activate now, resolve the issue below and run: systemctl restart middlewared" >&2
|
||||
echo " Check the system log for the root cause:" >&2
|
||||
echo " journalctl -u middlewared -n 50" >&2
|
||||
echo "If the problem is unrelated to this patch, recover with:" >&2
|
||||
echo " bash $PATCH_DIR/recover.sh" >&2
|
||||
|
||||
Reference in New Issue
Block a user