mirror of
https://github.com/Febbweiss/rclone_script.git
synced 2026-03-04 22:25:36 +00:00
Moved FULL SYNC into rclone_script.sh
Changed RCLONE_SCRIPT-FULLSYNC.SH to only call RCLONE_SCRIPT.SH
This commit is contained in:
@@ -1,48 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
~/scripts/rclone_script "full"
|
||||||
# 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
|
|
||||||
@@ -289,8 +289,6 @@ installRCLONE_SCRIPT ()
|
|||||||
|
|
||||||
# download uninstall script
|
# download uninstall script
|
||||||
printf "${NORMAL} Getting 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
|
{ # try
|
||||||
retval=$(wget -q -N -P ~/scripts ${url}/${branch}/rclone_script-uninstall.sh 2>&1) &&
|
retval=$(wget -q -N -P ~/scripts ${url}/${branch}/rclone_script-uninstall.sh 2>&1) &&
|
||||||
|
|||||||
@@ -1,8 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# include settings file
|
||||||
source ~/scripts/rclone_script.ini
|
source ~/scripts/rclone_script.ini
|
||||||
|
|
||||||
|
|
||||||
# parameters
|
# parameters
|
||||||
direction="$1"
|
direction="$1"
|
||||||
system="$2"
|
system="$2"
|
||||||
@@ -10,6 +20,7 @@ emulator="$3"
|
|||||||
rom="$4"
|
rom="$4"
|
||||||
command="$5"
|
command="$5"
|
||||||
|
|
||||||
|
|
||||||
log ()
|
log ()
|
||||||
{
|
{
|
||||||
severity=$1
|
severity=$1
|
||||||
@@ -185,18 +196,49 @@ uploadSaves ()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
getROMFileName
|
doFullSync ()
|
||||||
prepareFilter
|
{
|
||||||
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "${debug}" = "1" ]; then debug; fi
|
if [ "${debug}" = "1" ]; then debug; fi
|
||||||
|
|
||||||
if [ "${direction}" == "up" ]
|
if [ "${direction}" == "up" ]
|
||||||
then
|
then
|
||||||
|
getROMFileName
|
||||||
|
prepareFilter
|
||||||
|
getTypeOfRemote
|
||||||
uploadSaves
|
uploadSaves
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${direction}" == "down" ]
|
if [ "${direction}" == "down" ]
|
||||||
then
|
then
|
||||||
|
getROMFileName
|
||||||
|
prepareFilter
|
||||||
|
getTypeOfRemote
|
||||||
downloadSaves
|
downloadSaves
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${direction}" == "full" ]
|
||||||
|
then
|
||||||
|
getTypeOfRemote
|
||||||
|
doFullSync
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user