Files
moonarch/defaults/bin/moonarch-camera-toggle
T
nevaforget d476c7875a
Update PKGBUILD version / update-pkgver (push) Successful in 5s
fix(camera): stop hardcoding /usr/bin in the camera scripts
2026-09-23 17:28:34 +02:00

18 lines
469 B
Bash
Executable File

#!/bin/sh
# ABOUTME: Switches one camera on or off; dispatches the privileged sysfs write via pkexec.
# ABOUTME: Usage: moonarch-camera-toggle <usb-id> <0|1>. Exit code is pkexec's (126 = prompt cancelled).
ID="${1:-}"
VAL="${2:-}"
# Shape check only — moonarch-camera-apply re-validates everything as the privileged side.
case "$ID" in
""|*[!0-9.-]*) exit 1 ;;
esac
case "$VAL" in
0 | 1) ;;
*) exit 1 ;;
esac
pkexec moonarch-camera-apply "$ID" "$VAL"