|
|
@@ -1,8 +1,18 @@
|
|
|
#!/bin/bash
|
|
|
|
|
|
+# define colors for output
|
|
|
+NORMAL=$(tput sgr0)
|
|
|
+RED=$(tput setaf 1)
|
|
|
+GREEN=$(tput setaf 2)
|
|
|
+YELLOW=$(tput setaf 3)
|
|
|
+BLUE=$(tput setaf 4)
|
|
|
+UNDERLINE=$(tput smul)
|
|
|
+
|
|
|
+
|
|
|
# include settings file
|
|
|
source ~/scripts/rclone_script.ini
|
|
|
|
|
|
+
|
|
|
# parameters
|
|
|
direction="$1"
|
|
|
system="$2"
|
|
|
@@ -10,6 +20,7 @@ emulator="$3"
|
|
|
rom="$4"
|
|
|
command="$5"
|
|
|
|
|
|
+
|
|
|
log ()
|
|
|
{
|
|
|
severity=$1
|
|
|
@@ -185,18 +196,49 @@ uploadSaves ()
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
-getROMFileName
|
|
|
-prepareFilter
|
|
|
-getTypeOfRemote
|
|
|
+doFullSync ()
|
|
|
+{
|
|
|
+ # header
|
|
|
+ printf "${UNDERLINE}Full synchronization\n\n"
|
|
|
+
|
|
|
+ # Download newer files from remote to local
|
|
|
+ printf "${NORMAL}Downloading newer files from ${YELLOW}${YELLOW}retropie:${remotebasedir} (${remoteType}) ${NORMAL}to ${YELLOW}~/RetroPie/saves/${NORMAL}...\n"
|
|
|
+ rclone copy retropie:${remotebasedir}/ ~/RetroPie/saves/ --update --verbose
|
|
|
+ printf "${GREEN}Done\n"
|
|
|
+
|
|
|
+ printf "\n"
|
|
|
+
|
|
|
+ # Upload newer files from local to remote
|
|
|
+ printf "${NORMAL}Uploading newer files from ${YELLOW}~/RetroPie/saves/${NORMAL} to ${YELLOW}${YELLOW}retropie:${remotebasedir} (${remoteType})${NORMAL} ...\n"
|
|
|
+ rclone copy ~/RetroPie/saves/ retropie:${remotebasedir}/ --update --verbose
|
|
|
+ printf "${GREEN}Done\n"
|
|
|
+
|
|
|
+ printf "\n"
|
|
|
+ printf "${NORMAL}Returning to EmulationStation in ${YELLOW}10 seconds ${NORMAL}...\n"
|
|
|
+ read -t 10
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
if [ "${debug}" = "1" ]; then debug; fi
|
|
|
|
|
|
if [ "${direction}" == "up" ]
|
|
|
then
|
|
|
+ getROMFileName
|
|
|
+ prepareFilter
|
|
|
+ getTypeOfRemote
|
|
|
uploadSaves
|
|
|
fi
|
|
|
|
|
|
if [ "${direction}" == "down" ]
|
|
|
then
|
|
|
+ getROMFileName
|
|
|
+ prepareFilter
|
|
|
+ getTypeOfRemote
|
|
|
downloadSaves
|
|
|
-fi
|
|
|
+fi
|
|
|
+
|
|
|
+if [ "${direction}" == "full" ]
|
|
|
+then
|
|
|
+ getTypeOfRemote
|
|
|
+ doFullSync
|
|
|
+fi
|