22 lines
1 KiB
Bash
Executable file
22 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
name="${0##*/}"
|
|
printf '%s %s\n' "$name" "$*" >> /tmp/calls
|
|
[[ "${FAIL:-}" != "$name" ]] || exit 47
|
|
case "$name" in
|
|
sudo) [[ "$*" == '-n btrfs filesystem usage /' ]] || exit 90; printf 'fixture btrfs\n' ;;
|
|
systemctl)
|
|
if [[ "$*" == *'is-enabled'* ]]; then
|
|
[[ "${FAIL:-}" != service ]] || exit 47
|
|
printf 'disabled\n'; exit 1
|
|
elif [[ "$*" == *'is-active'* ]]; then
|
|
[[ "${FAIL:-}" != service ]] || exit 47
|
|
printf 'inactive\n'; exit 3
|
|
else printf 'fixture no failed units\n'; fi ;;
|
|
pgrep) [[ "$*" == '-a -f nextcloud|thunderbird|protonmail-bridge|/protonmail/bridge|proton-pass|ollama|llama-server' ]] || exit 90
|
|
[[ "${FAIL:-}" != pgrep_error ]] || exit 2
|
|
exit 1 ;;
|
|
cat) case "$1" in /proc/pressure/*) printf 'fixture pressure\n';; /sys/class/power_supply/*) printf '60\n';; *) exit 90;; esac ;;
|
|
uptime|free|swapon|df|ps|systemd-analyze) printf 'fixture %s\n' "$name" ;;
|
|
*) exit 90 ;;
|
|
esac
|