From c9af167626c5221f1dc0853e7a65d09c07b17007 Mon Sep 17 00:00:00 2001 From: q3aql Date: Mon, 13 Feb 2023 19:27:56 +0100 Subject: [PATCH] Add function to check all dependencies --- src/ks-avi | 33 +++++++++++++++++++++++++++------ src/ks-crop | 33 +++++++++++++++++++++++++++------ src/ks-mix | 33 +++++++++++++++++++++++++++------ src/ks-mp3 | 33 +++++++++++++++++++++++++++------ src/ks-mp3-album | 29 +++++++++++++++++++++++++---- src/ks-mp4 | 33 +++++++++++++++++++++++++++------ src/ks-mp4k | 33 +++++++++++++++++++++++++++------ src/ks-mp4s | 33 +++++++++++++++++++++++++++------ src/ks-mp4s-folder | 33 +++++++++++++++++++++++++++++++++ src/ks-oga | 33 +++++++++++++++++++++++++++------ src/ks-oga-album | 29 +++++++++++++++++++++++++---- src/ks-upa | 6 +++--- src/ks-upf | 6 +++--- src/ks-upr | 6 +++--- src/ks-upv | 6 +++--- src/ks-vob | 29 +++++++++++++++++++++++++---- 16 files changed, 336 insertions(+), 72 deletions(-) diff --git a/src/ks-avi b/src/ks-avi index cc0c8d0..1ff3112 100755 --- a/src/ks-avi +++ b/src/ks-avi @@ -2,12 +2,12 @@ ############################################################### # ks-avi (ks-tools) - Convert video to AVI format # -# Date: 10-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="100223" +M_DATE="130223" # Detect version ffmpeg for old releases ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) @@ -107,13 +107,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-avi (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-crop b/src/ks-crop index 42c68e9..b835463 100755 --- a/src/ks-crop +++ b/src/ks-crop @@ -2,12 +2,12 @@ ############################################################### # ks-crop (ks-tools) - Crop or change aspect ratio of a video # -# Date: 10-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="100223" +M_DATE="130223" # Detect version ffmpeg for old releases ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) @@ -54,13 +54,34 @@ if [ -f "/usr/bin/cygwin-alias.sh" ] ; then fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-crop (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mix b/src/ks-mix index 2b70fab..75453f1 100755 --- a/src/ks-mix +++ b/src/ks-mix @@ -2,12 +2,12 @@ ##################################################################### # ks-mix (ks-tools) - Extract video/audio and mix video/audio files # -# Date: 10-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ##################################################################### VERSION="8.4-dev" -M_DATE="100223" +M_DATE="130223" # Detect version ffmpeg for old releases ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) @@ -43,13 +43,34 @@ if [ -f "/usr/bin/cygwin-alias.sh" ] ; then fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed cut head tail tr" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-mix (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mp3 b/src/ks-mp3 index 31b8659..6803067 100755 --- a/src/ks-mp3 +++ b/src/ks-mp3 @@ -2,12 +2,12 @@ ######################################################################### # ks-mp3 (ks-tools) - Convert video/audio file(s) to MP3 (Audio) Format # -# Date: 04-02-2022 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ######################################################################### VERSION="8.4-dev" -M_DATE="040222" +M_DATE="130223" # Global parameters dirTemp="/tmp" @@ -59,13 +59,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-mp3 (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mp3-album b/src/ks-mp3-album index fca9b29..4f4f536 100755 --- a/src/ks-mp3-album +++ b/src/ks-mp3-album @@ -66,13 +66,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep find grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-mp3-album (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mp4 b/src/ks-mp4 index 4253bc3..12dfe55 100755 --- a/src/ks-mp4 +++ b/src/ks-mp4 @@ -2,12 +2,12 @@ ############################################################### # ks-mp4 (ks-tools) - Convert video to MP4 format # -# Date: 10-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="100223" +M_DATE="130223" # Detect version ffmpeg for old releases ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) @@ -107,13 +107,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-mp4 (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mp4k b/src/ks-mp4k index 31d23fe..da11607 100755 --- a/src/ks-mp4k +++ b/src/ks-mp4k @@ -2,12 +2,12 @@ ############################################################### # ks-mp4k (ks-tools) - Convert video to MP4 format (4K) # -# Date: 10-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="100223" +M_DATE="130223" # Detect version ffmpeg for old releases ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) @@ -107,13 +107,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-mp4k (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mp4s b/src/ks-mp4s index 0ce6d7e..6bc7fc2 100755 --- a/src/ks-mp4s +++ b/src/ks-mp4s @@ -2,12 +2,12 @@ ############################################################### # ks-mp4s (ks-tools) - Convert video to MP4 format (Series) # -# Date: 10-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="100223" +M_DATE="130223" # Detect version ffmpeg for old releases ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) @@ -107,13 +107,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-mp4s (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-mp4s-folder b/src/ks-mp4s-folder index e71a7f3..b6cd580 100755 --- a/src/ks-mp4s-folder +++ b/src/ks-mp4s-folder @@ -20,6 +20,39 @@ if [ -f "/usr/bin/cygwin-alias.sh" ] ; then source "/usr/bin/cygwin-alias.sh" fi +# Check if ffmpeg is installed +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep find grep cut head tail cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else + echo "" + echo "* ks-mp4s-folder (ks-tools) v${VERSION} (${M_DATE})" + echo "" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" + echo "" + exit +fi + # Show help when folder is empty if [ -z "${1}" ] ; then echo "" diff --git a/src/ks-oga b/src/ks-oga index 09db472..185ca04 100755 --- a/src/ks-oga +++ b/src/ks-oga @@ -2,12 +2,12 @@ ############################################################################# # ks-oga (ks-tools) - Convert video/audio file(s) to OGA (OGG Audio) Format # -# Date: 04-02-2022 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################################# VERSION="8.4-dev" -M_DATE="040222" +M_DATE="130223" # Global parameters dirTemp="/tmp" @@ -59,13 +59,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep sed grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-oga (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-oga-album b/src/ks-oga-album index 2698c9b..27428e7 100755 --- a/src/ks-oga-album +++ b/src/ks-oga-album @@ -66,13 +66,34 @@ else fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep find grep cut head tail tr cat" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-oga-album (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi diff --git a/src/ks-upa b/src/ks-upa index f78ca25..75730c6 100755 --- a/src/ks-upa +++ b/src/ks-upa @@ -2,12 +2,12 @@ ######################################################################## # ks-upa (ks-tools) - Upload audio file(s) to server with scp or rsync # -# Date: 12-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ######################################################################## VERSION="8.4-dev" -M_DATE="120223" +M_DATE="130223" # Global parameters. dirTemp="/tmp" @@ -659,7 +659,7 @@ function showHelp() { # for the execution are installed. function checkDependencies() { path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" - dependencies="sshpass expect rsync md5sum scp ssh" + dependencies="sshpass expect rsync md5sum scp ssh find grep sed cut head tail cat" dependencies_found="" dependencies_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-upf b/src/ks-upf index fc83805..d0e476a 100755 --- a/src/ks-upf +++ b/src/ks-upf @@ -2,12 +2,12 @@ ######################################################################### # ks-upf (ks-tools) - Upload common file(s) to server with scp or rsync # -# Date: 12-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ######################################################################### VERSION="8.4-dev" -M_DATE="120223" +M_DATE="130223" # Global parameters. dirTemp="/tmp" @@ -686,7 +686,7 @@ function showHelp() { # for the execution are installed. function checkDependencies() { path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" - dependencies="sshpass expect rsync md5sum scp ssh" + dependencies="sshpass expect rsync md5sum scp ssh find grep sed cut head tail cat" dependencies_found="" dependencies_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-upr b/src/ks-upr index da8669f..a0c07b1 100755 --- a/src/ks-upr +++ b/src/ks-upr @@ -2,12 +2,12 @@ ############################################################################## # ks-upr (ks-tools) - Upload recursively file(s) to server with scp or rsync # -# Date: 12-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################################## VERSION="8.4-dev" -M_DATE="120223" +M_DATE="130223" # Global parameters. dirTemp="/tmp" @@ -563,7 +563,7 @@ function showHelp() { # for the execution are installed. function checkDependencies() { path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" - dependencies="sshpass expect rsync md5sum scp ssh" + dependencies="sshpass expect rsync md5sum scp ssh find grep sed cut head tail cat" dependencies_found="" dependencies_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-upv b/src/ks-upv index 4ed0c43..77d7367 100755 --- a/src/ks-upv +++ b/src/ks-upv @@ -2,12 +2,12 @@ ######################################################################### # ks-upv (ks-tools) - Upload videos file(s) to server with scp or rsync # -# Date: 12-02-2023 # +# Date: 13-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ######################################################################### VERSION="8.4-dev" -M_DATE="120223" +M_DATE="130223" # Global parameters. dirTemp="/tmp" @@ -659,7 +659,7 @@ function showHelp() { # for the execution are installed. function checkDependencies() { path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" - dependencies="sshpass expect rsync md5sum scp ssh" + dependencies="sshpass expect rsync md5sum scp ssh find grep sed cut head tail cat" dependencies_found="" dependencies_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-vob b/src/ks-vob index 5a31c84..cfde132 100755 --- a/src/ks-vob +++ b/src/ks-vob @@ -25,13 +25,34 @@ if [ -f "/usr/bin/cygwin-alias.sh" ] ; then fi # Check if ffmpeg is installed -ffmpeg_test=$(ffmpeg --help 2>&1) -error_ffmpeg=$? -if [ ${error_ffmpeg} -ne 0 ] ; then +path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" +dependencies="ffmpeg grep grep cut head tail tr" +dependencies_found="" +dependencies_not_found="" +for checkPath in ${path_check} ; do + for checkDependencies in ${dependencies} ; do + if [ -f ${checkPath}/${checkDependencies} ] ; then + dependencies_found="${dependencies_found} ${checkDependencies}" + fi + done +done +for notFound in ${dependencies} ; do + check_found_one=$(echo ${dependencies_found} | grep " ${notFound}") + check_found_two=$(echo ${dependencies_found} | grep "${notFound} ") + if_not_found="${check_found_one}${check_found_two}" + if [ -z "${if_not_found}" ] ; then + dependencies_not_found="${dependencies_not_found} ${notFound}" + fi +done +# Show if all tools are installed +if [ -z "${dependencies_not_found}" ] ; then + echo > /dev/null +else echo "" echo "* ks-vob (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "+ The 'ffmpeg' tool is not installed!" + echo "* Some required tools are not installed:${dependencies_not_found}" + echo "* The process has been stopped" echo "" exit fi