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