From ef0ca8219e85ffe215d3a8b5362a5d3fc742fd0b Mon Sep 17 00:00:00 2001 From: q3aql Date: Fri, 21 Jan 2022 23:41:16 +0100 Subject: [PATCH] Show message if you use scp --- src/ks-upa | 14 ++++++++------ src/ks-upf | 14 ++++++++------ src/ks-upr | 14 ++++++++------ src/ks-upv | 14 ++++++++------ 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/ks-upa b/src/ks-upa index 7877b9a..7d61e38 100755 --- a/src/ks-upa +++ b/src/ks-upa @@ -139,9 +139,7 @@ function sendFile() { # Run command for upload on Windows (Cygwin) if [ "${cygwin}" == "yes" ] ; then if [ "${toolSelected}" == "rsync" ] ; then - comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e" - comandTwo="--progress ${2} ${3}@${4}:${5}" - ${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + /usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -l ${3}" ${2} ${4}:${5} 2> /dev/null /usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null OUTPUT=$? else @@ -151,9 +149,7 @@ function sendFile() { # Run command for upload on Unix systems else if [ "${toolSelected}" == "rsync" ] ; then - comandOne="sshpass -p ${1} rsync -azL -e" - comandTwo="--progress ${2} ${3}@${4}:${5}" - ${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + rsync --progress -azL --rsh="sshpass -p ${1} ssh -l ${3}" ${2} ${4}:${5} 2> /dev/null sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null OUTPUT=$? else @@ -628,6 +624,12 @@ elif [ "${1}" == "-i" ] ; then count=1 echo "+ ${totalFiles} audio file(s) found!" echo "" + current_tool=$(cat ${dirConfig}/ks-upload-tool) + if [ "${current_tool}" == "scp" ] ; then + echo "* NOTE: You are using 'scp' to upload files and no progress will be shown." + echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upv -e)" + echo "" + fi while [ ${count} -le ${totalFiles} ] ; do fullNameFile=$(showFile ${count}) fullPathFile=$(showPathFile ${count}) diff --git a/src/ks-upf b/src/ks-upf index 35ed411..e878c8d 100755 --- a/src/ks-upf +++ b/src/ks-upf @@ -157,9 +157,7 @@ function sendFile() { # Run command for upload on Windows (Cygwin) if [ "${cygwin}" == "yes" ] ; then if [ "${toolSelected}" == "rsync" ] ; then - comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e" - comandTwo="--progress ${2} ${3}@${4}:${5}" - ${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + /usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -l ${3}" ${2} ${4}:${5} 2> /dev/null /usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null OUTPUT=$? else @@ -169,9 +167,7 @@ function sendFile() { # Run command for upload on Unix systems else if [ "${toolSelected}" == "rsync" ] ; then - comandOne="sshpass -p ${1} rsync -azL -e" - comandTwo="--progress ${2} ${3}@${4}:${5}" - ${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + rsync --progress -azL --rsh="sshpass -p ${1} ssh -l ${3}" ${2} ${4}:${5} 2> /dev/null sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null OUTPUT=$? else @@ -646,6 +642,12 @@ elif [ "${1}" == "-i" ] ; then count=1 echo "+ ${totalFiles} common file(s) found!" echo "" + current_tool=$(cat ${dirConfig}/ks-upload-tool) + if [ "${current_tool}" == "scp" ] ; then + echo "* NOTE: You are using 'scp' to upload files and no progress will be shown." + echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upv -e)" + echo "" + fi while [ ${count} -le ${totalFiles} ] ; do fullNameFile=$(showFile ${count}) fullPathFile=$(showPathFile ${count}) diff --git a/src/ks-upr b/src/ks-upr index 90c7f10..c72de1e 100755 --- a/src/ks-upr +++ b/src/ks-upr @@ -155,9 +155,7 @@ function sendFile() { if [ "${toolSelected}" == "rsync" ] ; then echo "" echo "+ Syncing folder ${2} to ${5} (${4})" - comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e" - comandTwo="--progress ${2}/ ${3}@${4}:${5}/" - ${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + /usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -l ${3}" ${2}/ ${4}:${5}/ 2> /dev/null /usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null else echo "" @@ -169,9 +167,7 @@ function sendFile() { if [ "${toolSelected}" == "rsync" ] ; then echo "" echo "+ Syncing folder ${2} to ${5} (${4})" - comandOne="sshpass -p ${1} rsync -azlr -e" - comandTwo="--progress ${2}/ ${3}@${4}:${5}/" - ${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + rsync --progress -azL --rsh="sshpass -p ${1} ssh -l ${3}" ${2}/ ${4}:${5}/ 2> /dev/null sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null else echo "" @@ -595,6 +591,12 @@ elif [ "${1}" == "-i" ] ; then # Call the functions to perform the whole process. echo -n "* Scanning ${dirLocal} " && sleep 4 echo "" + current_tool=$(cat ${dirConfig}/ks-upload-tool) + if [ "${current_tool}" == "scp" ] ; then + echo "" + echo "* NOTE: You are using 'scp' to upload files and no progress will be shown." + echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upv -e)" + fi if [ -d ${dirLocal} ] ; then sendFile ${password} "${dirLocal}" ${user} ${server} ${dirServer} echo "" diff --git a/src/ks-upv b/src/ks-upv index af5c43f..0c6500f 100755 --- a/src/ks-upv +++ b/src/ks-upv @@ -139,9 +139,7 @@ function sendFile() { # Run command for upload on Windows (Cygwin) if [ "${cygwin}" == "yes" ] ; then if [ "${toolSelected}" == "rsync" ] ; then - comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e" - comandTwo="--progress ${2} ${3}@${4}:${5}" - ${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + /usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -l ${3}" ${2} ${4}:${5} 2> /dev/null /usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null OUTPUT=$? else @@ -151,9 +149,7 @@ function sendFile() { # Run command for upload on Unix systems else if [ "${toolSelected}" == "rsync" ] ; then - comandOne="sshpass -p ${1} rsync -azL -e" - comandTwo="--progress ${2} ${3}@${4}:${5}" - ${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null + rsync --progress -azL --rsh="sshpass -p ${1} ssh -l ${3}" ${2} ${4}:${5} 2> /dev/null sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null OUTPUT=$? else @@ -629,6 +625,12 @@ elif [ "${1}" == "-i" ] ; then count=1 echo "+ ${totalFiles} video file(s) found!" echo "" + current_tool=$(cat ${dirConfig}/ks-upload-tool) + if [ "${current_tool}" == "scp" ] ; then + echo "* NOTE: You are using 'scp' to upload files and no progress will be shown." + echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upv -e)" + echo "" + fi while [ ${count} -le ${totalFiles} ] ; do fullNameFile=$(showFile ${count}) fullPathFile=$(showPathFile ${count})