Moved FULL SYNC into rclone_script.sh

Changed RCLONE_SCRIPT-FULLSYNC.SH to only call RCLONE_SCRIPT.SH
This commit is contained in:
Jandalf81
2018-08-02 19:29:53 +02:00
parent 82c696a0f9
commit 22f6e969ab
3 changed files with 47 additions and 52 deletions

View File

@@ -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
~/scripts/rclone_script "full"

View File

@@ -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) &&

View File

@@ -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