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 verbose=2
help=false help=false
GetOptions() { CheckDeps() {
# Check getopt
# https://stackoverflow.com/a/29754866
! getopt --test > /dev/null ! getopt --test > /dev/null
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
VerboseOutput 5 "\`getopt --test\` failed" VerboseOutput 5 "\`getopt --test\` failed"
@ -19,7 +18,20 @@ GetOptions() {
ExecTime ExecTime
exit 1 exit 1
fi 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 # Parsing style without -s or -d
source=${*: -2:1} source=${*: -2:1}
dest=${*: -1:1} dest=${*: -1:1}
@ -221,6 +233,7 @@ ExecTime() {
VerboseOutput 1 "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed for Script Execution." VerboseOutput 1 "$(($difftimelps / 60)) minutes and $(($difftimelps % 60)) seconds elapsed for Script Execution."
} }
CheckDeps
GetOptions $@ GetOptions $@
if [[ $help == true ]]; then if [[ $help == true ]]; then
Usage Usage