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 "" echo ""
user_config=$(cat ${HOME}/.ks-tools/ks-upload-user 2> /dev/null) user_config=$(cat ${HOME}/.ks-tools/ks-upload-user 2> /dev/null)
server_config=$(cat ${HOME}/.ks-tools/ks-upload-server 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 ""
echo " q - Exit" echo " q - Exit"
echo "" echo ""

View File

@ -297,6 +297,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}" echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1 configAvailable=1
fi 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 if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!" echo "* The configuration file does not exist!"
fi fi
@ -322,6 +327,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null) editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null) editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null) editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo "" echo ""
echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})" echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})"
echo "" echo ""
@ -330,8 +336,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})" echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})" echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})" echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo "" echo ""
echo " 6 - Exit" echo " 7 - Exit"
echo "" echo ""
echo -n "* Choose an option: " ; read EDIT echo -n "* Choose an option: " ; read EDIT
echo "" echo ""
@ -357,6 +364,14 @@ function editConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal 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 editConfig=1
else else
echo "+ Invalid option!" echo "+ Invalid option!"
@ -415,6 +430,12 @@ function createConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi 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 "" echo ""
} }

View File

@ -315,6 +315,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}" echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1 configAvailable=1
fi 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 if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!" echo "* The configuration file does not exist!"
fi fi
@ -340,6 +345,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null) editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null) editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null) editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo "" echo ""
echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})" echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})"
echo "" echo ""
@ -348,8 +354,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})" echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})" echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})" echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo "" echo ""
echo " 6 - Exit" echo " 7 - Exit"
echo "" echo ""
echo -n "* Choose an option: " ; read EDIT echo -n "* Choose an option: " ; read EDIT
echo "" echo ""
@ -375,6 +382,14 @@ function editConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal 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 editConfig=1
else else
echo "+ Invalid option!" echo "+ Invalid option!"
@ -433,6 +448,12 @@ function createConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi 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 "" echo ""
} }

View File

@ -257,6 +257,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}" echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1 configAvailable=1
fi 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 if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!" echo "* The configuration file does not exist!"
fi fi
@ -282,6 +287,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null) editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null) editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null) editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo "" echo ""
echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})" echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})"
echo "" echo ""
@ -290,8 +296,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})" echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})" echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})" echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo "" echo ""
echo " 6 - Exit" echo " 7 - Exit"
echo "" echo ""
echo -n "* Choose an option: " ; read EDIT echo -n "* Choose an option: " ; read EDIT
echo "" echo ""
@ -317,6 +324,14 @@ function editConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal 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 editConfig=1
else else
echo "+ Invalid option!" echo "+ Invalid option!"
@ -375,6 +390,12 @@ function createConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi 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 "" echo ""
} }

View File

@ -298,6 +298,11 @@ function showConfig() {
echo "- Scan Path (Local): ${showDirLocal}" echo "- Scan Path (Local): ${showDirLocal}"
configAvailable=1 configAvailable=1
fi 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 if [ ${configAvailable} -eq 0 ] ; then
echo "* The configuration file does not exist!" echo "* The configuration file does not exist!"
fi fi
@ -323,6 +328,7 @@ function editConfig() {
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null) editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null) editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null) editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
editUpvTool=$(cat ${dirConfig}/ks-upload-tool 2> /dev/null)
echo "" echo ""
echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})" echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})"
echo "" echo ""
@ -331,8 +337,9 @@ function editConfig() {
echo " 3 - Edit Server (${editServer})" echo " 3 - Edit Server (${editServer})"
echo " 4 - Edit Dest. Path (${editDirServer})" echo " 4 - Edit Dest. Path (${editDirServer})"
echo " 5 - Edit Local Path (${editDirLocal})" echo " 5 - Edit Local Path (${editDirLocal})"
echo " 6 - Edit Upload Tool (${editUpvTool})"
echo "" echo ""
echo " 6 - Exit" echo " 7 - Exit"
echo "" echo ""
echo -n "* Choose an option: " ; read EDIT echo -n "* Choose an option: " ; read EDIT
echo "" echo ""
@ -358,6 +365,14 @@ function editConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal 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 editConfig=1
else else
echo "+ Invalid option!" echo "+ Invalid option!"
@ -416,6 +431,12 @@ function createConfig() {
dirLocal=${DIR} dirLocal=${DIR}
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
fi 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 "" echo ""
} }