Added more dependency checks

This commit is contained in:
Jeroen De Meerleer 2018-11-30 17:50:37 +01:00
parent 5c7c754dc3
commit ead372dd65

View File

@ -8,9 +8,8 @@ dest="-"
verbose=2
help=false
GetOptions() {
# https://stackoverflow.com/a/29754866
CheckDeps() {
# Check getopt
! getopt --test > /dev/null
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
VerboseOutput 5 "\`getopt --test\` failed"
@ -20,6 +19,19 @@ GetOptions() {
exit 1
fi
# Check lame
if [[ ! $(lame --version 2>/dev/null) ]]; then
VerboseOutput 5 "\`lame --version\` failed"
VerboseOutput 5 "Sorry, It seems that lame is not installed on your system"
VerboseOutput 5 "Please install lame from your repositories and make sure it is available in your \$PATH"
ExecTime
exit 1
fi
}
GetOptions() {
# https://stackoverflow.com/a/29754866
# Parsing style without -s or -d
source=${*: -2:1}
dest=${*: -1:1}
@ -221,6 +233,7 @@ ExecTime() {
VerboseOutput 1 "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed for Script Execution."
}
CheckDeps
GetOptions $@
if [[ $help == true ]]; then
Usage