added check for available connection

rclone_script-install.sh
* added new configuration setting for needed connection
* changed the way commands are added to other files (from ECHO to PRINTF)

rclone_script.sh
* added new function getAvailableConnection
* changed both downloadSaves and uploadSaves so they react on that new function (check if the available connection is greater than the needed connection, else error)

rclone_script-menu.sh
* added new menu item to re-set the needed connection
This commit is contained in:
Jandalf81
2018-08-25 14:51:43 +02:00
parent d59cf2d753
commit 3adff1c9fe
3 changed files with 118 additions and 6 deletions

View File

@@ -60,6 +60,11 @@ function getStatusOfParameters ()
else
statusShowNotifications="${RED}DISABLED${NORMAL}"
fi
case ${neededConnection} in
0) statusNeededConnection="Internet access" ;;
1) statusNeededConnection="LAN / WLAN" ;;
esac
}
function saveConfig ()
@@ -68,6 +73,7 @@ function saveConfig ()
echo "showNotifications=${showNotifications}" >> ${config}
echo "syncOnStartStop=${syncOnStartStop}" >> ${config}
echo "logfile=~/scripts/rclone_script/rclone_script.log" >> ${config}
echo "neededConnection=${neededConnection}" >> ${config}
echo "debug=0" >> ${config}
}
@@ -95,6 +101,7 @@ function main_menu ()
1 "Full synchronization of all savefiles and statefiles" \
2 "Toggle \"Synchronize saves on start / stop\" (currently ${statusSyncOnStartStop})" \
3 "Toggle \"Show notifications on sync\" (currently ${statusShowNotifications})" \
4 "Set needed Connection (currently \"${statusNeededConnection}\")" \
"" ""\
9 "uninstall RCLONE_SCRIPT"
)
@@ -103,6 +110,7 @@ function main_menu ()
1) doFullSync ;;
2) toggleSyncOnStartStop ;;
3) toggleShowNotifications ;;
4) setNeededConnection ;;
9) ~/scripts/rclone_script/rclone_script-uninstall.sh ;;
*) break ;;
esac
@@ -171,6 +179,31 @@ function toggleShowNotifications ()
saveConfig
}
function setNeededConnection ()
{
choice=$(dialog \
--stdout \
--colors \
--no-collapse \
--cr-wrap \
--backtitle "${backtitle}" \
--title "Needed connection" \
--default-item "${neededConnection}" \
--ok-label "Select" \
--menu "\nPlease select which type of connection will be needed for your configured remote" 20 50 5 \
0 "Internet access" \
1 "LAN / WLAN connection only"
)
case ${choice} in
0) neededConnection=0 ;;
1) neededConnection=1 ;;
*) return ;;
esac
saveConfig
}
########
# MAIN #