summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsystem_usage.sh14
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!