Don't say you checked deps when you don't need them

I will not lie
This commit is contained in:
Jeroen De Meerleer 2020-02-12 18:54:28 +01:00
parent 53a732dd29
commit 2f39dc88e4

View File

@ -52,7 +52,7 @@ script_name=$(basename "${0}")
script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
CheckDeps() { CheckDeps() {
if [[ $1 == 0 ]]; then if [[ $1 == 2 ]]; then
# Check getopt # Check getopt
! getopt --test > /dev/null ! getopt --test > /dev/null
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
@ -67,48 +67,56 @@ CheckDeps() {
if [[ $1 == 1 ]]; then if [[ $1 == 1 ]]; then
# Check ffmpeg # Check ffmpeg
if [[ $convert == true && ! $(ffmpeg -h 2>/dev/null) ]]; then if [[ $convert == true ]]; then
VerboseOutput 5 "\`ffmpeg -h\` failed" if [[ ! $(ffmpeg -h 2>/dev/null) ]]; then
VerboseOutput 5 "Sorry, It seems that ffmpeg is not installed on your system" VerboseOutput 5 "\`ffmpeg -h\` failed"
VerboseOutput 5 "Please install ffmpeg from your repositories and make sure it is available in your \$PATH" VerboseOutput 5 "Sorry, It seems that ffmpeg is not installed on your system"
VerboseOutput 5 "Otherwise disable conversion" VerboseOutput 5 "Please install ffmpeg from your repositories and make sure it is available in your \$PATH"
ExecTime VerboseOutput 5 "Otherwise disable conversion"
exit 1 ExecTime
exit 1
fi
VerboseOutput 0 "\`ffmpeg -h\` succeeded"
fi fi
VerboseOutput 0 "\`ffmpeg -h\` succeeded"
# Check EyeD3 # Check EyeD3
if [[ $convertart == true && ! $(eyeD3 --version 2>/dev/null) ]]; then if [[ $convertart == true ]]; then
VerboseOutput 5 "\`eyeD3 --version\` failed" if [[ ! $(eyeD3 --version 2>/dev/null) ]]; then
VerboseOutput 5 "Sorry, It seems that eyeD3 is not installed on your system" VerboseOutput 5 "\`eyeD3 --version\` failed"
VerboseOutput 5 "Please install eyeD3 from your repositories and make sure it is available in your \$PATH" VerboseOutput 5 "Sorry, It seems that eyeD3 is not installed on your system"
VerboseOutput 5 "Otherwise disable albumart conversion" VerboseOutput 5 "Please install eyeD3 from your repositories and make sure it is available in your \$PATH"
ExecTime VerboseOutput 5 "Otherwise disable albumart conversion"
exit 1 ExecTime
exit 1
fi
VerboseOutput 0 "\`eyeD3 --version\` succeeded"
fi fi
VerboseOutput 0 "\`eyeD3 --version\` succeeded"
# Check ImageMagick # Check ImageMagick
if [[ $convertart == true && ! $(convert --version 2>/dev/null) ]]; then if [[ $convertart == true ]]; then
VerboseOutput 5 "\`convert --version\` failed" if [[ ! $(convert --version 2>/dev/null) ]]; then
VerboseOutput 5 "Sorry, It seems that ImageMagick is not installed on your system" VerboseOutput 5 "\`convert --version\` failed"
VerboseOutput 5 "Please install ImageMagick from your repositories and make sure it is available in your \$PATH" VerboseOutput 5 "Sorry, It seems that ImageMagick is not installed on your system"
VerboseOutput 5 "Otherwise disable albumart conversion" VerboseOutput 5 "Please install ImageMagick from your repositories and make sure it is available in your \$PATH"
ExecTime VerboseOutput 5 "Otherwise disable albumart conversion"
exit 1 ExecTime
exit 1
fi
VerboseOutput 0 "\`convert --version\` succeeded"
fi fi
VerboseOutput 0 "\`convert --version\` succeeded"
# Check Gnu parallel # Check Gnu parallel
if [[ $multithread == true && ! $(parallel -h 2>/dev/null) ]]; then if [[ $multithread == true ]]; then
VerboseOutput 5 "\`parallel -h\` failed" if [[ ! $(parallel -h 2>/dev/null) ]]; then
VerboseOutput 5 "Sorry, It seems that parallel is not installed on your system" VerboseOutput 5 "\`parallel -h\` failed"
VerboseOutput 5 "Please install gnu-parallel and env_parallel from your repositories and make sure it is available in your \$PATH" VerboseOutput 5 "Sorry, It seems that parallel is not installed on your system"
VerboseOutput 5 "Otherwise disable multithreading" VerboseOutput 5 "Please install gnu-parallel and env_parallel from your repositories and make sure it is available in your \$PATH"
ExecTime VerboseOutput 5 "Otherwise disable multithreading"
exit 1 ExecTime
exit 1
fi
VerboseOutput 0 "\`parallel -h \` succeeded"
fi fi
VerboseOutput 0 "\`parallel -h \` succeeded"
fi fi
VerboseOutput 1 "Dependency test OK" VerboseOutput 1 "Dependency test OK"
} }
@ -442,7 +450,7 @@ ExitHandler() {
trap 'ExitHandler' SIGINT trap 'ExitHandler' SIGINT
trap 'ErrorHandler $BASH_COMMAND' ERR trap 'ErrorHandler $BASH_COMMAND' ERR
CheckDeps 0 CheckDeps 2
GetOptions $@ GetOptions $@
CheckDeps 1 CheckDeps 1
if [[ $help == true ]]; then if [[ $help == true ]]; then