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 )
CheckDeps() {
if [[ $1 == 0 ]]; then
if [[ $1 == 2 ]]; then
# Check getopt
! getopt --test > /dev/null
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
@ -67,7 +67,8 @@ CheckDeps() {
if [[ $1 == 1 ]]; then
# Check ffmpeg
if [[ $convert == true && ! $(ffmpeg -h 2>/dev/null) ]]; then
if [[ $convert == true ]]; then
if [[ ! $(ffmpeg -h 2>/dev/null) ]]; then
VerboseOutput 5 "\`ffmpeg -h\` failed"
VerboseOutput 5 "Sorry, It seems that ffmpeg is not installed on your system"
VerboseOutput 5 "Please install ffmpeg from your repositories and make sure it is available in your \$PATH"
@ -76,9 +77,11 @@ CheckDeps() {
exit 1
fi
VerboseOutput 0 "\`ffmpeg -h\` succeeded"
fi
# Check EyeD3
if [[ $convertart == true && ! $(eyeD3 --version 2>/dev/null) ]]; then
if [[ $convertart == true ]]; then
if [[ ! $(eyeD3 --version 2>/dev/null) ]]; then
VerboseOutput 5 "\`eyeD3 --version\` failed"
VerboseOutput 5 "Sorry, It seems that eyeD3 is not installed on your system"
VerboseOutput 5 "Please install eyeD3 from your repositories and make sure it is available in your \$PATH"
@ -87,9 +90,11 @@ CheckDeps() {
exit 1
fi
VerboseOutput 0 "\`eyeD3 --version\` succeeded"
fi
# Check ImageMagick
if [[ $convertart == true && ! $(convert --version 2>/dev/null) ]]; then
if [[ $convertart == true ]]; then
if [[ ! $(convert --version 2>/dev/null) ]]; then
VerboseOutput 5 "\`convert --version\` failed"
VerboseOutput 5 "Sorry, It seems that ImageMagick is not installed on your system"
VerboseOutput 5 "Please install ImageMagick from your repositories and make sure it is available in your \$PATH"
@ -98,9 +103,11 @@ CheckDeps() {
exit 1
fi
VerboseOutput 0 "\`convert --version\` succeeded"
fi
# Check Gnu parallel
if [[ $multithread == true && ! $(parallel -h 2>/dev/null) ]]; then
if [[ $multithread == true ]]; then
if [[ ! $(parallel -h 2>/dev/null) ]]; then
VerboseOutput 5 "\`parallel -h\` failed"
VerboseOutput 5 "Sorry, It seems that parallel is not installed on your system"
VerboseOutput 5 "Please install gnu-parallel and env_parallel from your repositories and make sure it is available in your \$PATH"
@ -110,6 +117,7 @@ CheckDeps() {
fi
VerboseOutput 0 "\`parallel -h \` succeeded"
fi
fi
VerboseOutput 1 "Dependency test OK"
}
@ -442,7 +450,7 @@ ExitHandler() {
trap 'ExitHandler' SIGINT
trap 'ErrorHandler $BASH_COMMAND' ERR
CheckDeps 0
CheckDeps 2
GetOptions $@
CheckDeps 1
if [[ $help == true ]]; then