check some depencies

This commit is contained in:
Martin Selbmann 2020-09-24 21:52:14 +02:00
parent 1d042ff9df
commit b7cc8591b5
2 changed files with 29 additions and 8 deletions

View File

@ -1,24 +1,35 @@
#!/bin/sh
# SPDX-License-Identifier: Unlicense
cmdjq="$(command -v jq)"
configfile="config.json"
cmdjq="$(command -v jq)"
if [ -z "$cmdjq" ]; then
echo "Missing \"jq\"!"
exit 1
fi
configfile="config.json"
cmdgpio="$(command -v gpio)"
if [ -z "$cmdgpio" ]; then
echo "Missing \"gpio\"!"
echo "This is a part of WiringPi-Package."
exit 1
fi
player="$($cmdjq -r ".player" < $configfile)"
if [ -z "$(command -v $player)" ]; then
echo "Missing \"$player\"!"
exit 1
fi
folder="$($cmdjq -r ".RandomVideo | .folder" < $configfile)"
player="$($cmdjq -r ".player" < $configfile)"
playerparam="$($cmdjq -r ".playerparam" < $configfile)"
pgrepplayer="$($cmdjq -r ".pgrepplayer" < $configfile)"
swupgpio="$($cmdjq -r ".swupgpio" < $configfile)"
playerfull="$(command -v $player) $playerparam"
swupstat="$($(command -v gpio) read $swupgpio)"
swupstat="$($cmdgpio read $swupgpio)"
if [ $# -eq 0 ]; then
echo "Parameter fehlt"

View File

@ -1,21 +1,32 @@
#!/bin/sh
# SPDX-License-Identifier: Unlicense
cmdjq="$(command -v jq)"
configfile="config.json"
cmdjq="$(command -v jq)"
if [ -z "$cmdjq" ]; then
echo "Missing \"jq\"!"
exit 1
fi
configfile="config.json"
cmdgpio="$(command -v gpio)"
if [ -z "$cmdgpio" ]; then
echo "Missing \"gpio\"!"
echo "This is a part of WiringPi-Package."
exit 1
fi
player="$($cmdjq -r ".player" < $configfile)"
if [ -z "$(command -v $player)" ]; then
echo "Missing \"$player\"!"
exit 1
fi
buzzergpio="$($cmdjq -r ".buzzer | .buzzergpio" < $configfile)"
strobegpio="$($cmdjq -r ".buzzer | .strobegpio" < $configfile)"
swupgpio="$($cmdjq -r ".swupgpio" < $configfile)"
swdowngpio="$($cmdjq -r ".buzzer | .swdowngpio" < $configfile)"
player="$($cmdjq -r ".player" < $configfile)"
playerparam="$($cmdjq -r ".playerparam" < $configfile)"
playerloop="$($cmdjq -r ".buzzer | .playerloop" < $configfile)"
@ -30,7 +41,6 @@ volumedelay="$($cmdjq -r ".buzzer | .volumedelay" < $configfile)"
volumemax="$($cmdjq -r ".buzzer | .volumemax" < $configfile)"
playerfull="$(command -v $player) $playerparam"
cmdgpio="$(command -v gpio)"
cmdamixer="$(command -v amixer)"
$cmdgpio mode $buzzergpio in