Add support for using expect for login uploads (ks-upv/upf/upa/upr)
This commit is contained in:
parent
7d507549b8
commit
ea2629c2a5
|
@ -34,6 +34,7 @@ alias ssh-keygen="/usr/bin/ssh-keygen"
|
||||||
alias ssh-keyscan="/usr/bin/ssh-keyscan"
|
alias ssh-keyscan="/usr/bin/ssh-keyscan"
|
||||||
alias ssh="/usr/bin/ssh"
|
alias ssh="/usr/bin/ssh"
|
||||||
alias sshpass="/usr/bin/sshpass"
|
alias sshpass="/usr/bin/sshpass"
|
||||||
|
alias expect="/usr/bin/expect"
|
||||||
alias tail="/usr/bin/tail"
|
alias tail="/usr/bin/tail"
|
||||||
alias touch="/usr/bin/touch"
|
alias touch="/usr/bin/touch"
|
||||||
alias tr="/usr/bin/tr"
|
alias tr="/usr/bin/tr"
|
||||||
|
|
131
src/ks-upa
131
src/ks-upa
|
@ -7,7 +7,7 @@
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
########################################################################
|
########################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="040222"
|
M_DATE="100223"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -144,6 +144,46 @@ function sendFile() {
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
/usr/bin/ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/rsync --progress -azL --port=${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
@ -161,6 +201,46 @@ function sendFile() {
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn rsync --progress -azL --port=${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
expect <<EOF
|
||||||
|
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
expect <<EOF
|
||||||
|
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
@ -195,6 +275,7 @@ function checkChecksum() {
|
||||||
echo -n "Checking checksum... " && sleep 4
|
echo -n "Checking checksum... " && sleep 4
|
||||||
echo ""
|
echo ""
|
||||||
toolSelected=$(cat ${dirConfig}/ks-upload-tool | grep "rsa")
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool | grep "rsa")
|
||||||
|
selectedTool=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
portSelected=$(cat ${dirConfig}/ks-upload-port)
|
portSelected=$(cat ${dirConfig}/ks-upload-port)
|
||||||
while [ ${correct} -eq 0 ] ; do
|
while [ ${correct} -eq 0 ] ; do
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
|
@ -202,6 +283,12 @@ function checkChecksum() {
|
||||||
checksumLocal=$(/usr/bin/md5sum ${2})
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
OUTPUT=0
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
OUTPUT=0
|
||||||
else
|
else
|
||||||
checksumLocal=$(/usr/bin/md5sum ${2})
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
|
@ -212,6 +299,10 @@ function checkChecksum() {
|
||||||
checksumLocal=$(md5sum ${2})
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
else
|
else
|
||||||
checksumLocal=$(md5sum ${2})
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
|
@ -227,9 +318,17 @@ function checkChecksum() {
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
correct=1
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
correct=1
|
||||||
|
else
|
||||||
echo "Local checksum: ${checksumLocal}"
|
echo "Local checksum: ${checksumLocal}"
|
||||||
echo "Server checksum: ${checksumServer}"
|
echo "Server checksum: ${checksumServer}"
|
||||||
correct=1
|
correct=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -420,8 +519,12 @@ function editConfig() {
|
||||||
echo "- rsync"
|
echo "- rsync"
|
||||||
echo "- scp-rsa (legacy RSA algorithm)"
|
echo "- scp-rsa (legacy RSA algorithm)"
|
||||||
echo "- rsync-rsa (legacy RSA algorithm)"
|
echo "- rsync-rsa (legacy RSA algorithm)"
|
||||||
|
echo "- scp-e"
|
||||||
|
echo "- rsync-e"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa): " ; read TOOL
|
echo "* Note: 'scp-e' and 'rsync-e' use 'expect' instead of 'sshpass'."
|
||||||
|
echo ""
|
||||||
|
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa/scp-e/rsync-e): " ; read TOOL
|
||||||
if [ -z "${TOOL}" ] ; then
|
if [ -z "${TOOL}" ] ; then
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
elif [ "${TOOL}" == "rsync" ] ; then
|
elif [ "${TOOL}" == "rsync" ] ; then
|
||||||
|
@ -430,6 +533,10 @@ function editConfig() {
|
||||||
upvTool="rsync-rsa"
|
upvTool="rsync-rsa"
|
||||||
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
||||||
upvTool="scp-rsa"
|
upvTool="scp-rsa"
|
||||||
|
elif [ "${TOOL}" == "scp-e" ] ; then
|
||||||
|
upvTool="scp-e"
|
||||||
|
elif [ "${TOOL}" == "rsync-e" ] ; then
|
||||||
|
upvTool="rsync-e"
|
||||||
else
|
else
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
fi
|
fi
|
||||||
|
@ -560,6 +667,12 @@ function checkDependencies() {
|
||||||
echo "* The 'sshpass' tool is not installed!"
|
echo "* The 'sshpass' tool is not installed!"
|
||||||
dependence=1
|
dependence=1
|
||||||
fi
|
fi
|
||||||
|
expect -v &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "* The 'expect' tool is not installed!"
|
||||||
|
dependence=1
|
||||||
|
fi
|
||||||
md5sum --help &> /dev/null
|
md5sum --help &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
@ -699,12 +812,12 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
if [ "${current_tool}" == "scp" ] ; then
|
if [ "${current_tool}" == "scp" ] ; then
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
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-upa -e)"
|
echo "* IMPORTANT: It's possible switch to 'rsync' or 'scp-e' if you wish (Command: ks-upa -e)"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
if [ "${current_tool}" == "scp-rsa" ] ; then
|
if [ "${current_tool}" == "scp-rsa" ] ; then
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
echo "* NOTE: You are using 'scp-rsa' to upload files and no progress will be shown."
|
||||||
echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upa -e)"
|
echo "* IMPORTANT: It's possible switch to 'rsync-rsa' if you wish (Command: ks-upa -e)"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
while [ ${count} -le ${totalFiles} ] ; do
|
while [ ${count} -le ${totalFiles} ] ; do
|
||||||
|
@ -712,7 +825,13 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
fullPathFile=$(showPathFile ${count})
|
fullPathFile=$(showPathFile ${count})
|
||||||
echo "Uploading '${fullNameFile}' "
|
echo "Uploading '${fullNameFile}' "
|
||||||
sendFile ${password} ${fullPathFile} ${user} ${server} ${dirServer} ${fullNameFile}
|
sendFile ${password} ${fullPathFile} ${user} ${server} ${dirServer} ${fullNameFile}
|
||||||
checkChecksum ${password} ${fullPathFile} ${user} ${server} ${dirServer}/${fullNameFile}
|
if [ "${current_tool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
elif [ "${current_tool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
else
|
||||||
|
checkChecksum ${password} ${fullPathFile} ${user} ${server} ${dirServer}/${fullNameFile}
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
count=$(expr ${count} + 1)
|
count=$(expr ${count} + 1)
|
||||||
done
|
done
|
||||||
|
|
131
src/ks-upf
131
src/ks-upf
|
@ -7,7 +7,7 @@
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="040222"
|
M_DATE="100223"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -171,6 +171,46 @@ function sendFile() {
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
/usr/bin/ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/rsync --progress -azL --port=${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
@ -188,6 +228,46 @@ function sendFile() {
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn rsync --progress -azL --port=${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
expect <<EOF
|
||||||
|
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
expect <<EOF
|
||||||
|
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
@ -222,6 +302,7 @@ function checkChecksum() {
|
||||||
echo -n "Checking checksum... " && sleep 4
|
echo -n "Checking checksum... " && sleep 4
|
||||||
echo ""
|
echo ""
|
||||||
toolSelected=$(cat ${dirConfig}/ks-upload-tool | grep "rsa")
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool | grep "rsa")
|
||||||
|
selectedTool=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
portSelected=$(cat ${dirConfig}/ks-upload-port)
|
portSelected=$(cat ${dirConfig}/ks-upload-port)
|
||||||
while [ ${correct} -eq 0 ] ; do
|
while [ ${correct} -eq 0 ] ; do
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
|
@ -229,6 +310,12 @@ function checkChecksum() {
|
||||||
checksumLocal=$(/usr/bin/md5sum ${2})
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
OUTPUT=0
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
OUTPUT=0
|
||||||
else
|
else
|
||||||
checksumLocal=$(/usr/bin/md5sum ${2})
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
|
@ -239,6 +326,10 @@ function checkChecksum() {
|
||||||
checksumLocal=$(md5sum ${2})
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
else
|
else
|
||||||
checksumLocal=$(md5sum ${2})
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
|
@ -254,9 +345,17 @@ function checkChecksum() {
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
correct=1
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
correct=1
|
||||||
|
else
|
||||||
echo "Local checksum: ${checksumLocal}"
|
echo "Local checksum: ${checksumLocal}"
|
||||||
echo "Server checksum: ${checksumServer}"
|
echo "Server checksum: ${checksumServer}"
|
||||||
correct=1
|
correct=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -447,8 +546,12 @@ function editConfig() {
|
||||||
echo "- rsync"
|
echo "- rsync"
|
||||||
echo "- scp-rsa (legacy RSA algorithm)"
|
echo "- scp-rsa (legacy RSA algorithm)"
|
||||||
echo "- rsync-rsa (legacy RSA algorithm)"
|
echo "- rsync-rsa (legacy RSA algorithm)"
|
||||||
|
echo "- scp-e"
|
||||||
|
echo "- rsync-e"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa): " ; read TOOL
|
echo "* Note: 'scp-e' and 'rsync-e' use 'expect' instead of 'sshpass'."
|
||||||
|
echo ""
|
||||||
|
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa/scp-e/rsync-e): " ; read TOOL
|
||||||
if [ -z "${TOOL}" ] ; then
|
if [ -z "${TOOL}" ] ; then
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
elif [ "${TOOL}" == "rsync" ] ; then
|
elif [ "${TOOL}" == "rsync" ] ; then
|
||||||
|
@ -457,6 +560,10 @@ function editConfig() {
|
||||||
upvTool="rsync-rsa"
|
upvTool="rsync-rsa"
|
||||||
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
||||||
upvTool="scp-rsa"
|
upvTool="scp-rsa"
|
||||||
|
elif [ "${TOOL}" == "scp-e" ] ; then
|
||||||
|
upvTool="scp-e"
|
||||||
|
elif [ "${TOOL}" == "rsync-e" ] ; then
|
||||||
|
upvTool="rsync-e"
|
||||||
else
|
else
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
fi
|
fi
|
||||||
|
@ -587,6 +694,12 @@ function checkDependencies() {
|
||||||
echo "* The 'sshpass' tool is not installed!"
|
echo "* The 'sshpass' tool is not installed!"
|
||||||
dependence=1
|
dependence=1
|
||||||
fi
|
fi
|
||||||
|
expect -v &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "* The 'expect' tool is not installed!"
|
||||||
|
dependence=1
|
||||||
|
fi
|
||||||
md5sum --help &> /dev/null
|
md5sum --help &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
@ -726,12 +839,12 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
if [ "${current_tool}" == "scp" ] ; then
|
if [ "${current_tool}" == "scp" ] ; then
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
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-upf -e)"
|
echo "* IMPORTANT: It's possible switch to 'rsync' or 'scp-e' if you wish (Command: ks-upf -e)"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
if [ "${current_tool}" == "scp-rsa" ] ; then
|
if [ "${current_tool}" == "scp-rsa" ] ; then
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
echo "* NOTE: You are using 'scp-rsa' to upload files and no progress will be shown."
|
||||||
echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upf -e)"
|
echo "* IMPORTANT: It's possible switch to 'rsync-rsa' if you wish (Command: ks-upf -e)"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
while [ ${count} -le ${totalFiles} ] ; do
|
while [ ${count} -le ${totalFiles} ] ; do
|
||||||
|
@ -739,7 +852,13 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
fullPathFile=$(showPathFile ${count})
|
fullPathFile=$(showPathFile ${count})
|
||||||
echo "Uploading '${fullNameFile}' "
|
echo "Uploading '${fullNameFile}' "
|
||||||
sendFile ${password} ${fullPathFile} ${user} ${server} ${dirServer} ${fullNameFile}
|
sendFile ${password} ${fullPathFile} ${user} ${server} ${dirServer} ${fullNameFile}
|
||||||
checkChecksum ${password} ${fullPathFile} ${user} ${server} ${dirServer}/${fullNameFile}
|
if [ "${current_tool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
elif [ "${current_tool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
else
|
||||||
|
checkChecksum ${password} ${fullPathFile} ${user} ${server} ${dirServer}/${fullNameFile}
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
count=$(expr ${count} + 1)
|
count=$(expr ${count} + 1)
|
||||||
done
|
done
|
||||||
|
|
72
src/ks-upr
72
src/ks-upr
|
@ -7,7 +7,7 @@
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
##############################################################################
|
##############################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="040222"
|
M_DATE="100223"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -151,6 +151,30 @@ function sendFile() {
|
||||||
echo "+ Syncing folder ${2} to ${5} (${4})"
|
echo "+ Syncing folder ${2} to ${5} (${4})"
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2}/ ${4}:${5}/ 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2}/ ${4}:${5}/ 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
/usr/bin/ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/rsync --progress -rlDzL --port=${portSelected} ${2}/ ${3}@${4}:${5}/
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} -r ${2}/* ${3}@${4}:${5}/
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "+ Syncing folder ${2} to ${5} (${4})"
|
echo "+ Syncing folder ${2} to ${5} (${4})"
|
||||||
|
@ -172,6 +196,30 @@ function sendFile() {
|
||||||
echo "+ Syncing folder ${2} to ${5} (${4})"
|
echo "+ Syncing folder ${2} to ${5} (${4})"
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2}/ ${4}:${5}/ 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2}/ ${4}:${5}/ 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn rsync --progress -rlDzL --port=${portSelected} ${2}/ ${3}@${4}:${5}/
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} -r ${2}/* ${3}@${4}:${5}/
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "+ Syncing folder ${2} to ${5} (${4})"
|
echo "+ Syncing folder ${2} to ${5} (${4})"
|
||||||
|
@ -375,8 +423,12 @@ function editConfig() {
|
||||||
echo "- rsync"
|
echo "- rsync"
|
||||||
echo "- scp-rsa (legacy RSA algorithm)"
|
echo "- scp-rsa (legacy RSA algorithm)"
|
||||||
echo "- rsync-rsa (legacy RSA algorithm)"
|
echo "- rsync-rsa (legacy RSA algorithm)"
|
||||||
|
echo "- scp-e"
|
||||||
|
echo "- rsync-e"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa): " ; read TOOL
|
echo "* Note: 'scp-e' and 'rsync-e' use 'expect' instead of 'sshpass'."
|
||||||
|
echo ""
|
||||||
|
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa/scp-e/rsync-e): " ; read TOOL
|
||||||
if [ -z "${TOOL}" ] ; then
|
if [ -z "${TOOL}" ] ; then
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
elif [ "${TOOL}" == "rsync" ] ; then
|
elif [ "${TOOL}" == "rsync" ] ; then
|
||||||
|
@ -385,6 +437,10 @@ function editConfig() {
|
||||||
upvTool="rsync-rsa"
|
upvTool="rsync-rsa"
|
||||||
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
||||||
upvTool="scp-rsa"
|
upvTool="scp-rsa"
|
||||||
|
elif [ "${TOOL}" == "scp-e" ] ; then
|
||||||
|
upvTool="scp-e"
|
||||||
|
elif [ "${TOOL}" == "rsync-e" ] ; then
|
||||||
|
upvTool="rsync-e"
|
||||||
else
|
else
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
fi
|
fi
|
||||||
|
@ -515,6 +571,12 @@ function checkDependencies() {
|
||||||
echo "* The 'sshpass' tool is not installed!"
|
echo "* The 'sshpass' tool is not installed!"
|
||||||
dependence=1
|
dependence=1
|
||||||
fi
|
fi
|
||||||
|
expect -v &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "* The 'expect' tool is not installed!"
|
||||||
|
dependence=1
|
||||||
|
fi
|
||||||
md5sum --help &> /dev/null
|
md5sum --help &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
@ -649,12 +711,12 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
if [ "${current_tool}" == "scp" ] ; then
|
if [ "${current_tool}" == "scp" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
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-upr -e)"
|
echo "* IMPORTANT: It's possible switch to 'rsync' or 'scp-e' if you wish (Command: ks-upr -e)"
|
||||||
fi
|
fi
|
||||||
if [ "${current_tool}" == "scp-rsa" ] ; then
|
if [ "${current_tool}" == "scp-rsa" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
echo "* NOTE: You are using 'scp-rsa' to upload files and no progress will be shown."
|
||||||
echo "* IMPORTANT: It's possible switch to 'rsync' if you wish (Command: ks-upr -e)"
|
echo "* IMPORTANT: It's possible switch to 'rsync-rsa' if you wish (Command: ks-upr -e)"
|
||||||
fi
|
fi
|
||||||
if [ -d ${dirLocal} ] ; then
|
if [ -d ${dirLocal} ] ; then
|
||||||
sendFile ${password} "${dirLocal}" ${user} ${server} ${dirServer}
|
sendFile ${password} "${dirLocal}" ${user} ${server} ${dirServer}
|
||||||
|
|
131
src/ks-upv
131
src/ks-upv
|
@ -7,7 +7,7 @@
|
||||||
# Contact: q3aql@duck.com #
|
# Contact: q3aql@duck.com #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
VERSION="8.4-dev"
|
VERSION="8.4-dev"
|
||||||
M_DATE="040222"
|
M_DATE="100223"
|
||||||
|
|
||||||
# Global parameters.
|
# Global parameters.
|
||||||
dirTemp="/tmp"
|
dirTemp="/tmp"
|
||||||
|
@ -144,6 +144,46 @@ function sendFile() {
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
/usr/bin/ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/rsync --progress -azL --port=${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
/usr/bin/expect <<EOF
|
||||||
|
spawn /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
/usr/bin/rsync --progress -azL --rsh="/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
@ -161,6 +201,46 @@ function sendFile() {
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "rsync-e" ] ; then
|
||||||
|
keyscan_host=$(cat ~/.ssh/known_hosts | grep ${4})
|
||||||
|
if [ -z "${keyscan_host}" ] ; then
|
||||||
|
ssh-keyscan -p ${portSelected} ${4} >> ~/.ssh/known_hosts
|
||||||
|
fi
|
||||||
|
# Sync files using rsync with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn rsync --progress -azL --port=${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
expect <<EOF
|
||||||
|
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
|
elif [ "${toolSelected}" == "scp-e" ] ; then
|
||||||
|
# Sync files using scp with expect
|
||||||
|
expect <<EOF
|
||||||
|
spawn scp -o StrictHostKeyChecking=no -o CheckHostIP=no -P ${portSelected} ${2} ${3}@${4}:${5}
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
# Remove temporal files
|
||||||
|
expect <<EOF
|
||||||
|
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.*
|
||||||
|
set timeout -1
|
||||||
|
expect "*?assword:*"
|
||||||
|
send "${1}\n"
|
||||||
|
expect eof
|
||||||
|
EOF
|
||||||
|
OUTPUT=$?
|
||||||
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
elif [ "${toolSelected}" == "rsync-rsa" ] ; then
|
||||||
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
rsync --progress -azL --rsh="sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} -l ${3}" ${2} ${4}:${5} 2> /dev/null
|
||||||
sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
@ -195,6 +275,7 @@ function checkChecksum() {
|
||||||
echo -n "Checking checksum... " && sleep 4
|
echo -n "Checking checksum... " && sleep 4
|
||||||
echo ""
|
echo ""
|
||||||
toolSelected=$(cat ${dirConfig}/ks-upload-tool | grep "rsa")
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool | grep "rsa")
|
||||||
|
selectedTool=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
portSelected=$(cat ${dirConfig}/ks-upload-port)
|
portSelected=$(cat ${dirConfig}/ks-upload-port)
|
||||||
while [ ${correct} -eq 0 ] ; do
|
while [ ${correct} -eq 0 ] ; do
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
|
@ -202,6 +283,12 @@ function checkChecksum() {
|
||||||
checksumLocal=$(/usr/bin/md5sum ${2})
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
OUTPUT=0
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
OUTPUT=0
|
||||||
else
|
else
|
||||||
checksumLocal=$(/usr/bin/md5sum ${2})
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
|
@ -212,6 +299,10 @@ function checkChecksum() {
|
||||||
checksumLocal=$(md5sum ${2})
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
|
elif [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
else
|
else
|
||||||
checksumLocal=$(md5sum ${2})
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh -o HostKeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -o CheckHostIP=no -p ${portSelected} ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
|
@ -227,9 +318,17 @@ function checkChecksum() {
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [ "${selectedTool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
correct=1
|
||||||
|
elif [ "${selectedTool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
correct=1
|
||||||
|
else
|
||||||
echo "Local checksum: ${checksumLocal}"
|
echo "Local checksum: ${checksumLocal}"
|
||||||
echo "Server checksum: ${checksumServer}"
|
echo "Server checksum: ${checksumServer}"
|
||||||
correct=1
|
correct=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -420,8 +519,12 @@ function editConfig() {
|
||||||
echo "- rsync"
|
echo "- rsync"
|
||||||
echo "- scp-rsa (legacy RSA algorithm)"
|
echo "- scp-rsa (legacy RSA algorithm)"
|
||||||
echo "- rsync-rsa (legacy RSA algorithm)"
|
echo "- rsync-rsa (legacy RSA algorithm)"
|
||||||
|
echo "- scp-e"
|
||||||
|
echo "- rsync-e"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa): " ; read TOOL
|
echo "* Note: 'scp-e' and 'rsync-e' use 'expect' instead of 'sshpass'."
|
||||||
|
echo ""
|
||||||
|
echo -n "* [Default: scp] Type upload tool (scp/rsync/scp-rsa/rsync-rsa/scp-e/rsync-e): " ; read TOOL
|
||||||
if [ -z "${TOOL}" ] ; then
|
if [ -z "${TOOL}" ] ; then
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
elif [ "${TOOL}" == "rsync" ] ; then
|
elif [ "${TOOL}" == "rsync" ] ; then
|
||||||
|
@ -430,6 +533,10 @@ function editConfig() {
|
||||||
upvTool="rsync-rsa"
|
upvTool="rsync-rsa"
|
||||||
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
elif [ "${TOOL}" == "scp-rsa" ] ; then
|
||||||
upvTool="scp-rsa"
|
upvTool="scp-rsa"
|
||||||
|
elif [ "${TOOL}" == "scp-e" ] ; then
|
||||||
|
upvTool="scp-e"
|
||||||
|
elif [ "${TOOL}" == "rsync-e" ] ; then
|
||||||
|
upvTool="rsync-e"
|
||||||
else
|
else
|
||||||
upvTool="scp"
|
upvTool="scp"
|
||||||
fi
|
fi
|
||||||
|
@ -560,6 +667,12 @@ function checkDependencies() {
|
||||||
echo "* The 'sshpass' tool is not installed!"
|
echo "* The 'sshpass' tool is not installed!"
|
||||||
dependence=1
|
dependence=1
|
||||||
fi
|
fi
|
||||||
|
expect -v &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "* The 'expect' tool is not installed!"
|
||||||
|
dependence=1
|
||||||
|
fi
|
||||||
md5sum --help &> /dev/null
|
md5sum --help &> /dev/null
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
@ -700,12 +813,12 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
current_tool=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
if [ "${current_tool}" == "scp" ] ; then
|
if [ "${current_tool}" == "scp" ] ; then
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
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 "* IMPORTANT: It's possible switch to 'rsync' or 'scp-e' if you wish (Command: ks-upv -e)"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
if [ "${current_tool}" == "scp-rsa" ] ; then
|
if [ "${current_tool}" == "scp-rsa" ] ; then
|
||||||
echo "* NOTE: You are using 'scp' to upload files and no progress will be shown."
|
echo "* NOTE: You are using 'scp-rsa' 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 "* IMPORTANT: It's possible switch to 'rsync-rsa' if you wish (Command: ks-upv -e)"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
while [ ${count} -le ${totalFiles} ] ; do
|
while [ ${count} -le ${totalFiles} ] ; do
|
||||||
|
@ -713,7 +826,13 @@ elif [ "${1}" == "-i" ] ; then
|
||||||
fullPathFile=$(showPathFile ${count})
|
fullPathFile=$(showPathFile ${count})
|
||||||
echo "Uploading '${fullNameFile}' "
|
echo "Uploading '${fullNameFile}' "
|
||||||
sendFile ${password} ${fullPathFile} ${user} ${server} ${dirServer} ${fullNameFile}
|
sendFile ${password} ${fullPathFile} ${user} ${server} ${dirServer} ${fullNameFile}
|
||||||
checkChecksum ${password} ${fullPathFile} ${user} ${server} ${dirServer}/${fullNameFile}
|
if [ "${current_tool}" == "scp-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
elif [ "${current_tool}" == "rsync-e" ] ; then
|
||||||
|
echo > /dev/null
|
||||||
|
else
|
||||||
|
checkChecksum ${password} ${fullPathFile} ${user} ${server} ${dirServer}/${fullNameFile}
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
count=$(expr ${count} + 1)
|
count=$(expr ${count} + 1)
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user