Add option for select scp or rsync for upload

This commit is contained in:
q3aql 2022-01-21 21:22:01 +01:00
parent 27a636b32c
commit 9fc9c42f1a
5 changed files with 93 additions and 8 deletions

View File

@ -723,7 +723,8 @@ while [ ${show_menu} -eq 0 ] ; do
echo ""
user_config=$(cat ${HOME}/.ks-tools/ks-upload-user 2> /dev/null)
server_config=$(cat ${HOME}/.ks-tools/ks-upload-server 2> /dev/null)
echo " u - Edit ks-upv/ks-upa/ks-upf/ks-upr config (${user_config}/${server_config})"
tool_config=$(cat ${HOME}/.ks-tools/ks-upload-tool 2> /dev/null)
echo " u - Edit ks-upv/ks-upa/ks-upf/ks-upr config (${user_config}/${server_config}/${tool_config})"
echo ""
echo " q - Exit"
echo ""

View File

@ -297,6 +297,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1
fi
if [ -f ${dirConfig}/ks-upload-tool ] ; then
showUpvTool=$(cat ${dirConfig}/ks-upload-tool)
echo "- Upload Tool: ${showUpvTool}"
configAvailable=1
fi
if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!"
fi
@ -322,6 +327,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo ""
echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})"
echo ""
@ -330,8 +336,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo ""
echo " 6 - Exit"
echo " 7 - Exit"
echo ""
echo -n "* Choose an option: " ; read EDIT
echo ""
@ -357,6 +364,14 @@ function editConfig() {
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
elif [ "${EDIT}" == "6" ] ; then
echo -n "* [Default: scp] Type upload tool (scp or rsync): " ; read TOOL
if [ -z "${TOOL}" ] ; then
upvTool="scp"
else
upvTool=${TOOL}
fi
echo ${upvTool} > ${dirConfig}/ks-upload-tool
elif [ "${EDIT}" == "7" ] ; then
editConfig=1
else
echo "+ Invalid option!"
@ -415,6 +430,12 @@ function createConfig() {
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi
# Configure upload tool by default
if [ -f ${dirConfig}/ks-upload-tool ] ; then
echo "+ The UPLOAD TOOL configuration already exists (Use: 'ks-upa -e' for edit)"
else
echo "scp" > ${dirConfig}/ks-upload-tool
fi
echo ""
}

View File

@ -315,6 +315,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1
fi
if [ -f ${dirConfig}/ks-upload-tool ] ; then
showUpvTool=$(cat ${dirConfig}/ks-upload-tool)
echo "- Upload Tool: ${showUpvTool}"
configAvailable=1
fi
if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!"
fi
@ -340,6 +345,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo ""
echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})"
echo ""
@ -348,8 +354,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo ""
echo " 6 - Exit"
echo " 7 - Exit"
echo ""
echo -n "* Choose an option: " ; read EDIT
echo ""
@ -374,7 +381,15 @@ function editConfig() {
echo -n "* Enter the local path to scan: " ; read DIR
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
elif [ "${EDIT}" == "6" ] ; then
elif [ "${EDIT}" == "6" ] ; then
echo -n "* [Default: scp] Type upload tool (scp or rsync): " ; read TOOL
if [ -z "${TOOL}" ] ; then
upvTool="scp"
else
upvTool=${TOOL}
fi
echo ${upvTool} > ${dirConfig}/ks-upload-tool
elif [ "${EDIT}" == "7" ] ; then
editConfig=1
else
echo "+ Invalid option!"
@ -433,6 +448,12 @@ function createConfig() {
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi
# Configure upload tool by default
if [ -f ${dirConfig}/ks-upload-tool ] ; then
echo "+ The UPLOAD TOOL configuration already exists (Use: 'ks-upa -e' for edit)"
else
echo "scp" > ${dirConfig}/ks-upload-tool
fi
echo ""
}

View File

@ -257,6 +257,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1
fi
if [ -f ${dirConfig}/ks-upload-tool ] ; then
showUpvTool=$(cat ${dirConfig}/ks-upload-tool)
echo "- Upload Tool: ${showUpvTool}"
configAvailable=1
fi
if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!"
fi
@ -282,6 +287,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo ""
echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})"
echo ""
@ -290,8 +296,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo ""
echo " 6 - Exit"
echo " 7 - Exit"
echo ""
echo -n "* Choose an option: " ; read EDIT
echo ""
@ -316,7 +323,15 @@ function editConfig() {
echo -n "* Enter the local path to scan: " ; read DIR
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
elif [ "${EDIT}" == "6" ] ; then
elif [ "${EDIT}" == "6" ] ; then
echo -n "* [Default: scp] Type upload tool (scp or rsync): " ; read TOOL
if [ -z "${TOOL}" ] ; then
upvTool="scp"
else
upvTool=${TOOL}
fi
echo ${upvTool} > ${dirConfig}/ks-upload-tool
elif [ "${EDIT}" == "7" ] ; then
editConfig=1
else
echo "+ Invalid option!"
@ -375,6 +390,12 @@ function createConfig() {
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi
# Configure upload tool by default
if [ -f ${dirConfig}/ks-upload-tool ] ; then
echo "+ The UPLOAD TOOL configuration already exists (Use: 'ks-upa -e' for edit)"
else
echo "scp" > ${dirConfig}/ks-upload-tool
fi
echo ""
}

View File

@ -298,6 +298,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1
fi
if [ -f ${dirConfig}/ks-upload-tool ] ; then
showUpvTool=$(cat ${dirConfig}/ks-upload-tool)
echo "- Upload Tool: ${showUpvTool}"
configAvailable=1
fi
if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!"
fi
@ -323,6 +328,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo ""
echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})"
echo ""
@ -331,8 +337,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo ""
echo " 6 - Exit"
echo " 7 - Exit"
echo ""
echo -n "* Choose an option: " ; read EDIT
echo ""
@ -357,7 +364,15 @@ function editConfig() {
echo -n "* Enter the local path to scan: " ; read DIR
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
elif [ "${EDIT}" == "6" ] ; then
elif [ "${EDIT}" == "6" ] ; then
echo -n "* [Default: scp] Type upload tool (scp or rsync): " ; read TOOL
if [ -z "${TOOL}" ] ; then
upvTool="scp"
else
upvTool=${TOOL}
fi
echo ${upvTool} > ${dirConfig}/ks-upload-tool
elif [ "${EDIT}" == "7" ] ; then
editConfig=1
else
echo "+ Invalid option!"
@ -416,6 +431,12 @@ function createConfig() {
dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi
# Configure upload tool by default
if [ -f ${dirConfig}/ks-upload-tool ] ; then
echo "+ The UPLOAD TOOL configuration already exists (Use: 'ks-upa -e' for edit)"
else
echo "scp" > ${dirConfig}/ks-upload-tool
fi
echo ""
}