Files
omarchycn/bin/omarchy-dev-install-ydoo
b85ae70ebd Stop pipefail from turning grep -q SIGPIPE exits into false negatives (#6614)
* Stop pipefail from turning grep -q SIGPIPE exits into false negatives

grep -q exits at the first match, and when the producer is still writing
it dies with SIGPIPE. Under pipefail that 141 becomes the pipeline's
status, so hardware checks like lspci | grep -q read as "not found" on
exactly the machines they target. The T2 defaults migration hit this and
silently skipped real T2 Macs (#6608).

Redirect grep to /dev/null instead of -q wherever a pipeline feeds grep
in a pipefail context, so grep reads all input and the producer never
gets killed. The install-time T2 checks aren't run under pipefail today
but are switched too, since they're the same detection line the issue
calls out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Re-run the T2 defaults migration its broken hardware check skipped

The SIGPIPE bug marked 1785944594 as applied without doing anything on
affected T2 Macs. The original migration is idempotent, so a fresh
migration can just source it now that the guard is fixed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Address Copilot review: fix OCR grep pipeline and prove the T2 repair

screen_contains piped tesseract into grep -Fqi under the acceptance
suite's pipefail, the same SIGPIPE false negative the rest of the branch
fixes. The T2 test's lspci stub now keeps writing past the pipe buffer
after the match so every scenario exercises the SIGPIPE case, and a new
case runs the rerun migration against fixtures a bitten install would
have.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 23:43:49 +02:00

51 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Install and enable ydotool mouse automation for Omarchy development
# omarchy:requires-sudo=true
set -euo pipefail
RULE_FILE="/etc/udev/rules.d/80-uinput.rules"
if ! getent group input >/dev/null; then
echo "omarchy-dev-install-ydoo: input group does not exist" >&2
exit 1
fi
if ! id -nG "$USER" | tr ' ' '\n' | grep -x input >/dev/null; then
echo "Adding $USER to the input group. You may need to log out and back in before this applies."
pkexec usermod -aG input "$USER"
fi
if omarchy-cmd-missing ydotool || omarchy-pkg-missing ydotool; then
omarchy-pkg-add ydotool
fi
pkexec /bin/bash -c '
set -euo pipefail
cat >"'"$RULE_FILE"'" <<'"'"'EOF'"'"'
KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
EOF
modprobe uinput
udevadm control --reload-rules
udevadm trigger /dev/uinput 2>/dev/null || true
if [[ -e /dev/uinput ]]; then
chgrp input /dev/uinput
chmod 0660 /dev/uinput
fi
'
systemctl --user reset-failed ydotool.service >/dev/null 2>&1 || true
systemctl --user start ydotool.service
if ! systemctl --user is-active --quiet ydotool.service; then
echo "omarchy-dev-install-ydoo: ydotool.service did not start" >&2
systemctl --user status ydotool.service --no-pager >&2 || true
exit 1
fi
echo "ydotool is ready."