diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-01-05 15:31:13 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-01-05 15:31:13 +0100 |
commit | c6beb7f5dfdfc222e211ad1b3b9755a4bf1f98d9 (patch) | |
tree | 7acfcb72a48acadda50e5f602c4728c82021f4f2 | |
parent | c2bee8d78e0a35b8fd252e1a4743dae59511622b (diff) | |
download | analog_instruments-c6beb7f5dfdfc222e211ad1b3b9755a4bf1f98d9.tar.gz |
system_usage.sh: check for command dependenciesdev
-rwxr-xr-x | system_usage.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/system_usage.sh b/system_usage.sh index d4d3124..e582d4d 100755 --- a/system_usage.sh +++ b/system_usage.sh @@ -1,10 +1,8 @@ #!/bin/bash -# # system_usage.sh # (c) 2022 Jonas Gunz <himself@jonasgunz.de> -# License: All rights reserved. -# +# License: MIT # USAGE: # ./system_usage.sh [TTY [BAUD]] @@ -18,6 +16,16 @@ readonly PWM_CPU=0 readonly PWM_RAM=1 readonly PWM_TMP=2 +readonly DEPENDENCIES=( stty nproc sensors ) +for dep in "${DEPENDENCIES[@]}"; do + if ! which "$dep" > /dev/null 2>&1; then + echo "Command '$dep' missing." + FAILED=1 + fi + + test -n "$FAILED" && exit 1 +done + echo "Trying to set $TTY to $BAUD" stty -F "$TTY" "$BAUD" -echo || exit 1 echo OK! |