From 22f6e969abb559f5e507abde293efd9ee87036a9 Mon Sep 17 00:00:00 2001 From: Jandalf81 Date: Thu, 2 Aug 2018 19:29:53 +0200 Subject: [PATCH] Moved FULL SYNC into rclone_script.sh Changed RCLONE_SCRIPT-FULLSYNC.SH to only call RCLONE_SCRIPT.SH --- rclone_script-fullsync.sh | 47 +----------------------------------- rclone_script-install.sh | 2 -- rclone_script.sh | 50 +++++++++++++++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 52 deletions(-) diff --git a/rclone_script-fullsync.sh b/rclone_script-fullsync.sh index 404eef2..19bb77e 100644 --- a/rclone_script-fullsync.sh +++ b/rclone_script-fullsync.sh @@ -1,48 +1,3 @@ #!/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 - - -getTypeOfRemote () -{ - # list all remotes and their type - remotes=$(rclone listremotes -l) - - # get line with RETROPIE remote - retval=$(grep -i "^retropie:" <<< ${remotes}) - - remoteType="${retval#*:}" - remoteType=$(echo ${remoteType} | xargs) -} - -getTypeOfRemote - -# 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 \ No newline at end of file +~/scripts/rclone_script "full" \ No newline at end of file diff --git a/rclone_script-install.sh b/rclone_script-install.sh index eb3c92c..34e7ed6 100644 --- a/rclone_script-install.sh +++ b/rclone_script-install.sh @@ -289,8 +289,6 @@ installRCLONE_SCRIPT () # download uninstall script printf "${NORMAL} Getting UNINSTALL script... " -echo "${url}/${branch}/rclone_script-uninstall.sh" -echo "https://raw.githubusercontent.com/Jandalf81/rclone_script/master/rclone_script-uninstall.sh" { # try retval=$(wget -q -N -P ~/scripts ${url}/${branch}/rclone_script-uninstall.sh 2>&1) && diff --git a/rclone_script.sh b/rclone_script.sh index 04a90db..1dc05ea 100644 --- a/rclone_script.sh +++ b/rclone_script.sh @@ -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 \ No newline at end of file +fi + +if [ "${direction}" == "full" ] +then + getTypeOfRemote + doFullSync +fi