Rewrite function for check dependencies (ks-upv/upa/upf/upr)
This commit is contained in:
parent
79752b15c5
commit
53fedec45c
68
src/ks-upa
68
src/ks-upa
|
@ -2,12 +2,12 @@
|
|||
|
||||
########################################################################
|
||||
# ks-upa (ks-tools) - Upload audio file(s) to server with scp or rsync #
|
||||
# Date: 10-02-2023 #
|
||||
# Date: 12-02-2023 #
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
########################################################################
|
||||
VERSION="8.4-dev"
|
||||
M_DATE="100223"
|
||||
M_DATE="120223"
|
||||
|
||||
# Global parameters.
|
||||
dirTemp="/tmp"
|
||||
|
@ -658,49 +658,33 @@ function showHelp() {
|
|||
# Function to check if all the necessary tools
|
||||
# for the execution are installed.
|
||||
function checkDependencies() {
|
||||
dependence=0
|
||||
echo -n "* Checking necessary tools... "
|
||||
sleep 3 && echo ""
|
||||
sshpass -h &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'sshpass' tool is not installed!"
|
||||
dependence=1
|
||||
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||
dependencies="sshpass expect rsync md5sum scp ssh"
|
||||
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
|
||||
expect -v &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'expect' tool is not installed!"
|
||||
dependence=1
|
||||
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
|
||||
md5sum --help &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'md5sum' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
rsync --version &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'rsync' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/scp ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'scp' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/ssh ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'ssh' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ ${dependence} -eq 0 ] ; then
|
||||
echo "* Necessary tools installed!"
|
||||
done
|
||||
echo "* Checking necessary tools... "
|
||||
# Show if all tools are installed
|
||||
if [ -z "${dependencies_not_found}" ] ; then
|
||||
echo "* The necessary tools are installed"
|
||||
echo ""
|
||||
else
|
||||
echo "* Some required tools are not installed:${dependencies_not_found}"
|
||||
echo "* The process has been stopped"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
@ -801,7 +785,7 @@ elif [ "${1}" == "-i" ] ; then
|
|||
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||
# Call the functions to perform the whole process.
|
||||
echo -n "* Scanning ${dirLocal} " && sleep 4
|
||||
echo -n "* Scanning ${dirLocal} "
|
||||
echo ""
|
||||
if [ -d ${dirLocal} ] ; then
|
||||
listArchives "${dirLocal}"
|
||||
|
|
68
src/ks-upf
68
src/ks-upf
|
@ -2,12 +2,12 @@
|
|||
|
||||
#########################################################################
|
||||
# ks-upf (ks-tools) - Upload common file(s) to server with scp or rsync #
|
||||
# Date: 10-02-2023 #
|
||||
# Date: 12-02-2023 #
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
#########################################################################
|
||||
VERSION="8.4-dev"
|
||||
M_DATE="100223"
|
||||
M_DATE="120223"
|
||||
|
||||
# Global parameters.
|
||||
dirTemp="/tmp"
|
||||
|
@ -685,49 +685,33 @@ function showHelp() {
|
|||
# Function to check if all the necessary tools
|
||||
# for the execution are installed.
|
||||
function checkDependencies() {
|
||||
dependence=0
|
||||
echo -n "* Checking necessary tools... "
|
||||
sleep 3 && echo ""
|
||||
sshpass -h &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'sshpass' tool is not installed!"
|
||||
dependence=1
|
||||
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||
dependencies="sshpass expect rsync md5sum scp ssh"
|
||||
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
|
||||
expect -v &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'expect' tool is not installed!"
|
||||
dependence=1
|
||||
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
|
||||
md5sum --help &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'md5sum' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
rsync --version &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'rsync' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/scp ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'scp' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/ssh ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'ssh' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ ${dependence} -eq 0 ] ; then
|
||||
echo "* Necessary tools installed!"
|
||||
done
|
||||
echo "* Checking necessary tools... "
|
||||
# Show if all tools are installed
|
||||
if [ -z "${dependencies_not_found}" ] ; then
|
||||
echo "* The necessary tools are installed"
|
||||
echo ""
|
||||
else
|
||||
echo "* Some required tools are not installed:${dependencies_not_found}"
|
||||
echo "* The process has been stopped"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
@ -828,7 +812,7 @@ elif [ "${1}" == "-i" ] ; then
|
|||
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||
# Call the functions to perform the whole process.
|
||||
echo -n "* Scanning ${dirLocal} " && sleep 4
|
||||
echo -n "* Scanning ${dirLocal} "
|
||||
echo ""
|
||||
if [ -d ${dirLocal} ] ; then
|
||||
listArchives "${dirLocal}"
|
||||
|
|
68
src/ks-upr
68
src/ks-upr
|
@ -2,12 +2,12 @@
|
|||
|
||||
##############################################################################
|
||||
# ks-upr (ks-tools) - Upload recursively file(s) to server with scp or rsync #
|
||||
# Date: 10-02-2023 #
|
||||
# Date: 12-02-2023 #
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
##############################################################################
|
||||
VERSION="8.4-dev"
|
||||
M_DATE="100223"
|
||||
M_DATE="120223"
|
||||
|
||||
# Global parameters.
|
||||
dirTemp="/tmp"
|
||||
|
@ -562,49 +562,33 @@ function showHelp() {
|
|||
# Function to check if all the necessary tools
|
||||
# for the execution are installed.
|
||||
function checkDependencies() {
|
||||
dependence=0
|
||||
echo -n "* Checking necessary tools... "
|
||||
sleep 3 && echo ""
|
||||
sshpass -h &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'sshpass' tool is not installed!"
|
||||
dependence=1
|
||||
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||
dependencies="sshpass expect rsync md5sum scp ssh"
|
||||
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
|
||||
expect -v &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'expect' tool is not installed!"
|
||||
dependence=1
|
||||
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
|
||||
md5sum --help &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'md5sum' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
rsync --version &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'rsync' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/scp ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'scp' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/ssh ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'ssh' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ ${dependence} -eq 0 ] ; then
|
||||
echo "* Necessary tools installed!"
|
||||
done
|
||||
echo "* Checking necessary tools... "
|
||||
# Show if all tools are installed
|
||||
if [ -z "${dependencies_not_found}" ] ; then
|
||||
echo "* The necessary tools are installed"
|
||||
echo ""
|
||||
else
|
||||
echo "* Some required tools are not installed:${dependencies_not_found}"
|
||||
echo "* The process has been stopped"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
@ -705,7 +689,7 @@ elif [ "${1}" == "-i" ] ; then
|
|||
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||
# Call the functions to perform the whole process.
|
||||
echo -n "* Scanning ${dirLocal} " && sleep 4
|
||||
echo -n "* Scanning ${dirLocal} "
|
||||
echo ""
|
||||
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
||||
if [ "${current_tool}" == "scp" ] ; then
|
||||
|
|
68
src/ks-upv
68
src/ks-upv
|
@ -2,12 +2,12 @@
|
|||
|
||||
#########################################################################
|
||||
# ks-upv (ks-tools) - Upload videos file(s) to server with scp or rsync #
|
||||
# Date: 10-02-2023 #
|
||||
# Date: 12-02-2023 #
|
||||
# Author: q3aql #
|
||||
# Contact: q3aql@duck.com #
|
||||
#########################################################################
|
||||
VERSION="8.4-dev"
|
||||
M_DATE="100223"
|
||||
M_DATE="120223"
|
||||
|
||||
# Global parameters.
|
||||
dirTemp="/tmp"
|
||||
|
@ -658,49 +658,33 @@ function showHelp() {
|
|||
# Function to check if all the necessary tools
|
||||
# for the execution are installed.
|
||||
function checkDependencies() {
|
||||
dependence=0
|
||||
echo -n "* Checking necessary tools... "
|
||||
sleep 3 && echo ""
|
||||
sshpass -h &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'sshpass' tool is not installed!"
|
||||
dependence=1
|
||||
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||
dependencies="sshpass expect rsync md5sum scp ssh"
|
||||
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
|
||||
expect -v &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'expect' tool is not installed!"
|
||||
dependence=1
|
||||
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
|
||||
md5sum --help &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'md5sum' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
rsync --version &> /dev/null
|
||||
OUTPUT=$?
|
||||
if [ ${OUTPUT} -ne 0 ] ; then
|
||||
echo "* The 'rsync' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/scp ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'scp' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ -f /usr/bin/ssh ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "* The 'ssh' tool is not installed!"
|
||||
dependence=1
|
||||
fi
|
||||
if [ ${dependence} -eq 0 ] ; then
|
||||
echo "* Necessary tools installed!"
|
||||
done
|
||||
echo "* Checking necessary tools... "
|
||||
# Show if all tools are installed
|
||||
if [ -z "${dependencies_not_found}" ] ; then
|
||||
echo "* The necessary tools are installed"
|
||||
echo ""
|
||||
else
|
||||
echo "* Some required tools are not installed:${dependencies_not_found}"
|
||||
echo "* The process has been stopped"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
@ -802,7 +786,7 @@ elif [ "${1}" == "-i" ] ; then
|
|||
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||
# Call the functions to perform the whole process.
|
||||
echo -n "* Scanning ${dirLocal} " && sleep 4
|
||||
echo -n "* Scanning ${dirLocal} "
|
||||
echo ""
|
||||
if [ -d ${dirLocal} ] ; then
|
||||
listArchives "${dirLocal}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user