diff --git a/src/ks-upa b/src/ks-upa index afe714b..b254ad8 100755 --- a/src/ks-upa +++ b/src/ks-upa @@ -74,13 +74,13 @@ function listArchives() { echo "null" > /dev/null else find "${1}"/*.${format} &>> ${dirTemp}/${listCompTemp} - echo "Audio file(s) in .${format} found!" + echo "+ Audio file(s) in .${format} found!" cd "${1}" && ls -1 *.${format} &>> ${dirTemp}/${listTemp} fail=0 fi done if [ ${fail} -eq 1 ] ; then - echo "No audio file(s) found!" + echo "+ No audio file(s) found!" echo "" exit else @@ -178,35 +178,35 @@ function checkChecksum() { function showConfig() { configAvailable=0 echo "" - echo "ks-upa (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})" echo "" if [ -f ${dirConfig}/USER ] ; then showUser=$(cat ${dirConfig}/USER) - echo "Server User: ${showUser}" + echo "- Server User: ${showUser}" configAvailable=1 fi if [ -f ${dirConfig}/PASS ] ; then showPassword=$(cat ${dirConfig}/PASS) - echo "Server Password: ${showPassword}" + echo "- Server Password: ${showPassword}" configAvailable=1 fi if [ -f ${dirConfig}/SERVER ] ; then showServer=$(cat ${dirConfig}/SERVER) - echo "URL (or IP) Server: ${showServer}" + echo "- URL (or IP) Server: ${showServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR_SERVER ] ; then showDirServer=$(cat ${dirConfig}/DIR_SERVER) - echo "Destination Path (Server): ${showDirServer}" + echo "- Destination Path (Server): ${showDirServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR ] ; then showDirLocal=$(cat ${dirConfig}/DIR) - echo "Scan Path (Local): ${showDirLocal}" + echo "- Scan Path (Local): ${showDirLocal}" configAvailable=1 fi if [ ${configAvailable} -eq 0 ] ; then - echo "The configuration file does not exist!" + echo "* The configuration file does not exist!" fi echo "" exit @@ -223,43 +223,43 @@ function editConfig() { editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null) editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null) echo "" - echo "ks-upa (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "1 - Edit User (${editUser})" - echo "2 - Edit Password (${editPassword})" - echo "3 - Edit Server (${editServer})" - echo "4 - Edit Dest. Path (${editDirServer})" - echo "5 - Edit Local Path (${editDirLocal})" + echo " 1 - Edit User (${editUser})" + echo " 2 - Edit Password (${editPassword})" + echo " 3 - Edit Server (${editServer})" + echo " 4 - Edit Dest. Path (${editDirServer})" + echo " 5 - Edit Local Path (${editDirLocal})" echo "" - echo "6 - Exit" + echo " 6 - Exit" echo "" - echo -n "Choose an option: " ; read EDIT + echo -n "* Choose an option: " ; read EDIT echo "" if [ "${EDIT}" == "1" ] ; then - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER elif [ "${EDIT}" == "2" ] ; then - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS elif [ "${EDIT}" == "3" ] ; then - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER elif [ "${EDIT}" == "4" ] ; then - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER elif [ "${EDIT}" == "5" ] ; then - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR elif [ "${EDIT}" == "6" ] ; then editConfig=1 else - echo "Invalid option!" - echo -n "Press ENTER to continue " ; read CONTINUE + echo "+ Invalid option!" + echo -n "- Press ENTER to continue " ; read CONTINUE fi done exit @@ -268,7 +268,7 @@ function editConfig() { # Function to show version function showVersion() { echo "" - echo "ks-upa (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})" echo "" exit } @@ -276,18 +276,18 @@ function showVersion() { # Function to show help function showHelp() { echo "" - echo "ks-upa (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "Upload audio file(s) to server with rsync+ssh" + echo "- Upload audio file(s) to server with rsync+ssh" echo "" - echo "Sintax:" + echo "+ Sintax:" echo "" - echo "ks-upa -i - Start upload" - echo "ks-upa -r - Remove configuration" - echo "ks-upa -c - Show configuration" - echo "ks-upa -e - Edit configuration" - echo "ks-upa -v - Show version" - echo "ks-upa -h - Show help" + echo " $ ks-upa -i - Start upload" + echo " $ ks-upa -r - Remove configuration" + echo " $ ks-upa -c - Show configuration" + echo " $ ks-upa -e - Edit configuration" + echo " $ ks-upa -v - Show version" + echo " $ ks-upa -h - Show help" echo "" exit } @@ -296,40 +296,40 @@ function showHelp() { # for the execution are installed. function checkDependencies() { dependence=0 - echo -n "Checking necessary tools... " + echo -n "* Checking necessary tools... " sleep 3 && echo "" sshpass -h &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'sshpass' tool is not installed!" + echo "* The 'sshpass' tool is not installed!" dependence=1 fi md5sum --help &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'md5sum' tool is not installed!" + echo "* The 'md5sum' tool is not installed!" dependence=1 fi rsync --version &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'rsync' tool is not installed!" + 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!" + 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!" + echo "* The 'ssh' tool is not installed!" dependence=1 fi if [ ${dependence} -eq 0 ] ; then - echo "Necessary tools installed!" + echo "* Necessary tools installed!" echo "" else echo "" @@ -371,14 +371,14 @@ elif [ "$1" == "-i" ] ; then # Start script clear echo "" - echo "ks-upa (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})" echo "" checkDependencies # Ask the user and if it exists, read it from the config. if [ -f ${dirConfig}/USER ] ; then user=$(cat ${dirConfig}/USER) else - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER fi @@ -386,7 +386,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/PASS ] ; then password=$(cat ${dirConfig}/PASS) else - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS fi @@ -394,7 +394,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/SERVER ] ; then server=$(cat ${dirConfig}/SERVER) else - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER fi @@ -402,7 +402,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR_SERVER ] ; then dirServer=$(cat ${dirConfig}/DIR_SERVER) else - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER fi @@ -410,19 +410,19 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR ] ; then dirLocal=$(cat ${dirConfig}/DIR) else - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR fi # Call the functions to perform the whole process. - echo -n "Scanning ${dirLocal} " && sleep 4 + echo -n "* Scanning ${dirLocal} " && sleep 4 echo "" if [ -d ${dirLocal} ] ; then listArchives "${dirLocal}" totalFiles=$(countArchives) count=1 - echo "${totalFiles} audio file(s) found!" + echo "+ ${totalFiles} audio file(s) found!" echo "" while [ ${count} -le ${totalFiles} ] ; do fullNameFile=$(showFile ${count}) @@ -434,7 +434,7 @@ elif [ "$1" == "-i" ] ; then count=$(expr ${count} + 1) done else - echo "Directory ${dirLocal} does not exist!" + echo "* Directory ${dirLocal} does not exist!" echo "" exit fi diff --git a/src/ks-upf b/src/ks-upf index d3a03d9..254a8fc 100755 --- a/src/ks-upf +++ b/src/ks-upf @@ -92,13 +92,13 @@ function listArchives() { echo "null" > /dev/null else find "${1}"/*.${format} &>> ${dirTemp}/${listCompTemp} - echo "File(s) in .${format} format found!" + echo "+ File(s) in .${format} format found!" cd "${1}" && ls -1 *.${format} &>> ${dirTemp}/${listTemp} fail=0 fi done if [ ${fail} -eq 1 ] ; then - echo "No common file(s) found!" + echo "+ No common file(s) found!" echo "" exit else @@ -196,35 +196,35 @@ function checkChecksum() { function showConfig() { configAvailable=0 echo "" - echo "ks-upf (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})" echo "" if [ -f ${dirConfig}/USER ] ; then showUser=$(cat ${dirConfig}/USER) - echo "Server User: ${showUser}" + echo "- Server User: ${showUser}" configAvailable=1 fi if [ -f ${dirConfig}/PASS ] ; then showPassword=$(cat ${dirConfig}/PASS) - echo "Server Password: ${showPassword}" + echo "- Server Password: ${showPassword}" configAvailable=1 fi if [ -f ${dirConfig}/SERVER ] ; then showServer=$(cat ${dirConfig}/SERVER) - echo "URL (or IP) Server: ${showServer}" + echo "- URL (or IP) Server: ${showServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR_SERVER ] ; then showDirServer=$(cat ${dirConfig}/DIR_SERVER) - echo "Destination Path (Server): ${showDirServer}" + echo "- Destination Path (Server): ${showDirServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR ] ; then showDirLocal=$(cat ${dirConfig}/DIR) - echo "Scan Path (Local): ${showDirLocal}" + echo "- Scan Path (Local): ${showDirLocal}" configAvailable=1 fi if [ ${configAvailable} -eq 0 ] ; then - echo "The configuration file does not exist!" + echo "* The configuration file does not exist!" fi echo "" exit @@ -241,43 +241,43 @@ function editConfig() { editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null) editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null) echo "" - echo "ks-upf (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "1 - Edit User (${editUser})" - echo "2 - Edit Password (${editPassword})" - echo "3 - Edit Server (${editServer})" - echo "4 - Edit Dest. Path (${editDirServer})" - echo "5 - Edit Local Path (${editDirLocal})" + echo " 1 - Edit User (${editUser})" + echo " 2 - Edit Password (${editPassword})" + echo " 3 - Edit Server (${editServer})" + echo " 4 - Edit Dest. Path (${editDirServer})" + echo " 5 - Edit Local Path (${editDirLocal})" echo "" - echo "6 - Exit" + echo " 6 - Exit" echo "" - echo -n "Choose an option: " ; read EDIT + echo -n "* Choose an option: " ; read EDIT echo "" if [ "${EDIT}" == "1" ] ; then - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER elif [ "${EDIT}" == "2" ] ; then - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS elif [ "${EDIT}" == "3" ] ; then - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER elif [ "${EDIT}" == "4" ] ; then - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER elif [ "${EDIT}" == "5" ] ; then - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR elif [ "${EDIT}" == "6" ] ; then editConfig=1 else - echo "Invalid option!" - echo -n "Press ENTER to continue " ; read CONTINUE + echo "+ Invalid option!" + echo -n "- Press ENTER to continue " ; read CONTINUE fi done exit @@ -286,7 +286,7 @@ function editConfig() { # Function to show version function showVersion() { echo "" - echo "ks-upf (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})" echo "" exit } @@ -294,18 +294,18 @@ function showVersion() { # Function to show help function showHelp() { echo "" - echo "ks-upf (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "Upload common file(s) to server with rsync+ssh" + echo "- Upload common file(s) to server with rsync+ssh" echo "" - echo "Sintax:" + echo "+ Sintax:" echo "" - echo "ks-upf -i - Start upload" - echo "ks-upf -r - Remove configuration" - echo "ks-upf -c - Show configuration" - echo "ks-upf -e - Edit configuration" - echo "ks-upf -v - Show version" - echo "ks-upf -h - Show help" + echo " $ ks-upf -i - Start upload" + echo " $ ks-upf -r - Remove configuration" + echo " $ ks-upf -c - Show configuration" + echo " $ ks-upf -e - Edit configuration" + echo " $ ks-upf -v - Show version" + echo " $ ks-upf -h - Show help" echo "" exit } @@ -314,40 +314,40 @@ function showHelp() { # for the execution are installed. function checkDependencies() { dependence=0 - echo -n "Checking necessary tools... " + echo -n "* Checking necessary tools... " sleep 3 && echo "" sshpass -h &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'sshpass' tool is not installed!" + echo "* The 'sshpass' tool is not installed!" dependence=1 fi md5sum --help &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'md5sum' tool is not installed!" + echo "* The 'md5sum' tool is not installed!" dependence=1 fi rsync --version &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'rsync' tool is not installed!" + 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!" + 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!" + echo "* The 'ssh' tool is not installed!" dependence=1 fi if [ ${dependence} -eq 0 ] ; then - echo "Necessary tools installed!" + echo "* Necessary tools installed!" echo "" else echo "" @@ -389,14 +389,14 @@ elif [ "$1" == "-i" ] ; then # Start script clear echo "" - echo "ks-upf (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})" echo "" checkDependencies # Ask the user and if it exists, read it from the config. if [ -f ${dirConfig}/USER ] ; then user=$(cat ${dirConfig}/USER) else - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER fi @@ -404,7 +404,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/PASS ] ; then password=$(cat ${dirConfig}/PASS) else - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS fi @@ -412,7 +412,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/SERVER ] ; then server=$(cat ${dirConfig}/SERVER) else - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER fi @@ -420,7 +420,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR_SERVER ] ; then dirServer=$(cat ${dirConfig}/DIR_SERVER) else - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER fi @@ -428,19 +428,19 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR ] ; then dirLocal=$(cat ${dirConfig}/DIR) else - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR fi # Call the functions to perform the whole process. - echo -n "Scanning ${dirLocal} " && sleep 4 + echo -n "* Scanning ${dirLocal} " && sleep 4 echo "" if [ -d ${dirLocal} ] ; then listArchives "${dirLocal}" totalFiles=$(countArchives) count=1 - echo "${totalFiles} common file(s) found!" + echo "+ ${totalFiles} common file(s) found!" echo "" while [ ${count} -le ${totalFiles} ] ; do fullNameFile=$(showFile ${count}) @@ -452,7 +452,7 @@ elif [ "$1" == "-i" ] ; then count=$(expr ${count} + 1) done else - echo "Directory ${dirLocal} does not exist!" + echo "* Directory ${dirLocal} does not exist!" echo "" exit fi diff --git a/src/ks-upr b/src/ks-upr index c2fea0f..0bff1ef 100755 --- a/src/ks-upr +++ b/src/ks-upr @@ -92,13 +92,13 @@ function listArchives() { echo "null" > /dev/null else find "${1}"/*.${format} &>> ${dirTemp}/${listCompTemp} - echo "File(s) in .${format} format found!" + echo "+ File(s) in .${format} format found!" cd "${1}" && ls -1 *.${format} &>> ${dirTemp}/${listTemp} fail=0 fi done if [ ${fail} -eq 1 ] ; then - echo "No common file(s) found!" + echo "+ No common file(s) found!" echo "" exit else @@ -152,35 +152,35 @@ function sendFile() { function showConfig() { configAvailable=0 echo "" - echo "ks-upr (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})" echo "" if [ -f ${dirConfig}/USER ] ; then showUser=$(cat ${dirConfig}/USER) - echo "Server User: ${showUser}" + echo "- Server User: ${showUser}" configAvailable=1 fi if [ -f ${dirConfig}/PASS ] ; then showPassword=$(cat ${dirConfig}/PASS) - echo "Server Password: ${showPassword}" + echo "- Server Password: ${showPassword}" configAvailable=1 fi if [ -f ${dirConfig}/SERVER ] ; then showServer=$(cat ${dirConfig}/SERVER) - echo "URL (or IP) Server: ${showServer}" + echo "- URL (or IP) Server: ${showServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR_SERVER ] ; then showDirServer=$(cat ${dirConfig}/DIR_SERVER) - echo "Destination Path (Server): ${showDirServer}" + echo "- Destination Path (Server): ${showDirServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR ] ; then showDirLocal=$(cat ${dirConfig}/DIR) - echo "Scan Path (Local): ${showDirLocal}" + echo "- Scan Path (Local): ${showDirLocal}" configAvailable=1 fi if [ ${configAvailable} -eq 0 ] ; then - echo "The configuration file does not exist!" + echo "* The configuration file does not exist!" fi echo "" exit @@ -197,43 +197,43 @@ function editConfig() { editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null) editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null) echo "" - echo "ks-upr (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "1 - Edit User (${editUser})" - echo "2 - Edit Password (${editPassword})" - echo "3 - Edit Server (${editServer})" - echo "4 - Edit Dest. Path (${editDirServer})" - echo "5 - Edit Local Path (${editDirLocal})" + echo " 1 - Edit User (${editUser})" + echo " 2 - Edit Password (${editPassword})" + echo " 3 - Edit Server (${editServer})" + echo " 4 - Edit Dest. Path (${editDirServer})" + echo " 5 - Edit Local Path (${editDirLocal})" echo "" - echo "6 - Exit" + echo " 6 - Exit" echo "" - echo -n "Choose an option: " ; read EDIT + echo -n "* Choose an option: " ; read EDIT echo "" if [ "${EDIT}" == "1" ] ; then - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER elif [ "${EDIT}" == "2" ] ; then - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS elif [ "${EDIT}" == "3" ] ; then - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER elif [ "${EDIT}" == "4" ] ; then - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER elif [ "${EDIT}" == "5" ] ; then - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR elif [ "${EDIT}" == "6" ] ; then editConfig=1 else - echo "Invalid option!" - echo -n "Press ENTER to continue " ; read CONTINUE + echo "+ Invalid option!" + echo -n "- Press ENTER to continue " ; read CONTINUE fi done exit @@ -242,7 +242,7 @@ function editConfig() { # Function to show version function showVersion() { echo "" - echo "ks-upr (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})" echo "" exit } @@ -250,18 +250,18 @@ function showVersion() { # Function to show help function showHelp() { echo "" - echo "ks-upr (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "Upload recursively file(s) to server with rsync+ssh" + echo "- Upload recursively file(s) to server with rsync+ssh" echo "" - echo "Sintax:" + echo "+ Sintax:" echo "" - echo "ks-upf -i - Start upload" - echo "ks-upf -r - Remove configuration" - echo "ks-upf -c - Show configuration" - echo "ks-upf -e - Edit configuration" - echo "ks-upf -v - Show version" - echo "ks-upf -h - Show help" + echo " $ ks-upf -i - Start upload" + echo " $ ks-upf -r - Remove configuration" + echo " $ ks-upf -c - Show configuration" + echo " $ ks-upf -e - Edit configuration" + echo " $ ks-upf -v - Show version" + echo " $ ks-upf -h - Show help" echo "" exit } @@ -270,40 +270,40 @@ function showHelp() { # for the execution are installed. function checkDependencies() { dependence=0 - echo -n "Checking necessary tools... " + echo -n "* Checking necessary tools... " sleep 3 && echo "" sshpass -h &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'sshpass' tool is not installed!" + echo "* The 'sshpass' tool is not installed!" dependence=1 fi md5sum --help &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'md5sum' tool is not installed!" + echo "* The 'md5sum' tool is not installed!" dependence=1 fi rsync --version &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'rsync' tool is not installed!" + 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!" + 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!" + echo "* The 'ssh' tool is not installed!" dependence=1 fi if [ ${dependence} -eq 0 ] ; then - echo "Necessary tools installed!" + echo "* Necessary tools installed!" echo "" else echo "" @@ -345,14 +345,14 @@ elif [ "$1" == "-i" ] ; then # Start script clear echo "" - echo "ks-upr (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})" echo "" checkDependencies # Ask the user and if it exists, read it from the config. if [ -f ${dirConfig}/USER ] ; then user=$(cat ${dirConfig}/USER) else - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER fi @@ -360,7 +360,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/PASS ] ; then password=$(cat ${dirConfig}/PASS) else - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS fi @@ -368,7 +368,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/SERVER ] ; then server=$(cat ${dirConfig}/SERVER) else - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER fi @@ -376,7 +376,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR_SERVER ] ; then dirServer=$(cat ${dirConfig}/DIR_SERVER) else - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER fi @@ -384,20 +384,20 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR ] ; then dirLocal=$(cat ${dirConfig}/DIR) else - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR fi # Call the functions to perform the whole process. - echo -n "Scanning ${dirLocal} " && sleep 4 + echo -n "* Scanning ${dirLocal} " && sleep 4 echo "" if [ -d ${dirLocal} ] ; then sendFile ${password} "${dirLocal}" ${user} ${server} ${dirServer} echo "" count=$(expr ${count} + 1) else - echo "Directory ${dirLocal} does not exist!" + echo "* Directory ${dirLocal} does not exist!" echo "" exit fi diff --git a/src/ks-upv b/src/ks-upv index 96fa11c..ee4cbdd 100755 --- a/src/ks-upv +++ b/src/ks-upv @@ -74,13 +74,13 @@ function listArchives() { echo "null" > /dev/null else find "${1}"/*.${format} &>> ${dirTemp}/${listCompTemp} - echo "Video file(s) in .${format} found!" + echo "+ Video file(s) in .${format} found!" cd "${1}" && ls -1 *.${format} &>> ${dirTemp}/${listTemp} fail=0 fi done if [ ${fail} -eq 1 ] ; then - echo "No video file(s) found!" + echo "+ No video file(s) found!" echo "" exit else @@ -178,35 +178,35 @@ function checkChecksum() { function showConfig() { configAvailable=0 echo "" - echo "ks-upv (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})" echo "" if [ -f ${dirConfig}/USER ] ; then showUser=$(cat ${dirConfig}/USER) - echo "Server User: ${showUser}" + echo "- Server User: ${showUser}" configAvailable=1 fi if [ -f ${dirConfig}/PASS ] ; then showPassword=$(cat ${dirConfig}/PASS) - echo "Server Password: ${showPassword}" + echo "- Server Password: ${showPassword}" configAvailable=1 fi if [ -f ${dirConfig}/SERVER ] ; then showServer=$(cat ${dirConfig}/SERVER) - echo "URL (or IP) Server: ${showServer}" + echo "- URL (or IP) Server: ${showServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR_SERVER ] ; then showDirServer=$(cat ${dirConfig}/DIR_SERVER) - echo "Destination Path (Server): ${showDirServer}" + echo "- Destination Path (Server): ${showDirServer}" configAvailable=1 fi if [ -f ${dirConfig}/DIR ] ; then showDirLocal=$(cat ${dirConfig}/DIR) - echo "Scan Path (Local): ${showDirLocal}" + echo "- Scan Path (Local): ${showDirLocal}" configAvailable=1 fi if [ ${configAvailable} -eq 0 ] ; then - echo "The configuration file does not exist!" + echo "* The configuration file does not exist!" fi echo "" exit @@ -223,43 +223,43 @@ function editConfig() { editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null) editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null) echo "" - echo "ks-upv (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "1 - Edit User (${editUser})" - echo "2 - Edit Password (${editPassword})" - echo "3 - Edit Server (${editServer})" - echo "4 - Edit Dest. Path (${editDirServer})" - echo "5 - Edit Local Path (${editDirLocal})" + echo " 1 - Edit User (${editUser})" + echo " 2 - Edit Password (${editPassword})" + echo " 3 - Edit Server (${editServer})" + echo " 4 - Edit Dest. Path (${editDirServer})" + echo " 5 - Edit Local Path (${editDirLocal})" echo "" - echo "6 - Exit" + echo " 6 - Exit" echo "" - echo -n "Choose an option: " ; read EDIT + echo -n "* Choose an option: " ; read EDIT echo "" if [ "${EDIT}" == "1" ] ; then - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER elif [ "${EDIT}" == "2" ] ; then - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS elif [ "${EDIT}" == "3" ] ; then - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER elif [ "${EDIT}" == "4" ] ; then - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER elif [ "${EDIT}" == "5" ] ; then - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR elif [ "${EDIT}" == "6" ] ; then editConfig=1 else - echo "Invalid option!" - echo -n "Press ENTER to continue " ; read CONTINUE + echo "+ Invalid option!" + echo -n "- Press ENTER to continue " ; read CONTINUE fi done exit @@ -268,7 +268,7 @@ function editConfig() { # Function to show version function showVersion() { echo "" - echo "ks-upv (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})" echo "" exit } @@ -276,18 +276,18 @@ function showVersion() { # Function to show help function showHelp() { echo "" - echo "ks-upv (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})" echo "" - echo "Upload videos file(s) to server with rynsc+ssh" + echo "- Upload videos file(s) to server with rynsc+ssh" echo "" - echo "Sintax:" + echo "+ Sintax:" echo "" - echo "ks-upv -i - Start upload" - echo "ks-upv -r - Remove configuration" - echo "ks-upv -c - Show configuration" - echo "ks-upv -e - Edit configuration" - echo "ks-upv -v - Show version" - echo "ks-upv -h - Show help" + echo " $ ks-upv -i - Start upload" + echo " $ ks-upv -r - Remove configuration" + echo " $ ks-upv -c - Show configuration" + echo " $ ks-upv -e - Edit configuration" + echo " $ ks-upv -v - Show version" + echo " $ ks-upv -h - Show help" echo "" exit } @@ -296,40 +296,40 @@ function showHelp() { # for the execution are installed. function checkDependencies() { dependence=0 - echo -n "Checking necessary tools... " + echo -n "* Checking necessary tools... " sleep 3 && echo "" sshpass -h &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'sshpass' tool is not installed!" + echo "* The 'sshpass' tool is not installed!" dependence=1 fi md5sum --help &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'md5sum' tool is not installed!" + echo "* The 'md5sum' tool is not installed!" dependence=1 fi rsync --version &> /dev/null OUTPUT=$? if [ ${OUTPUT} -ne 0 ] ; then - echo "The 'rsync' tool is not installed!" + 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!" + 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!" + echo "* The 'ssh' tool is not installed!" dependence=1 fi if [ ${dependence} -eq 0 ] ; then - echo "Necessary tools installed!" + echo "* Necessary tools installed!" echo "" else echo "" @@ -371,14 +371,14 @@ elif [ "$1" == "-i" ] ; then # Start script clear echo "" - echo "ks-upv (ks-tools) v${VERSION} (${M_DATE})" + echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})" echo "" checkDependencies # Ask the user and if it exists, read it from the config. if [ -f ${dirConfig}/USER ] ; then user=$(cat ${dirConfig}/USER) else - echo -n "Enter the server user: " ; read USER + echo -n "* Enter the server user: " ; read USER user=${USER} echo ${user} > ${dirConfig}/USER fi @@ -386,7 +386,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/PASS ] ; then password=$(cat ${dirConfig}/PASS) else - echo -n "Enter the server key: " ; read PASS + echo -n "* Enter the server key: " ; read PASS password=${PASS} echo ${password} > ${dirConfig}/PASS fi @@ -394,7 +394,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/SERVER ] ; then server=$(cat ${dirConfig}/SERVER) else - echo -n "Enter the server URL: " ; read SERVER + echo -n "* Enter the server URL: " ; read SERVER server=${SERVER} echo ${server} > ${dirConfig}/SERVER fi @@ -402,7 +402,7 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR_SERVER ] ; then dirServer=$(cat ${dirConfig}/DIR_SERVER) else - echo -n "Enter the path on the server: " ; read DIR_SERVER + echo -n "* Enter the path on the server: " ; read DIR_SERVER dirServer=${DIR_SERVER} echo ${dirServer} > ${dirConfig}/DIR_SERVER fi @@ -410,19 +410,19 @@ elif [ "$1" == "-i" ] ; then if [ -f ${dirConfig}/DIR ] ; then dirLocal=$(cat ${dirConfig}/DIR) else - echo -n "Enter the local path to scan: " ; read DIR + echo -n "* Enter the local path to scan: " ; read DIR dirLocal=${DIR} echo ${dirLocal} > ${dirConfig}/DIR fi # Call the functions to perform the whole process. - echo -n "Scanning ${dirLocal} " && sleep 4 + echo -n "* Scanning ${dirLocal} " && sleep 4 echo "" if [ -d ${dirLocal} ] ; then listArchives "${dirLocal}" totalFiles=$(countArchives) count=1 - echo "${totalFiles} video file(s) found!" + echo "+ ${totalFiles} video file(s) found!" echo "" while [ ${count} -le ${totalFiles} ] ; do fullNameFile=$(showFile ${count}) @@ -434,7 +434,7 @@ elif [ "$1" == "-i" ] ; then count=$(expr ${count} + 1) done else - echo "Directory ${dirLocal} does not exist!" + echo "* Directory ${dirLocal} does not exist!" echo "" exit fi