Skip to content

Commit 3fd8f6e

Browse files
authored
Merge pull request #9 from taalojarvi/master
Add Dependency Checks in radio.sh
2 parents dbc37e5 + 593583b commit 3fd8f6e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

radio

100644100755
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ fi
2929

3030
trap "rm -f $fifo" INT TERM EXIT
3131

32+
check_dependencies() {
33+
for cmd in zenity mplayer; do
34+
if ! command -v "$cmd" &> /dev/null; then
35+
echo "$cmd is not installed."
36+
return 1
37+
fi
38+
done
39+
return 0
40+
}
41+
3242

3343
playradio() {
3444
auswahl=$(awk -F " " '{print $1"\n"$2}' $pfadsender | zenity --list --hide-column=1 --column "Nummer" --column "Sender" --title="Bashtuner" --ok-label="Abspielen" --cancel-label="Exit" --text="Radiosender einschalten" --width=600 --height=300)
@@ -60,4 +70,9 @@ done
6070
playradio
6171
fi
6272
}
73+
check_dependencies
74+
if [ $? -ne 0 ]; then
75+
echo "Please install the missing dependencies and try again."
76+
exit 1
77+
fi
6378
playradio

0 commit comments

Comments
 (0)